问题:
- 我希望将项目与文本对齐
exercises
。 - 我希望移动,
a)
所以它位于数字 1 的正右侧answers
。
最小工作示例(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}
电流输出:
期望输出:
让项目与练习左侧的文本对齐,并让枚举列表直接从答案编号的右侧开始,然后保持它们对齐。
答案1
如果我理解了你想要什么,这里有一个解决方案。我擅自在一些答案的逗号后添加了一个小空格。
\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}
更新:对练习部分的问题进行了再次调整,并对答案部分进行了小幅改进:
\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}
要将练习和答案分成两列,可以使用以下tasks
包:
\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}