Home » Questions » Computers [ Ask a new question ]

A more structured way to typeset assignments in LaTeX

A more structured way to typeset assignments in LaTeX

I'm typing up some assignments with the basic structure

Asked by: Guest | Views: 288
Total answers/comments: 2
Guest [Entry]

"I found this example. It's not exactly what you want, but if you look up using counters and the newcommand and renewcommand definitions, you should be able to do exactly what you want, which wasn't totally clear to me.

\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}"
Guest [Entry]

"I would suggest using enumerate to organize problems and use sections to group them. For example:

\begin{enumerate}
\item
The ``enumerate'' environment numbers the list elements, like this.

Items in a list can contain multiple paragraphs.
These paragraphs are appropriately spaced and indented according to their
position in the list.
\begin{itemize}
\item The ``itemize'' environment sets off list items with ``bullets'',
like this. Finally, the ``description'' environment lets you put your own
\begin{description}
\item[A] label on each item, like this ``A''.
\item[If the label is long,] the first line of the item text will
be spaced over to the right as needed.
\end{description}
\end{enumerate}

Taken from pangea.stanford.edu LaTeX by Example

Doing this gives you way more flexibility structuring the details of your individual assignments - for example you can enumerate as deeply as you need, but can only take sections to 3 levels."