我问了一个与此相关的问题,但我没有一个可行的例子。这是原帖有没有办法根据问题编号选择替代答案。总而言之,我想根据问题的奇偶性做出具有不同起始数字的答案选择。我想我需要创建一个环境并设置引用问题计数器的条件语句,但我没有找到类似的例子。
感谢您的阅读!
\documentclass[12pt,a4paper]{report}
\pagestyle{plain}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\makeatletter
\newcommand{\skipitems}[1]{%
\addtocounter{\@enumctr}{#1}%
}
\makeatother
\begin{document}
\section{Passage I}
\begin{multicols}{2}
%-----------------------------------------------------------------------------------
%Intro paragraph
Intro paragraph place holder before starting questions
%-----------------------------------------------------------------------------------
\vspace{1cm}
\begin{enumerate}
\item Question 1
\begin{enumerate}[A.]
\item Choice A
\item Choice B
\item Choice C
\item Choice D
\end{enumerate}
\item Question 2
\begin{enumerate}[A., start = 6]
\item Choice F
\item Choice G
\item Choice H
\skipitems{1}
\item Choice J
\end{enumerate}
\item Question 3
\begin{enumerate}[A.]
\item Choice A
\item Choice B
\item Choice C
\item Choice D
\end{enumerate}
\item Question 4
\begin{enumerate}[A., start = 6]
\item Choice F
\item Choice G
\item Choice H
\skipitems{1}
\item Choice J
\end{enumerate}
\end{enumerate}
\end{multicols}
\end{document}
答案1
如果我正确理解了这个问题,那么类似这样的:
\documentclass[12pt,a4paper]{report}
\pagestyle{plain}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\makeatletter
\newcommand{\skipitems}[1]{%
\addtocounter{\@enumctr}{#1}%
}
\newcommand\startval{\ifodd\value{enumi} 1 \else 6 \fi}
\makeatother
\begin{document}
\section{Passage I}
\begin{multicols}{2}
%-----------------------------------------------------------------------------------
%Intro paragraph
Intro paragraph place holder before starting questions
%-----------------------------------------------------------------------------------
\vspace{1cm}
\begin{enumerate}
\item Question 1
\begin{enumerate}[A., start=\startval]
\item Choice A
\item Choice B
\item Choice C
\item Choice D
\end{enumerate}
\item Question 2
\begin{enumerate}[A., start=\startval]
\item Choice F
\item Choice G
\item Choice H
\skipitems{1}
\item Choice J
\end{enumerate}
\item Question 3
\begin{enumerate}[A., start=\startval]
\item Choice A
\item Choice B
\item Choice C
\item Choice D
\end{enumerate}
\item Question 4
\begin{enumerate}[A., start=\startval]
\item Choice F
\item Choice G
\item Choice H
\skipitems{1}
\item Choice J
\end{enumerate}
\end{enumerate}
\end{multicols}
\end{document}