我需要引用问题中的某个部分,但我已重新定义该部分以包含问题编号。我该如何使引用格式也显示这一点?
\documentclass[12pt]{exam}
\renewcommand{\thepartno}{\arabic{partno}}
\renewcommand{\partlabel}{\bfseries\thequestion.\thepartno.}
\begin{document}
\qformat{\textbf{\large{Problem \thequestion}} \hfill \vrule depth 1em width 0pt}
\begin{questions}
\question
The main question.
\begin{parts}
\part
This is part 1.1. \label{mylabel}
\part
This is part 1.1 but it is related to part \ref{mylabel} somehow.
\end{parts}
\end{questions}
\end{document}
这表示“这是第 1 部分,但它以某种方式与第 1 部分相关。”,而不是“这是第 1 部分,但它以某种方式与第 1.1 部分相关。”
答案1
LaTeX 引用系统使用\thepartno
,因此您必须添加问题,\thepartno
而不是仅仅将其添加到中\partlabel
。
\documentclass[12pt]{exam}
\renewcommand{\thepartno}{\thequestion.\arabic{partno}}
\renewcommand{\partlabel}{\bfseries\thepartno.}
\begin{document}
\qformat{\textbf{\large{Problem \thequestion}} \hfill \vrule depth 1em width 0pt}
\begin{questions}
\question
The main question.
\begin{parts}
\part
This is part 1.1. \label{mylabel}
\part
This is part 1.2 but it is related to part \ref{mylabel} somehow.
\end{parts}
\end{questions}
\end{document}