96

For example:

Charles's sister Bona, married the eldest son of Philip VI of France, the future John II of France, in 1335.

How can I get Roman numerals?

jevon
  • 1,190
mr.bio
  • 1,141

6 Answers6

75

Here's an example how you could use the TeX primitive (mentioned by Martin) for defining your own macro for conversion to big Roman numbers:

\documentclass{article}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\begin{document}
Charles's sister Bona, married the eldest son of Philip \rom{6} of France,
the future John \rom{2} of France, in 1335.

Today is the year \rom{2011}.
\end{document}

roman numbers

It's done similar to the definition of the LaTeX macro \Roman.

Stefan Kottwitz
  • 231,401
  • 3
    Any idea why the LaTeX kernel doesn't use \uppercase here? – Martin Scharrer Jul 19 '11 at 13:11
  • 3
    \uppercase doesn't expand the argument, so it would not have an effect here. However, \MakeUppercase would do it. – Stefan Kottwitz Jul 19 '11 at 13:20
  • 6
    I know but this can be fixed with \expandafter: \uppercase\expandafter{\romannumeral<number>\relax}. Works fine in my quick tests. – Martin Scharrer Jul 19 '11 at 13:22
  • Perhaps since only a few characters need to be capitalized, so just a few decisions but not regarding arguments from a complete alphabet. source2e did not tell it. – Stefan Kottwitz Jul 19 '11 at 13:35
  • 1
    @Martin: Try the different approaches inside an \edef, and see why \uppercase is not going to work. (I think the actual application was in \csname, but the same idea applies.) – Joseph Wright Jul 19 '11 at 13:51
  • @Joseph: Oh, yes, of course! I didn't thought about \edef context. My bad. – Martin Scharrer Jul 19 '11 at 13:52
  • @Martin If the kernel had defined \Roman as \def\@Roman#1{\uppercase\expandafter{\romannumeral#1}}, it would be OK for \label and \ref, but one could not do manipulations to the obtained strings, which instead can be done with the result from the slower routine. – egreg Jul 19 '11 at 14:03
  • @egreg: Why isn't there a \Romannumeral? Did D.E.Knuth not like uppercase roman numerals? – Martin Scharrer Jul 19 '11 at 14:05
  • @Martin I don't know; actually \uppercase\expandafter{\romannumeral<number>} works well; the main use of \romannumeral is, I think, in \csname (think to \@enumctr), so an uppercase version is unimportant. – egreg Jul 19 '11 at 14:59
  • 1
    @Stephan: how did your \rom{6} render as XXV (and was there ever a Philip XXV of France)? – raphink Jul 19 '11 at 15:40
  • I think uppercase roman numeral look nicer with a tighter kerning to merge the serifs. How would you do that? – raphink Jul 19 '11 at 15:44
  • @Raphink: I made the screenshot a bit later, inbetween I just checked if higher numbers are correctly displayed. I corrected the screenshot. – Stefan Kottwitz Jul 19 '11 at 16:29
  • @Raphink: Regarding tighter kerning for certain text, it would be good if you post it as a new question, with reference to here. – Stefan Kottwitz Jul 19 '11 at 16:30
  • Is it possible to make this somehow work in math mode? – Lazar Ljubenović Nov 10 '15 at 10:39
49

The \romannumeral kernel primitive is your friend:

\newcommand{\RNum}[1]{\uppercase\expandafter{\romannumeral #1\relax}}

Charles's sister Bona, married the eldest son of Philip \RNum{4} of France, the future John \RNum{2} of France, in 1335.
Daniel
  • 37,517
30

biblatex offers the macros \RN and \Rn for upper- resp. lowercase roman numerals, plus \RNfont and \Rnfont for formatting those numerals.

\documentclass{article}

\usepackage{biblatex}
\renewcommand*{\Rnfont}{\scshape}

% The following is only included to prevent BibTeX/biber errors!
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Philip~\RN{6} (or, if you prefer, Philip~\Rn{6})~\dots

\end{document}
lockstep
  • 250,273
26

You can convert a number to a lowercase roman numeral using the TeX primitive \romannumeral<number>\relaxor in uppercase using \uppercase\expandafter{\romannumeral<number>\relax}. Counter values can be printed in as Roman numerals using \roman{<counter>} (lowercase) and \Roman{<counter>} (uppercase).

However for simple Roman numerals in text I would simple write it as you already did.

Martin Scharrer
  • 262,582
24

Simply write

Charles's sister Bona, married the eldest son of Philip VI of France, the future John II of France, in 1335.

Gonzalo Medina
  • 505,128
23

If you want to enter roman numbers within your text,please follow these instructions.

  1. in the first step you have to install the package of "romannum".

  2. in this step you have to use this package in your text,therefore type this:

    \usepackage{romannum}
    
  3. Now you can write roman numbers in your text in lowercase or uppercase by this command.

  • \romannum{1} for Lowercase roman numbers or
  • \Romannum{1} for Uppercase roman numbers.

For example suppose that we want to write this sentence.

ten million people died between WWI and WWII.

We write in Latex:

ten million people died between WW\Romannum{1} and WW\Romannum{2}.

Also, the package changes the page numbering, so to keep it arabic you need to add this line in the preamble:

\AtBeginDocument{\pagenumbering{arabic}}
  • 6
    You should add that the package changes the presentation of all counters to roman. -- From the documentation: "LaTeX generates numbers for things like chapters and sections, figure and table captions, and page numbers. Normally these are printed using arabic digits. The romannum package modifies the typesetting of such generated numbers so that they are printed as roman numerals." – Ruben Feb 11 '18 at 18:39
  • 1
    When using \usepackage{romannum}, the page numbering automatically changed to roman numbers(additional to required places). How to keep that normal numbers – sabeelmsk Feb 03 '20 at 09:07