2

I use the exercise package for typesetting exercises and questions. I would like to avoid the classical indentation of the questions (due to the using of a list environment, but I'm not able to set the options of this list environment).

\documentclass[11pt]{article}
\usepackage{exercise}
\usepackage{blindtext}
\setlength{\QuestionIndent}{0cm}

\usepackage{showframe}

\begin{document}

\begin{Exercise}
\Question \blindtext
\end{Exercise}


\end{document}

By setting \QuestionIndent, I get the following : enter image description here

Is it possible to put the number in the text as below ? enter image description here

1 Answer 1

3

There is no global parameter to handle it, but one can patch the code. Note that \item shifts the label by \itemindent-\labelwidth-\labelsep so one can set \itemindent to compensate for the other two (of which \labelsep at least should not be set to 0pt).

The default \labelwidth=2em will place the number slightly indented. Setting \labelwidth=0pt will move the number just to the left of the margin (due to \hss). Using \settowidth{\labelwidth}{\theQuestion.} will move the number to the right of the margin.

\documentclass[11pt]{article}
\usepackage{exercise}
\usepackage{blindtext}
\setlength{\QuestionIndent}{0cm}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@@@Question}{\labelwidth 2em}{\labelwidth 2em \itemindent=\labelwidth \advance\itemindent by \labelsep}{}{}
%\patchcmd{\@@@Question}{\labelwidth 2em}{\settowidth{\labelwidth}{\theQuestion.} \itemindent=\labelwidth \advance\itemindent by \labelsep}{}{}
\makeatother

\usepackage{showframe}

\begin{document}

\begin{Exercise}
\Question \blindtext
\end{Exercise}

\end{document}

You must log in to answer this question.

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