【发布时间】:2020-08-24 12:20:32
【问题描述】:
我想使用罗马数字来列举我的乳胶文档中的某些部分。
我使用这个:\MakeUppercase{\romannumeral 2} 来创建数字。这在普通文本中工作正常,但如果我尝试在 section 或 subsection 命令中使用它,我会收到“undefined control sequence”错误即使它似乎在部分标题中正确显示了数字。
显然问题出在\MakeUppercase 命令上,因为\romannumeral 2 命令不会出错。
我也尝试过定义\newcommand,效果相同。
有人知道为什么会这样吗?
编辑:在创建了一个最小的可重现示例后,我发现问题与 hyperref 包有关。
\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}
【问题讨论】:
-
请创建一个minimal reproducible example,我们可以编译它以重现您的问题,而不仅仅是这样的代码片段
-
感谢您指出它已经帮助缩小了问题范围
标签: latex roman-numerals