5

I am getting this very strange error in Latex using enumerate. My code is as follows:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[margin=.75 in]{geometry}
\usepackage{enumerate}

\begin{document}
\fbox{
\parbox{6.66 in}{
{\bf MATH 342 \hfill Name}

\emph{Problem Set \# 9 \hfill 25 January 2013}}}
\vspace{.1 in}

\begin {enumerate}[{\bf \ \ \ \ Page 71:}]
    \item \ \\
     \begin{enumerate}
        \item[37.]
        \begin{enumerate}
            \item[d.] 
        \end{enumerate}
        \item[80.]
    \end{enumerate}
\end{enumerate}


\begin {enumerate}[{\bf \ \ \ \ Page 118:}]
    \item \ \\
     \begin{enumerate}
        \item[26.]
        \item[27.]
        \item[65.] 
    \end{enumerate}
\end{enumerate}


\begin {enumerate}[{\bf \ \ \ \ Page 138:}]
    \item \ \\
     \begin{enumerate}
        \item[3.]
        \item[10.]
        \item[42.]
    \end{enumerate}
\end{enumerate}


\end{document}

This outputs everything as expected except "Page 118" is "P1ge 118" and "Page 138" is "P1ge 138"

I am using TeXworks with MikTex if this makes any difference.

Anybody know whats going on/how to fix it?

Thanks

migrated from stackoverflow.com Jan 24 '13 at 15:35

This question came from our site for professional and enthusiast programmers.

5

I suggest to use the enumitem package. This way you don't have to "eye compute" spacings:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[margin=.75in]{geometry}
\usepackage{calc}
\usepackage{enumitem}

%%% \referpage is used for the label; in order to get a good alignment,
%%% the page number sticks out to the right
\DeclareRobustCommand{\referpage}[1]{\textbf{Page \makebox[0pt][l]{#1:}}}

\begin{document}
\noindent\fbox{% The heading box is computed more accurately
\parbox{\textwidth-2\fboxsep-2\fboxrule}{
  {\bfseries MATH 342 \hfill Name}

  \emph{Problem Set \# 9 \hfill 25 January 2013}}%
}

\vspace{.1 in}

\begin{enumerate}[leftmargin=*,label=\referpage{71}]
    \item \mbox{}
    \begin{enumerate}
        \item[37.]
        \begin{enumerate}
            \item[d.] 
        \end{enumerate}
        \item[80.]
    \end{enumerate}
\end{enumerate}

\begin{enumerate}[leftmargin=*,label=\referpage{118}]
    \item \mbox{}
    \begin{enumerate}
        \item[26.]
        \item[27.]
        \item[65.] 
    \end{enumerate}
\end{enumerate}

\begin{enumerate}[leftmargin=*,label=\referpage{138}]
    \item \mbox{}
    \begin{enumerate}
        \item[3.]
        \item[10.]
        \item[42.]
    \end{enumerate}
\end{enumerate}


\end{document}

enter image description here

8

From the documentation of enumerate:

An occurence of one of the tokens A a I i or 1 produces the value of the counter printed with (respectively) \Alph \alph \Roman \roman or \arabic. These letters may be surrounded by any strings involving any other TEX expressions, however the tokens A a I i 1 must be inside a { } group if they are not to be taken as special.

So surrounding the a with {} should fix your issue:

\begin {enumerate}[{\bf \ \ \ \ {Page} 71:}]
  • Thank you. This does fix the issue. The only reason I am putting egreg's answer as the solution is because in addition to providing a solution they also corrected other errors I was having. – user2006233 Jan 24 '13 at 18:41

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.