这个问题与“如何中断 - 恢复 Latex 中的列表“我正在为我的学生准备考试,我想使用多列环境用于测试的各个部分。
- 问题是,当我将 \begin{enumerate}[resume] 放入 \begin{multicols}{2} 环境中时,列表编号无法正确恢复。
在 multicols 环境之外,列表可以像上面提供的源一样正常恢复。
查看示例代码:
\documentclass[10pt]{article}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage{multicol}
%SET MARGINS (AND PAGE DIMENSIONS)
\usepackage[includeheadfoot,head=30pt,foot=30pt,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry}
%MULTIPLE COLUMNS
\usepackage{multicol}
%CUSTOM COMMANDS FOR INSTRUCTIONS, QUESTIONS, ANSWERS
\newcommand{\instructions}[1]{%
\colorbox{gray!20}{
\noindent\par
\noindent\makebox[\textwidth][l]{%
\begin{minipage}[t]{\linewidth}%1
%\centering
#1
\end{minipage}}
}}%
\newcommand{\question}[1]{\item #1}
%\newcommand{\answer}[1]{\textcolor{black}{\textbf{\small(Answer: #1)}}}%SHOW ANSWERS
\newcommand{\answer}[1]{\\\rule{4cm}{0.1pt}}%HIDE ANSWERS, BUT UNDERLINE
\newcommand{\fillin}[1]{\rule{4cm}{0.1pt}}
%CUSTOMIZE SECTIONS
\usepackage[]{titlesec}
\titleformat{name=\section}[block]
{\Large\bfseries\sffamily}
{}
{0pt}
{\colorsection}
\titlespacing*{\section}{0pt}{\baselineskip}{\baselineskip}
\renewcommand{\thesection}{\Alph{section}}
\newcommand{\colorsection}[1]{%
\colorbox{black}{\parbox[][1cm][b]{\dimexpr.3\textwidth-2\fboxsep}{\color{white}Part \thesection: \ #1}}}
%CUSTOM COLUMNS
\setlength{\columnsep}{1.5cm}% Column separation of text
\parindent=0pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN DOCUMENT
\begin{document}
\instructions{Fill in the blank}
\begin{multicols}{2}
\begin{enumerate}
\question{Do you prefer the modern \fillin{Ballet} to the classical.}
\question{There is a useful \fillin{bibliography} at the end of each chapter.}
\question{The photograph was \fillin{blurred} and it was hard to recognize him at first.}
\question{They \fillin{bowdlerized} the film by cutting out all the nude scenes.}
\end{enumerate}
\end{multicols}
\instructions{Write the word that matches the definition provided.}
\begin{multicols}{2}
\begin{enumerate}[resume]
\question{a long piece of cloth, often stretched between two poles, with a sign on it, usually carried by people taking part in a march.} \answer{banner}
\question{an important or exiting news story that is printed in one newspaper before any of the others know about it.} \answer{bathos}
\question{a file for holding papers, in which metal rings go through the holes in the edges of the pages, holding them in place.} \answer{binder / ring-binder}
\question{to give somebody all of the necessary information about a situation.} \answer{brief}
\question{the use of harsh-sounding words or phrases or a dicordant combination of sounds in music.}\answer{cacophony}% (opposite of euphony)
\question{insincere, specious language calculated to give the impression of piety and religious ferver. in critical writing the term is also used to signify the special language and phraseology characteristic of a profession or art.}\answer{cant}
\question{The conclusion of a play, particularly a tragedy; It is the final stage in the falling action, ending the dramatic conflict, winding up the plot and consisting of the actions that result from the climax.}\answer{catastrophe}
\question{someone who likes films very much and considers them to be a form of art, not just entertainment.}\answer{cinephile}
\end{enumerate}
\end{multicols}
\end{document}
答案1
正确的方法是使用“系列”选项:
\begin{multicols}{2}
\begin{enumerate}[series=qa]
\question{Do you prefer the modern \fillin{Ballet} to the classical.}
\question{There is a useful \fillin{bibliography} at the end of each chapter.}
\question{The photograph was \fillin{blurred} and it was hard to recognize him at first.}
\question{They \fillin{bowdlerized} the film by cutting out all the nude scenes.}
\end{enumerate}
\end{multicols}
\instructions{Write the word that matches the definition provided.}
\begin{multicols}{2}
\begin{enumerate}[resume*=qa]
\question{a long piece of cloth, often stretched between two poles, with a sign on it, usually carried by people taking part in a march.} \answer{banner}
\question{an important or exiting news story that is printed in one newspaper before any of the others know about it.} \answer{bathos}
\question{a file for holding papers, in which metal rings go through the holes in the edges of the pages, holding them in place.} \answer{binder / ring-binder}
\question{to give somebody all of the necessary information about a situation.} \answer{brief}
\question{the use of harsh-sounding words or phrases or a dicordant combination of sounds in music.}\answer{cacophony}% (opposite of euphony)
\question{insincere, specious language calculated to give the impression of piety and religious ferver. in critical writing the term is also used to signify the special language and phraseology characteristic of a profession or art.}\answer{cant}
\question{The conclusion of a play, particularly a tragedy; It is the final stage in the falling action, ending the dramatic conflict, winding up the plot and consisting of the actions that result from the climax.}\answer{catastrophe}
\question{someone who likes films very much and considers them to be a form of art, not just entertainment.}\answer{cinephile}
\end{enumerate}
\end{multicols}
为了保持逻辑结构,您可以定义自己的环境:
以下是原始答案,它可能存在问题
但是,它可以与 一起使用enumitem ver 2.x
。
您需要修改宏\enit@setresumekeys
以进行全局声明。将其放入您的序言中\usepackage{enumitem}
:
\makeatletter
\def\enit@setresumekeys #1#2#3{%
\enit@toks \expandafter {\enit@savekeys }%
\xdef \enit@afterlist {#2\def \enit@noexcs {enit@resumekeys@#1}{\the\enit@toks }%
\ifnum \enit@type =\z@ #3\gdef \enit@noexcs
{enit@resume@#1}{\csname c@\@listctr \endcsname \the \csname c@\@listctr \endcsname }%
\fi
}%
}
\makeatother
在这个宏的原始定义中,有\def \enit@noexcs
。
完整示例:
\documentclass[10pt]{article}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage{multicol}
\makeatletter
\def\enit@setresumekeys #1#2#3{%
\enit@toks \expandafter {\enit@savekeys }%
\xdef \enit@afterlist {#2\def \enit@noexcs {enit@resumekeys@#1}{\the\enit@toks }%
\ifnum \enit@type =\z@ #3\gdef \enit@noexcs
{enit@resume@#1}{\csname c@\@listctr \endcsname \the \csname c@\@listctr \endcsname }%
\fi
}%
}
\makeatother
%SET MARGINS (AND PAGE DIMENSIONS)
\usepackage[includeheadfoot,head=30pt,foot=30pt,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry}
%MULTIPLE COLUMNS
\usepackage{multicol}
%CUSTOM COMMANDS FOR INSTRUCTIONS, QUESTIONS, ANSWERS
\newcommand{\instructions}[1]{%
\colorbox{gray!20}{%
\makebox[\textwidth][l]{%
\begin{minipage}[t]{\linewidth}%1
%\centering
#1
\end{minipage}}%
}}%
\makeatletter
\newcommand{\question}[1]{\item #1}
%\newcommand{\answer}[1]{\textcolor{black}{\textbf{\small(Answer: #1)}}}%SHOW ANSWERS
\newcommand{\answer}[1]{\\\rule{4cm}{0.1pt}}%HIDE ANSWERS, BUT UNDERLINE
\newcommand{\fillin}[1]{\rule{4cm}{0.1pt}}
%CUSTOMIZE SECTIONS
\usepackage[]{titlesec}
\titleformat{name=\section}[block]
{\Large\bfseries\sffamily}
{}
{0pt}
{\colorsection}
\titlespacing*{\section}{0pt}{\baselineskip}{\baselineskip}
\renewcommand{\thesection}{\Alph{section}}
\newcommand{\colorsection}[1]{%
\colorbox{black}{\parbox[][1cm][b]{\dimexpr.3\textwidth-2\fboxsep}{\color{white}Part \thesection: \ #1}}}
%CUSTOM COLUMNS
\setlength{\columnsep}{1.5cm}% Column separation of text
\parindent=0pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN DOCUMENT
\begin{document}
\instructions{Fill in the blank}
\begin{multicols}{2}
\begin{enumerate}[resume]
\question{Do you prefer the modern \fillin{Ballet} to the classical.}
\question{There is a useful \fillin{bibliography} at the end of each chapter.}
\question{The photograph was \fillin{blurred} and it was hard to recognize him at first.}
\question{They \fillin{bowdlerized} the film by cutting out all the nude scenes.}
\end{enumerate}
\end{multicols}
\instructions{Write the word that matches the definition provided.}
\begin{multicols}{2}
\begin{enumerate}[resume]
\question{a long piece of cloth, often stretched between two poles, with a sign on it, usually carried by people taking part in a march.} \answer{banner}
\question{an important or exiting news story that is printed in one newspaper before any of the others know about it.} \answer{bathos}
\question{a file for holding papers, in which metal rings go through the holes in the edges of the pages, holding them in place.} \answer{binder / ring-binder}
\question{to give somebody all of the necessary information about a situation.} \answer{brief}
\question{the use of harsh-sounding words or phrases or a dicordant combination of sounds in music.}\answer{cacophony}% (opposite of euphony)
\question{insincere, specious language calculated to give the impression of piety and religious ferver. in critical writing the term is also used to signify the special language and phraseology characteristic of a profession or art.}\answer{cant}
\question{The conclusion of a play, particularly a tragedy; It is the final stage in the falling action, ending the dramatic conflict, winding up the plot and consisting of the actions that result from the climax.}\answer{catastrophe}
\question{someone who likes films very much and considers them to be a form of art, not just entertainment.}\answer{cinephile}
\end{enumerate}
\end{multicols}
\end{document}
作为大卫聊天中指出,该序列\noindent\par\noindent
在水平框内无效(这\colorbox
是)。此外,我%
在 的定义中添加了两个 s \instructions
,以删除它产生的两个虚假空格。