问题
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) in roman rather than the default arabic. Is there an easy way to do this? Thanks for any pointers!
回答1:
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).
回答2:
lowercase
\romannumeral 0\ref{blah}\relax
uppercase
\uppercase\expandafter{\romannumeral 0\ref{blah}}
回答3:
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.
回答4:
For lowercase: {\romannumeral \ref{blah}}
For uppercase: \uppercase\expandafter{\romannumeral \ref{blah}}
来源:https://stackoverflow.com/questions/2579082/latex-printing-a-variable-in-roman-numerals