TransWikia.com

Bookmarking uppercase Roman numbers

TeX - LaTeX Asked on February 14, 2021

Have the MWE:

documentclass{article}
usepackage[backref=page,hypertexnames]{hyperref}
newcommand{RNum}[1]{uppercaseexpandafter{romannumeral #1relax}}

begin{document}
    section{Sec. RNum{1}}
    section{Sec. RNum{2}}
end{document}

The bookmark in the PDF shows that the numbers are indeed small case (while it should be upper case). How to get it fixed?

One Answer

You need an expandable version of RNum so that it appears correctly in the bookmarks. But uppercase is not expandable (see expandafter with uppercase), so you will need the slightly different definition from the LaTeX kernel (see also How can I get Roman numerals in text?, thank you to Marcel Krüger for pointing out that the initial answer had just a verbatim copy of RNum)

documentclass{article}
usepackage{hyperref}

makeatletter
newcommand*{RNum}{} % empty def to throw error if name already taken
letRNum@Roman      % actual definition
makeatother

begin{document}
    section{Sec. RNum{1}}
    section{Sec. RNum{2}}
end{document}

The bookmarks sidebar shows "Sec. I" and "Sec. II"

Correct answer by moewe on February 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP