8

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.

1
  • 1
    Related: How does "libertine-type1" work? The “new” -type1 fonts don't support \libertineGlyph. This can be done with either the old libertine-legacy package or the Xe-/LuaTeX/OpenType version libertineotf. Commented Oct 31, 2012 at 16:34

1 Answer 1

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

enter image description here

Unicode (Xe-/LuaLaTeX only)

A solution that uses the whole range of Unicode's Roman digits is already available.

6
  • 2
    I don't think this answer the question -- the OP explicitly asked for pdfTeX.
    – doncherry
    Commented Oct 31, 2012 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.
    – user4686
    Commented Oct 31, 2012 at 20:12
  • That's it! It works with the libertine-legacy package. An answer for (xe|lua)latex can also be found here
    – mafp
    Commented Oct 31, 2012 at 20:14
  • @doncherry Yes, he did, but as I wrote it should work with a working libertine-legacy, too. Commented Oct 31, 2012 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 … Commented Oct 31, 2012 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .