2

Follow-up question to For the inline enumerate: controlling the item spacing. I am having a problem with something using Exsheets and XeLaTeX to compile.

\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}

Output:

enter image description here

I am wondering if there is a way to guarantee that the leftmost part of "Here's a question" and "Line 2" align with the leftmost part of bullet (A). My \hspace{0.2cm} is merely an estimate.

Furthermore, is there a way to insert this \hspace{0.2cm} without having to put it in every time I type \begin{question}[type=exam]?

Clarinetist
  • 1,550

1 Answers1

2

You can take shelter under \before key and do some math:

\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*)}

Code:

\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}

enter image description here

With 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}

enter image description here

  • Can you elaborate on tasks? I'm still very new to exsheets.

    Also, as noted above, 0.2cm for the hspace was a guess. Is there perhaps a way to find the exact amount needed to align the line before with the choices?

    – Clarinetist Nov 08 '14 at 04:25
  • No rush. I appreciate it! – Clarinetist Nov 08 '14 at 04:26
  • Since this won't match the next question (1.2~) it might be a good idea to define a new headings instance for questions where the number part takes a fixed width and use said width with enumitem. – cgnieder Nov 08 '14 at 09:27
  • @cgnieder I agree. But since my knowledge of expl3 sucks, please feel free to correct this answer/post a new answer. –  Nov 08 '14 at 09:50
  • @HarishKumar no expl3 magic is needed. I'll see if I can post an answer... – cgnieder Nov 08 '14 at 13:32
  • Harish - Thank you for your help! @cgnieder - I would definitely be interested in seeing what you have to say. :) – Clarinetist Nov 08 '14 at 18:23
  • 1
    @Clarinetist while trying to construct an answer I started working on some long time open issues in tasks. This appears to be more work than I thought. Once it's finished and the new version is online I'll post an answer :) – cgnieder Nov 08 '14 at 18:28
  • @cgnieder That is a welcome phenomenon. :-) –  Nov 08 '14 at 23:13