# Align enumerate to text and items to numbering for exercises and answers

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{showframe}

% --------------------------------------------------------------
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\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}

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

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

\end{document}


Current output:

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.

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{showframe}

% --------------------------------------------------------------
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\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}

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

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

\end{document}


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{showframe}
% --------------------------------------------------------------
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\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}

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

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

\end{document}


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

\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}
% --------------------------------------------------------------
% --------------------------------------------------------------
\renewcommand{\ExerciseName}{}
\setlength{\ExerciseSkipBefore}{0pt}

\begin{document}

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

% --------------------------------------------------------------
% --------------------------------------------------------------
\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)$

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

• Oh! I didn't understand it that way. So, for instance a) should be under S? – Bernard Jul 15 '19 at 9:54
• Is there any reason why you don't use the \Question command? – Bernard Jul 15 '19 at 10:29