3

In the example below I want the enumerate list to essentially be ``inline'' with the word Example from the example environment. It works perfectly with text or enumerate* (inline list), but I cannot seam to figure out how to control some the remainder of the spacing created by the enumerate environment.

\documentclass{article}
  \usepackage{amsthm}
  \usepackage{enumitem}
  \usepackage{hyperref}
    \theoremstyle{define}
      \newtheorem{example}{Example}
\begin{document}
\begin{example}
  \fbox{\parbox[t]{9cm}{
    \begin{enumerate}[label=(\arabic*),nosep]
      \item The duplicate ratio of $2a:3b$ is $4a^2:9b^2$.
      \item The subduplicate ratio of $49:25$ is $7:5$.
      \item The triplicate ratio of $2x:1$ is $8x^3:1$.
    \end{enumerate}
  }}
\end{example}
\begin{example}
  \fbox{Can you see the difference?}
\end{example}
\end{document}
1

Answer to original posting

Have you tried using minipage instead of \parbox?

\begin{example}
  \fbox{%
    \begin{minipage}[t]{9cm}%
    \begin{enumerate}[label=(\arabic*),nosep]
      \item The duplicate ratio of $2a:3b$ is $4a^2:9b^2$.
      \item The subduplicate ratio of $49:25$ is $7:5$.
      \item The triplicate ratio of $2x:1$ is $8x^3:1$.
    \end{enumerate}
    \end{minipage}}
\end{example}

Look at this answer to \parbox vs. minipage: Differences in applicability to see an explanation of the differences between \parbox and minipage. In particular, note the third difference listed in the answer.

Issue with hyperref

A MWE for hyperref is realized as:

\documentclass{article}
\usepackage{hyperref}
\begin{document}

\noindent
  Hello
  \fbox{%
    \begin{minipage}[t]{9cm}
      \begin{enumerate}
        \item The duplicate ratio of $2a:3b$ is $4a^2:9b^2$.
        \item The subduplicate ratio of $49:25$ is $7:5$.
        \item The triplicate ratio of $2x:1$ is $8x^3:1$.
      \end{enumerate}
    \end{minipage}}

\end{document}

Something seems to be happening with how hyperref is manipulating \item within an enumerate environment. If you use itemize or create your own list environment, the spacing issue vanishes. It also vanishes if you use \item[] as the first item in an enumerate environment (though I'm sure this is not what you want to do).

  • This is great! If I add \usepackage{hyperref} to the preamble it breaks it though. What is going on here? – Ra is dead Jun 13 '13 at 2:27
  • @Raisdead There seems to be a deeper issue going on here. I've posted a new question about how hyperref is interacting with enumerated lists: see here – A.Ellett Jun 13 '13 at 5: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.