Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

So I am creating documents that have a mixture of paragraphs of text intermingled with numbered questions. I have been creating these using the 'exam' class.

However, I decided to set the default spacing between my paragraphs and notice that in the exam class I have no paragraphs once I begin the 'question' environment.

This being said I plan on spending a decent amount of time on many documents and I am a little worried that I will regret using the 'exam' class.

What factors do people bring into their decision to choose a particular class for a particular document? How do you keep the greatest amount of flexibility if you decide to modify your documents in the future? (I know that is a very broad question).

share|improve this question

2 Answers 2

up vote 4 down vote accepted

It really sounds like the exam class is not only overkill for what you want, but it's also forcing your formatting to look like something you don't want. If all you want is to be able to list questions, possibly with parts, then all you need is to set up the code to create those environments. Here's a complete latex file that shows how to do that:

\documentclass{article}

%--------------------------------------------------------------------
\newcounter{question}
\setcounter{question}{0}
\newenvironment{questions}{%
  \list{\thequestion.}%
  {%
    % We don't say \usecounter because we don't want the counter
    % to be reset at the start of the environment:
    \def\question{\refstepcounter{question}\item}%
    \settowidth{\leftmargin}{10.\hskip\labelsep}%
    \labelwidth\leftmargin\advance\labelwidth-\labelsep
  }%
}
{%
  \endlist
}%

\newcounter{partno}
\renewcommand\thepartno{\alph{partno}}
\newenvironment{parts}{%
  \list{(\thepartno)}%
  {%
    \def\part{\item}%
    \usecounter{partno}%
    \settowidth{\leftmargin}{(m)\hskip\labelsep}%
    \labelwidth\leftmargin\advance\labelwidth-\labelsep
  }%
}%
{%
  \endlist
}



%--------------------------------------------------------------------
\begin{document}

Here's some text. Here's some text. Here's some text. Here's some
text. Here's some text. Here's some text. Here's some text. Here's
some text. Here's some text. Here's some text. Here's some
text. Here's some text. Here's some text. Here's some text.

\begin{questions}
  \question \label{first} Why is there air?
  \question \label{second} What if there were no air?
  \begin{parts}
    \part \label{balloon} Describe the effect on the balloon industry.
    \part \label{aircraft} Describe the effect on the aircraft industry.
  \end{parts}
\end{questions}
That was question~\ref{first} and question~\ref{second}.
Question~\ref{second} had parts \ref{balloon} and \ref{aircraft}.

Here's some text. Here's some text. Here's some text. Here's some
text. Here's some text. Here's some text. Here's some text. Here's
some text. Here's some text. Here's some text. Here's some
text. Here's some text. Here's some text. Here's some text.

\begin{questions}
  \question \label{grant} Who's buried in Grant's tomb?
  \question \label{another} What was the color of George Washington's
  white horse?
  \question \label{yetanother} What was the color of the bus driver's
  eyes?
\end{questions}
That was questions~\ref{grant} through \ref{yetanother}.

\end{document}

You'll notice that this questions environment doesn't reset the question counter every time you enter. That is, after you've listed some questions, you should end the questions environment. When you later want to list more questions, the next questions environment you create will continue the question numbering from the point where the last one stopped. That way the formatting of the list of questions won't interfere with the formatting of the material in in between the various collections of questions. If you want the next questions environment to begin with question number 1 again, you should insert \setcounter{question}{0} before the \begin{questions}.

share|improve this answer
    
Phil, this is quite helpful. I definitely needed to get the text out of the 'question' environment so I can manipulate its margines, etc. This does involve a lot of \begin and \end for the 'questions' environment. Maybe there is no way around that though. –  Michael Mar 21 '11 at 0:45

This is a bit of a non-answer, but the underlying point may be useful.

As far as I am able, I don't choose a class to use. The majority of my documents are articles intended for publication in a journal. When I start writing the article, I don't usually have a particular journal in mind. But when I submit the article, I often find that the journal I do choose wants the article to use its "House Style", usually in the form of a class file. So if my article depends very much on a particular class, then I would have considerable hassle reformatting it to fit the new class.

In fact, I've gotten so fed up of this process that I've written a "wrapper" class which makes it easy to swap in and out the various journal classes whilst leaving my document unchanged.

So my advice is: do your best not to rely on any functionality provided by a class if there is any chance that you will want to change class at a later stage. If you find yourself needing some particular functionality that is provided by a certain class, then of course use that class. But then needing that functionality is sufficient reason to make a choice (and stick by it), and sufficient reason not to change your mind later on. In other words, making a choice for a positive reason is fine, but making a choice just because you feel that you ought to is not.

(In my ideal universe, classes would not provide any functionality - that would be provided by packages. Classes would be much more like CSS stylefiles and would just change how things looked. While I'm dreaming, I'd like a pony too.)

share|improve this answer
    
The only other thing I would add to this is if you are writing a book, then you should almost always use a class designed for such documents: memoir, scrbook rather than the standard book class. (And of course if you creating slide presentations then a class like beamer or powerdot is required.) –  Alan Munn Mar 18 '11 at 22:39
1  
The LaTeX3 plan is more or less what you outline in the last paragraph: classes for appearance, packages for code, and a lot more 'base' variability. We are working on it, honest. –  Joseph Wright Mar 18 '11 at 22:40
    
Andrew, thank you very much for your reply. It sounds like using the least specialized class you can get away with is the way to go. I am new to the LaTeX world and your insight is quite helpful –  Michael Mar 19 '11 at 1:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.