I use roman page number for front matter, I was just wondering, is it possible to make these roman numbers as ligature?





  • 5
    Does this question help? Roman numerals with over and underline Also related: Using Unicode Roman numerals in XeTeX – egreg Dec 28 '12 at 14:14
  • @egreg: Unicode suggests to not use the Unicode roman characters; see the comments for tex.stackexchange.com/questions/38695/… – Martin Schröder Dec 28 '12 at 14:20
  • I added the codes mentioned in " Roman numerals with over and underline" and use: \pagenumbering{barroman}. It turned out not working. It only works in text mode. @ Martin Schröder: I also tried the codes you provided, it seems work, the the page number is like 'âĚř '. – KOF Dec 28 '12 at 14:24
  • @egreg I agree it is related. However, your solution seems not to be expandable. Do you think the questions should be merged? I suppose not, but I'm not sure. – yo' Dec 28 '12 at 18:37

This introduces two new numberings: xroman and xRoman, that try to do what you want. We had to introduce our own for-cycle, because we have to make everything expandable. In the result, we just add a negative space between the letters. We use small-caps for the lower-case variant, and we use a trick with a robust command to add the dot on i.

EDIT: The new version works with hyperref package without causing warnings.

EDIT 2: The new version allows horizontal adjustments of the dot over i.

enter image description here




\DeclareRobustCommand \i@xroman{\rlap{\kern-0.007em\.{}}i}
\def \@xroman@for #1#2\@nil{\if i#1\i@xroman\else#1\fi\ifx\relax#2\relax\else\hskip-0.093em\@xroman@for#2\@nil\fi}
\def \@xRoman@for #1#2\@nil{\uppercase{#1}\ifx\relax#2\else\hskip-0.09em\@xRoman@for#2\@nil\fi}
\newcommand \@Xroman [1]{\begingroup\scshape\expandafter\expandafter\expandafter\@xroman@for\@roman{#1}\relax\@nil\endgroup}
\newcommand \@XRoman [1]{\begingroup        \expandafter\expandafter\expandafter\@xRoman@for\@roman{#1}\relax\@nil\endgroup}
\newcommand \xroman [1]{\expandafter\@xroman\csname c@#1\endcsname}
\newcommand \xRoman [1]{\expandafter\@xRoman\csname c@#1\endcsname}
  \newcommand \@xroman [1]{\texorpdfstring{\@Xroman{#1}}{\@roman{#1}}}
  \newcommand \@xRoman [1]{\texorpdfstring{\@XRoman{#1}}{\@Roman{#1}}}




This is Section \ref{abc} on page \pageref{abc}.


| improve this answer | |
  • how to use this code for front matter page numbering? \pagenumbering{xroman} seems not working. Also i tried \setcounter{page}{3} in the front matter codes, it shows still like "iii". – KOF Dec 28 '12 at 14:39
  • It really worked out, perfect! By the way, using this code with pdflatex in texmaker, it takes much longer time (100% CPU...) than in Terminal (very fast). – KOF Dec 28 '12 at 17:33
  • There is another minor issue, when using \pagenumbering{xroman} or {xRoman}, hyperref warning info: Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing `\uppercase' on input line 53. .... I know this is like using Greek symbol in Hyperref, and hence the warning inform arose. – KOF Dec 29 '12 at 11:17
  • @KOF Noticed, improved ;) – yo' Dec 30 '12 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.