I want to use roman numerals to enumerate some sections in my latex document.
I use this: \MakeUppercase{\romannumeral 2}
to create the numeral. This works fine in the normal text but if I try to use it in a section or subsection command I get an "undefined control sequence" error even though it seems to display the numeral correctly in the section heading.
Apparently the problem is with the \MakeUppercase
command, as just the \romannumeral 2
command does not give an error.
I have also tried to define a \newcommand
with the same effect.
Does anybody have an idea why that is the case?
Edit: after creating a minimal reproducible example I figured out that the problem has something to do with the hyperref
package.
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\newcommand{\RomanNumeralCaps}[1]{\MakeUppercase{\romannumeral #1}}
\begin{document}
\chapter{Some chapter}
\section{Some section}
\subsection{Experiment \MakeUppercase{\romannumeral 1}}
\MakeUppercase{\romannumeral 1}
\RomanNumeralCaps{2}
\end{document}