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?

12
  • 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}
    – user31729
    Aug 2 '15 at 22:55
  • @ChristianHupfer I've edited out the unnecessary packages. Minimal as much as possible to show the output I want. Aug 2 '15 at 22:59
  • @ChristianHupfer which is why I asked the question! Aug 2 '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 2 '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 2 '15 at 23: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

4
  • 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. Aug 2 '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 3 '15 at 0:18
  • because empty item would add a space there, right? Aug 3 '15 at 0: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 3 '15 at 0:33
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

1
  • Sorry, I liked the elimination of topsep as it keeps the original formatting I had earlier in that regard. Thanks though for your answer! Aug 3 '15 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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