开发者

latex: printing a variable in roman numerals

开发者 https://www.devze.com 2022-12-25 22:15 出处:网络
I\'m typesetting in LaTeX, and I\'d like to display a \"variable\" (in my case, a reference \\ref{blah} to an item number in list) i开发者_开发技巧n roman rather than the default arabic.Is there an ea

I'm typesetting in LaTeX, and I'd like to display a "variable" (in my case, a reference \ref{blah} to an item number in list) i开发者_开发技巧n roman rather than the default arabic. Is there an easy way to do this? Thanks for any pointers!


You can try \def\theenumi{\roman{enumi}} inside an enumerate environment -- this changes both labels and refs, but you'll have to then explicitly undo it (if you want to).


lowercase

\romannumeral 0\ref{blah}\relax

uppercase

\uppercase\expandafter{\romannumeral 0\ref{blah}}


What are the references to? Usually, you would redefine how that particular counter is displayed.

For example, to change how a section number is displayed, you could use the following command:

\renewcommand\thesection{\Roman{section}}

Now, each command that internally uses \thesection will print the section number as a roman numeral.

Similar commands work for chapter, figure etc.

\roman (lowercase r) yield lowercase roman numerals.


For lowercase: {\romannumeral \ref{blah}}

For uppercase: \uppercase\expandafter{\romannumeral \ref{blah}}


A good solution seems to me to declare

\renewcommand{\theenumi}{\roman{enumi}}
\renewcommand{\labelenumi}{(\theenumi)}

in the header and then cite by \eqref{blah} to get your (iii) for the third item. (Note that \eqref requires the amsmath package. Alternatively, write (\ref{blah}).)

0

精彩评论

暂无评论...
验证码 换一张
取 消