1

Problems:

  1. I wish to align the items to the text for the exercises.
  2. I wish to move the a) so it is directly to the right of the number 1 for answers.

Minimal Working Example (MWE):

\documentclass{article}
\usepackage{amsmath}
\usepackage[shortlabels,inline]{enumitem}
\usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
\usepackage{showframe}

% --------------------------------------------------------------
% Exercise and answer options
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\renewcommand{\AnswerName}{}
\renewcommand{\ExerciseHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\renewcommand{\AnswerHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\setlength{\ExerciseSkipBefore}{0pt}

\begin{document}

% --------------------------------------------------------------
% Exercise 1
% --------------------------------------------------------------
\begin{Exercise}
Some text here \\
\begin{enumerate}[\bfseries\alph*)]
  \item $x^{2}+2 x-8$
  \item $x^{2}+2 x+8$
  \item $2 x^{2}+x$
  \item $-3+4 x-x^{2}$
\end{enumerate}
\end{Exercise}

% --------------------------------------------------------------
% Answer 1
% --------------------------------------------------------------
\begin{Answer}
\begin{enumerate}[\bfseries\alph*)]
  \item $(x+1)^{2}-9,(x-2)(x+4)$
  \item $(x+1)^{2}+7$
  \item $2\left(x+\frac{1}{4}\right)^{2}-\frac{1}{8}, 2 x\left(x+\frac{1}{2}\right)$
  \item $1-(x-2)^{2},-(x-1)(x-3)$
\end{enumerate}
\end{Answer}

% --------------------------------------------------------------
% Prints out exercises and answers
% --------------------------------------------------------------
\section{Exercises}
\shipoutExercise
\section{Answers}
\shipoutAnswer

\end{document}

Current output:

enter image description here

Desired output:

To have the items align to the text on the left for the exercises and let the enumerate list begin directly to the right of the answer number and then keep them aligned.

1 Answer 1

2

If I've well understood what you want, here is a solution. I've taken the liberty to add a small space after the comma in some answers.

\documentclass{article}
\usepackage{amsmath}
\usepackage[shortlabels,inline]{enumitem}
\usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
\usepackage{showframe}

% --------------------------------------------------------------
% Exercise and answer options
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\renewcommand{\AnswerName}{}
\renewcommand{\ExerciseHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\renewcommand{\AnswerHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\setlength{\ExerciseSkipBefore}{0pt}

\begin{document}

% --------------------------------------------------------------
% Exercise 1
% --------------------------------------------------------------
\begin{Exercise}
Some text here
\begin{enumerate}[\bfseries\alph*), wide=0pt]
  \item $x^{2}+2 x-8$
  \item $x^{2}+2 x+8$
  \item $2 x^{2}+x$
  \item $-3+4 x-x^{2}$
\end{enumerate}
\end{Exercise}

% --------------------------------------------------------------
% Answer 1
% --------------------------------------------------------------
\begin{Answer}
\begin{enumerate}[\bfseries\alph*), topsep=0pt, before= \vspace*{-\baselineskip}]
  \item $(x+1)^{2}-9,\:(x-2)(x+4)$
  \item $(x+1)^{2}+7$
  \item $2\left(x+\frac{1}{4}\right)^{2}-\frac{1}{8},\: 2 x\left(x+\frac{1}{2}\right)$
  \item $1-(x-2)^{2},\:-(x-1)(x-3)$
\end{enumerate}
\end{Answer}

% --------------------------------------------------------------
% Prints out exercises and answers
% --------------------------------------------------------------
\section{Exercises}
\shipoutExercise
\section{Answers}
\shipoutAnswer

\end{document} 

enter image description here

Update: Another alignment for the questions in the exercise part, and a small improvement of the Answers part:

\documentclass{article}
\usepackage{amsmath}
\usepackage[shortlabels,inline]{enumitem}
\usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
\usepackage{showframe}
% --------------------------------------------------------------
% Exercise and answer options
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\renewcommand{\AnswerName}{}
\renewcommand{\ExerciseHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\renewcommand{\AnswerHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\setlength{\ExerciseSkipBefore}{0pt}
\usepackage{xpatch} 
\renewcommand{\QuestionNB}{\textbf{\alph{Question})\ }}
\setlength{\QuestionBefore}{0.67em}

\begin{document}

% --------------------------------------------------------------
% Exercise 1
% --------------------------------------------------------------
\begin{Exercise}
 Some text here
 \Question $x^{2}+2 x-8$
 \Question $x^{2}+2 x+8$
 \Question $2 x^{2}+x$
 \Question $-3+4 x-x^{2}$
\end{Exercise}

% --------------------------------------------------------------
% Answer 1
% --------------------------------------------------------------
\begin{Answer}
\begin{enumerate}[\alph*), font=\bfseries, topsep=0pt, leftmargin=2.8em, before= \vspace*{-\baselineskip}]
  \item $(x+1)^{2}-9,\:(x-2)(x+4)$
  \item $(x+1)^{2}+7$
  \item $2\left(x+\frac{1}{4}\right)^{2}-\frac{1}{8},\: 2 x\left(x+\frac{1}{2}\right)$
  \item $1-(x-2)^{2},\:-(x-1)(x-3)$
\end{enumerate}
\end{Answer}

% --------------------------------------------------------------
% Prints out exercises and answers
% --------------------------------------------------------------
\section{Exercises}
\shipoutExercise
\section{Answers}
\shipoutAnswer

\end{document} 

enter image description here

To have the exercises and the answers in two columns, you can use the tasks package:

\documentclass{article}
\usepackage{amsmath}
\usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
\usepackage{tasks}
\usepackage{showframe}
% --------------------------------------------------------------
% Exercise and answer options
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\renewcommand{\AnswerName}{}
\renewcommand{\ExerciseHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\renewcommand{\AnswerHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\setlength{\ExerciseSkipBefore}{0pt}

\begin{document}

% --------------------------------------------------------------
% Exercise 1
% --------------------------------------------------------------
\begin{Exercise}
 Some text here
\begin{tasks}[label-format=\bfseries](2)
 \task $x^{2}+2 x-8$
 \task $x^{2}+2 x+8$
 \task $2 x^{2}+x$
 \task $-3+4 x-x^{2}$
\end{tasks}
\end{Exercise}

% --------------------------------------------------------------
% Answer 1
% --------------------------------------------------------------
\begin{Answer}\vspace*{-\dimexpr\baselineskip + \topsep}
\begin{tasks}[label-format=\bfseries](2)
\task $x^{2}+2 x-8$
\task $x^{2}+2 x+8$
      \task $2\left(x+\frac{1}{4}\right)^{2}-\frac{1}{8},\: 2 x\left(x+\frac{1}{2}\right)$
      \task $1-(x-2)^{2},\:-(x-1)(x-3)$
\end{tasks}
\end{Answer}

% --------------------------------------------------------------
% Prints out exercises and answers
% --------------------------------------------------------------
\section{Exercises}
\shipoutExercise
\section{Answers}
\shipoutAnswer

\end{document}

enter image description here

12
  • This is correct for Answers but for Exercises the items should be left aligned with the text "Some text here".
    – kexxcream
    Jul 15, 2019 at 9:49
  • Oh! I didn't understand it that way. So, for instance a) should be under S?
    – Bernard
    Jul 15, 2019 at 9:54
  • Yes sir, sorry for the confusion.
    – kexxcream
    Jul 15, 2019 at 9:55
  • Is there any reason why you don't use the \Question command?
    – Bernard
    Jul 15, 2019 at 10:29
  • 1
    Please see if my update is what you want.
    – Bernard
    Jul 15, 2019 at 19:28

You must log in to answer this question.

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