1

I have the following code, which runs and formats nicely.

\documentclass[a4paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{classicthesis}
\usepackage[english]{babel}
\usepackage{mathtools}
\usepackage{enumitem}

\begin{document}

\section*{Examples}
For each function $f$ given,
\begin{enumerate}
\begin{enumerate}
\item Sketch the graph of $f.$
\item Write the open intervals for which $f$ is continuous.
\item Write the open intervals for which $f$ is increasing.
\item Write the open intervals for which $f$ is decreasing.
\item Write the open intervals for which $f$ is concave up.
\item Write the open intervals for which $f$ is concave down.
\end{enumerate}

\item $f(x)=x^3-x^2-x+1.$
\item $f(x)=\dfrac{x^2-2x+2}{x-1}.$
\item $f(x)=x\sqrt{3-x}.$
\item $f(x)=\dfrac{x^3}{36}\sqrt{7-x}.$
\end{enumerate}

\end{document}

But it gives a missing \item error. The result,

output

How should I edit the code to avoid the error, yet keep the same format and output?

  • 2
    I tried to compile your document. It's by far not minimal and it stops due to some issue with xy package. Now, commenting that out, the remaining issue is, that enumerate expects an \item, not another \begin{enumerate} –  Aug 02 '15 at 22:55
  • @ChristianHupfer I've edited out the unnecessary packages. Minimal as much as possible to show the output I want. – John Molokach Aug 02 '15 at 22:59
  • @ChristianHupfer which is why I asked the question! – John Molokach Aug 02 '15 at 23:00
  • Well, lmodern is certainly unnecessary as it will have no effect at all on your document. mathtools loads amsmath anyway. Better xcolor than color. Also, it would be better to use scrbook with classicthesis. It would also be better not to use classicthesis, but that's a different issue. Finally, tabu cannot be recommended if you hope your document will remain compilable in the future as the author has promised backwards incompatible changes. Once that happens, documents which use it will break. – cfr Aug 02 '15 at 23:02
  • And how is appendix necessary here? Or hyperref? You don't really need anything except the document class and enumitem, do you? – cfr Aug 02 '15 at 23:04
  • @cfr you are right. I got in a hurry when editing. – John Molokach Aug 02 '15 at 23:06
  • for those interested, http://tex.stackexchange.com/questions/147194/is-it-still-useful-to-load-the-lmodern-package – John Molokach Aug 02 '15 at 23:11
  • @JohnMolokach That link suggests that you have misunderstood me. 99% of my documents use Latin Modern (though I unsurprisingly use cfr-lm rather than lmodern). But loading lmodern *has no effect on your document*. Use the properties listing in your PDF viewer or run pdffonts <filename>.pdf to see what fonts you are actually getting. There is no Latin Modern there. I ran your example just to make sure before I commented earlier and not one Latin Modern font is used. – cfr Aug 02 '15 at 23:39
  • @cfr I did not mean the link to be a rebuttal. Just thought I'd share for those wondering why lmodern was used. You are right it was not needed for this example. – John Molokach Aug 02 '15 at 23:46
  • @JohnMolokach It will have no effect on your thesis, either. The fonts you are getting are specified in classicthesis. Loading lmodern beforehand makes no difference. lmodern overwrites the defaults. Then classicthesis overwrites them all over again. It won't do any harm - it is just pointless and misleading if it makes you think you are getting LM. (You are getting a mixture of Computer Modern and various postscript fonts in the above MWE.) – cfr Aug 02 '15 at 23:51
  • @cfr Yes, I've deleted \lmodern from the preamble and after recompiling I see no difference. It was in the book template I got from share latex. – John Molokach Aug 02 '15 at 23:56
  • @JohnMolokach Never trust templates ;). We... er... when somebody says they are using a template, you know that there's trouble brewing. I've not seen one question involving a template where the template wasn't at least half of the problem. classicthesis itself is usually about 95% of the problem in questions which use it. This question is rather unusual in that classicthesis itself is not actually involved in the issue. – cfr Aug 03 '15 at 00:00

2 Answers2

2

here is a solution

\documentclass[a4paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{classicthesis}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{url}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{tabu}
\usepackage{amsthm}
\usepackage{fourier-orns}
\usepackage{framed}
\usepackage{tcolorbox}
\usepackage[toc,page]{appendix}
\usepackage[all]{xy}

\begin{document}

\section*{Examples}
For each function $f$ given,
\begin{enumerate}[label=\alph*),leftmargin=2\leftmargini]
\item Sketch the graph of $f.$
\item Write the open intervals for which $f$ is continuous.
\item Write the open intervals for which $f$ is increasing.
\item Write the open intervals for which $f$ is decreasing.
\item Write the open intervals for which $f$ is concave up.
\item Write the open intervals for which $f$ is concave down.
\end{enumerate}

\begin{enumerate}
\item $f(x)=x^3-x^2-x+1.$
\item $f(x)=\dfrac{x^2-2x+2}{x-1}.$
\item $f(x)=x\sqrt{3-x}.$
\item $f(x)=\dfrac{x^3}{36}\sqrt{7-x}.$
\end{enumerate}

\end{document}

enter image description here

touhami
  • 19,520
  • Sorry, I liked the elimination of topsep as it keeps the original formatting I had earlier in that regard. Thanks though for your answer! – John Molokach Aug 03 '15 at 01:04
2

You can do what you want with a simple empty \item:

\documentclass[a4paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{classicthesis}
\usepackage[english]{babel}
\usepackage{mathtools}
\usepackage{enumitem}

\begin{document}

\section*{Examples}
For each function $f$ given,
\begin{enumerate}
  \item[]%
        \begin{enumerate}[before = \vspace*{-\topsep}]
          \item Sketch the graph of $f.$
          \item Write the open intervals for which $f$ is continuous.
          \item Write the open intervals for which $f$ is increasing.
          \item Write the open intervals for which $f$ is decreasing.
          \item Write the open intervals for which $f$ is concave up.
          \item Write the open intervals for which $f$ is concave down.
        \end{enumerate}

  \item $f(x)=x^3-x^2-x+1.$
  \item $f(x)=\dfrac{x^2-2x+2}{x-1}.$
  \item $f(x)=x\sqrt{3-x}.$
  \item $f(x)=\dfrac{x^3}{36}\sqrt{7-x}.$
\end{enumerate}

\end{document} 

enter image description here

Bernard
  • 271,350
  • nice, and carries even closer to my vertical spacing from before - but i wouldn't have known how to deal with the \vspace command you used. – John Molokach Aug 02 '15 at 23:38
  • All lists add a \topsep vertical spacing at the beginning at at the end. I simply neutralised it at the top. – Bernard Aug 03 '15 at 00:18
  • because empty item would add a space there, right? – John Molokach Aug 03 '15 at 00:29
  • No it doen'st, if there is nothing after (that's the reason of the %: prevent any unwanted space). It's the nested enumerate that adds \topsep – as far as I understand it. – Bernard Aug 03 '15 at 00:33