将 Exsheets 问题与 Enumitem Inline 对齐

将 Exsheets 问题与 Enumitem Inline 对齐

后续问题对于内联枚举:控制项目间距。我在使用 Exsheets 和 XeLaTeX 进行编译时遇到了问题。

\documentclass[11pt, twoside]{article}
\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
\setlength{\parindent}{0.375in}
\setlength{\headheight}{0.5in}

%%exam stuff
\usepackage[load-headings]{exsheets} %need to have exsheets.cfg in the same folder
\SetupExSheets{
  headings = runin-nr ,
  headings-format = \normalsize,
  %solution/print = true %get solutions printed after questions
  counter-format = 1-qu. %1-question number. is the counter format. 
}

\usepackage[inline]{enumitem}
\newlist{choices}{enumerate*}{1}
\setlist[choices]{itemjoin = \hspace{0.75in}, label=(\Alph*)}
%%exam stuff

%Times New Roman Font
\renewcommand\rmdefault{ptm}
%Times New Roman Font

\begin{document}
\begin{question}[type = exam]\hspace{0.2cm}%do hspace{0.2cm} for every question
Here's a question.
\end{question}
\begin{choices}
\item Test
\item Test
\item Test
\item Test
\item Test
\end{choices}
\end{document}

输出

在此处输入图片描述

我想知道是否有办法保证“这是一个问题”和“第 2 行”的最左侧部分与项目符号 (A) 的最左侧部分对齐。这\hspace{0.2cm}只是一个估计值。

此外,有没有办法可以插入它\hspace{0.2cm}而不必每次输入时都输入它\begin{question}[type=exam]

答案1

您可以在钥匙下避难\before并做一些计算:

\usepackage{calc}
\newlength{\mylen}
\setlength{\mylen}{\widthof{1.1.~}}

\usepackage[inline]{enumitem}
\newlist{choices}{enumerate*}{1}
\setlist[choices]{itemjoin = \hspace{0.75in},before=\noindent\hspace{\mylen},label=(\Alph*)}

代码:

\documentclass[11pt, twoside]{article}
\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
\setlength{\parindent}{0.375in}
\setlength{\headheight}{0.5in}

%%exam stuff
\usepackage[load-headings]{exsheets} %need to have exsheets.cfg in the same folder
\SetupExSheets{
  headings = runin-nr ,
  headings-format = \normalsize,
  %solution/print = true %get solutions printed after questions
  counter-format = 1-qu. %1-question number. is the counter format.
}

\usepackage{calc}
\newlength{\mylen}
\setlength{\mylen}{\widthof{1.1.~}}

\usepackage[inline]{enumitem}
\newlist{choices}{enumerate*}{1}
\setlist[choices]{itemjoin = \hspace{0.75in},before=\noindent\hspace{\mylen},label=(\Alph*)}
%%exam stuff

%Times New Roman Font
\renewcommand\rmdefault{ptm}
%Times New Roman Font
\usepackage{showframe}    %% for demo
\begin{document}
\begin{question}[type = exam]
Here's a question.
\end{question}
\noindent
\begin{choices}
\item Test
\item Test
\item Test
\item Test
\item Test
\end{choices}
\end{document}

在此处输入图片描述

tasks

\documentclass[11pt, twoside]{article}
\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
\setlength{\parindent}{0.375in}
\setlength{\headheight}{0.5in}
\usepackage{calc}
%%exam stuff
\usepackage[load-headings]{exsheets} %need to have exsheets.cfg in the same folder
\SetupExSheets{
  headings = runin-nr ,
  headings-format = \normalsize,
  %solution/print = true %get solutions printed after questions
  counter-format = 1-qu. %1-question number. is the counter format.
}

\newlength{\mylen}
\setlength{\mylen}{\widthof{1.1.~}}

\settasks{label-width=1.5em,label-align=right,label-offset = 0.5em,item-indent=\dimexpr0.5em+\mylen+1.5em\relax,before-skip =-\baselineskip}%


%\usepackage[inline]{enumitem}
%\newlist{choices}{enumerate*}{1}
%\setlist[choices]{itemjoin = \hspace{0.75in},before=\hspace{-0.2cm},align=left, label=(\Alph*)}
%%exam stuff

%Times New Roman Font
\renewcommand\rmdefault{ptm}
%Times New Roman Font

\begin{document}
\begin{question}[type = exam]%\hspace{0.2cm}%do hspace{0.2cm} for every question
Here's a question.
\end{question}
\begin{tasks}[counter-format={(tsk[A])}](5)
\task Test
\task Test
\task Test
\task Test
\task Test
\end{tasks}
\end{document}

在此处输入图片描述

相关内容