有人知道如何改进此代码,以便这两个部分都在同一行吗?我知道这是因为其中一个部分在问题部分。但是有人知道如何更改它,以便问题部分下的问题编号继续吗?
\documentclass{exam}
\renewcommand{\thequestion}{\textbf{\thesection.\arabic{question}}}
\begin{document}
\subsection{Exercises}
\begin{questions}
\question this is exercise 1
\question this is exercise 2
\question this is exercise 3
\subsection{Problems}
\question this is problem 1
\question this is problem 2
\end{questions}
\end{document}
答案1
您应该使用\questionshook
对齐部分和问题,并且可以在新的小节之前重置问题计数器。这里是:
\documentclass{exam}
\renewcommand{\questionshook}{%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}
\renewcommand{\thequestion}{\textbf{\thesection.\arabic{question}}}
\begin{document}
\begin{questions}
\section{Section}
\subsection{Exercises}
\question this is exercise 1
\question this is exercise 2
\question this is exercise 3
\setcounter{question}{0}
\subsection{Problems}
\question this is problem 1
\question this is problem 2
\end{questions}
\end{document}
此答案与以下内容相关这一。