0

In the following example, I am not really happy with the indent.

enter image description here

IMHO the indent should be as follow:

  • Header aligned with the problem name
  • No parindent for the text of the question
  • No indent for the sub question (a)
  • No indent for the answerline

Where can I configure this in the exam package?

\documentclass[addpoints]{exam}

\firstpageheader{Exam}{}{}
\runningheader{Exam}{}{}

\qformat{
  \large\textbf{Problem \thequestiontitle}
  \quad (\thepoints)\hfill
  \vrule depth 1.5em width 0pt
}

\begin{document}


\begin{questions}
    \titledquestion{Foobar}[10]
    In the following...\par
    \begin{parts}
        \part What is foo?
        \fillwithdottedlines{1cm}
    \end{parts}
\end{questions}
\end{document}
2

1 Answer 1

1

The class exam has some hooks to insert commands into the lists. Initially defined as \newcommand\questionshook{}, \newcommand\partshook{} and others, can be activated with

\renewcommand\questionshook{<newcomands>}

\renewcommand\partshook{<newcomands>}, etc.

The only solution I found to change the indentation of "In the following ..." was to insert before a negative space. Hope this is acceptable.

b

% !TeX TS-program = pdflatex

\documentclass[addpoints]{exam}

\usepackage{showframe}   % show margins

\renewcommand{\partshook}{% added <<<<<<<<<<<<
\setlength{\leftmargin}{0pt}
\setlength{\labelwidth}{-\labelsep}%
\def\makelabel##1{\hskip-\leftmargin##1}%   
}

\renewcommand{\questionshook}{% added <<<<<<<<<
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}

\firstpageheader{Exam}{}{}
\runningheader{Exam}{}{}

\qformat{%
    \parbox{\textwidth}{\large\textbf{Problem \thequestiontitle}\quad (\thepoints)\smallskip \\}% changed <<<<<<<<<
}

\begin{document}    
    
    \begin{questions}
        \titledquestion{Foo}[10]
        \hspace*{-\leftmargin}In the following... % changed <<<<<<<<<<<<<
        
            \begin{parts}
            \part What is foo?
            \fillwithdottedlines{1cm}
            \fillwithdottedlines{1cm}
            \part What is bar?
            \fillwithdottedlines{1cm}
            \fillwithdottedlines{1cm}
        \end{parts}
    \end{questions}

    \begin{questions}
    \titledquestion{Bar}[15]
    \hspace*{-\leftmargin}In the following...\par
    \begin{parts}
        \part What is bar?
        \fillwithdottedlines{1cm}
    \end{parts}
    \end{questions}

    \begin{questions}
    \titledquestion{Baz}[20]
    \hspace*{-\leftmargin}In the following...\par
    \begin{parts}
        \part What is baz?
        \fillwithdottedlines{1cm}
    \end{parts}
    \end{questions}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .