I am using the Linux Libertine font through the libertine-legacy package with pdftex. This font contains nice ligatures for roman numerals, e.g., \LibertineGlyph{tworoman} gives ii. Now I want to use those glyphs whereever they occur with counters, e.g., page numbers in frontmatter, and part numbering. In the end I would like to have an analogue to \roman, say \ligroman, that I can feed to \pagenumberstyle etc.
Asked
Active
Viewed 1,633 times
8
mafp
- 19,096
1 Answers
5
From Ⅰ to Ⅻ
Libertine and \libertineGlyph
In my example I use XeLaTeX and libertineotf which provides \libertineGlyph and the glyphs. As stated in my comment, this should work with libertine-legacy, too. The new libertine-type1 and biolinum-type1 don't support this anymore.
This provides two macros:
\libertineRoman{<countername>}for majuscle, and\libertineroman{<countername>}for minuscle Roman digits .
This approach converts only numbers between 1 and 12 into the special roman digit glyphs.
Code
\documentclass{article}
\usepackage{libertineotf}% replace with libertine-legacy
%\usepackage[T1]{fontenc}% use with pdfLaTeX
\newcommand*{\libertineRoman}[1]{%
\def\Romantemp{}%
\ifnum\value{#1}>0\relax%
\ifnum\value{#1}<13\relax%
\edef\Romantemp{\ifcase\value{#1}\or One\or Two\or Three\or Four\or Five\or Six\or Seven\or Eight\or Nine\or Ten\or Eleven\or Twelve\fi}%
\libertineGlyph{\Romantemp roman}%
\else\Roman{#1}\fi%
\else\Roman{#1}\fi%
}
\newcommand*{\libertineroman}[1]{%
\def\Romantemp{}%
\ifnum\value{#1}>0\relax%
\ifnum\value{#1}<13\relax%
\edef\Romantemp{\ifcase\value{#1}\or one\or two\or three\or four\or five\or six\or seven\or eight\or nine\or ten\or eleven\or twelve\fi}%
\libertineGlyph{\Romantemp roman}%
\else\roman{#1}\fi%
\else\roman{#1}\fi%
}
\begin{document}
\newcounter{testRoman}
\setcounter{testRoman}{13}
\loop\ifnum\value{testRoman}>1\relax\addtocounter{testRoman}{-1}
\thetestRoman: \roman{testRoman} \Roman{testRoman} \libertineroman{testRoman} \libertineRoman{testRoman} \par
\repeat
\end{document}
Output

Unicode (Xe-/LuaLaTeX only)
A solution that uses the whole range of Unicode's Roman digits is already available.
Qrrbrbirlbel
- 119,821
-
2I don't think this answer the question -- the OP explicitly asked for pdfTeX. – doncherry Oct 31 '12 at 20:09
-
@Qrrbrbirlbel @doncherry I just tried with LaTeX and with pdfLaTeX and libertine legacy (which is in my TEXMFLOCAL
$ kpsewhich libertine.sty /usr/local/texlive/2012/../texmf-local/tex/latex/libertine-legacy/libertine.sty) and it works. – Oct 31 '12 at 20:12 -
That's it! It works with the
libertine-legacypackage. An answer for (xe|lua)latex can also be found here – mafp Oct 31 '12 at 20:14 -
@doncherry Yes, he did, but as I wrote it should work with a working
libertine-legacy, too. – Qrrbrbirlbel Oct 31 '12 at 20:23 -
@mafp Were you aware of that other question when you asked yours? Apparently you don't need L, C, D and M? Than I won't pursue another solution … – Qrrbrbirlbel Oct 31 '12 at 20:26
-
@Qrrbrbirlbel No, I was not aware of that other question/answer, I just kept browsing after asking. Given that the roman numbers larger than 12 end up in a different size I will use your solution only when the counters stay below 13, so there is no need for C, D, M. – mafp Oct 31 '12 at 20:34
-type1fonts don't support\libertineGlyph. This can be done with either the oldlibertine-legacypackage or the Xe-/LuaTeX/OpenType versionlibertineotf. – Qrrbrbirlbel Oct 31 '12 at 16:34