在 LaTeX 中排版作业的更结构化的方式

Fla*_*ame 8 latex

我正在用基本结构输入一些作业

问题 问题编号

解决方案

而且我对我制作的 LaTeX 源并不真正满意。例如

\section*{Problem 1}
In order to solve $a^2+b^2 = c^2$ ...
Run Code Online (Sandbox Code Playgroud)

这个解决方案不是很好,因为它不使用自动计数器,虽然分配很短,但我以后可能会有更长的分配并且需要一个目录。

现在,我的上下文中的问题是我文档的逻辑部分,所以 \section 是有道理的。某种类型的新命令会说 \problem 更有意义吗?

las*_*ock 9

我使用考试文档类来完成这项任务。一个基本的文件看起来像这样:

\documentclass[answers]{exam}
\begin{document}
\firstpageheader{}{}{\bf\large Name \\ Class \\ Assignment \\ Due Date}
\runningheader{Name}{Class Assignment}{Due Date}

\begin{questions}
\question
    This is the question.

\begin{solution}
    This is the solution to the question.
\end{solution}

\end{questions}
\end{document}
Run Code Online (Sandbox Code Playgroud)

在发现考试类之前,我使用了Harvey Mudd College 数学系的hmcpset文档类。


dla*_*lin 3

我找到了这个例子。这并不完全是你想要的,但是如果你使用计数器以及 newcommand 和 renewcommand 定义进行查找,你应该能够完全按照你想要的方式进行,这对我来说并不完全清楚。

\documentclass{article}
\begin{document}

\newcounter{set}
\setcounter{set}{2}
\newcounter{problem}[set]

\newcommand{\problem}{\refstepcounter{problem}{\vspace{2\baselineskip}\noindent\large \bfseries Problem~\arabic{set}.\arabic{problem}}\\}

\problem
\textit{Sum-product algorithm:}  Consider the sum-product\ldots.

\problem
\textit{Max-marginals:} Consider the max-marginals\ldots.

\stepcounter{problem}
\problem
Demonstraction of \verb"\stepcounter"

\addtocounter{problem}{-1}
\problem
Counter increments can be negative!

\end{document}
Run Code Online (Sandbox Code Playgroud)