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.

I would like to place an unindented \fbox inside an enumerate environment.

\begin{enumerate}
    \item Some text.
    \par\fbox{a}
    \item Some more text.
\end{enumerate}

The above code produces:

1. Some text.
   a
2. Some more text.

Is there a way to get the following?

1. Some text.
a
2. Some more text.

Of course I could fiddle around with \hspace{somenegativelength}. However, is there nothing like \reallynoindent?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You could interrupt and resume your enumerate with the enumitem package, so that the \fbox{a} becomes part of the main body again.

\documentclass{article}
\usepackage{enumitem}


\begin{document}
\noindent{}Text before.
\begin{enumerate}
  \item Some text.
\end{enumerate}
\fbox{a}
\begin{enumerate}[resume]
  \item Some more text
\end{enumerate}
Text after.
\end{document}
share|improve this answer
add comment

Making it an item on its own is a way to go:

\begin{enumerate}
    \item Some text.
    \item[\fbox{a}]
    \item Some more text.
\end{enumerate} 

To answer your question about \reallynoindent: Process of making a list "indented" is not the same as making a paragraph indented. If you put \the\parindent inside default enumerate, you'll get 0pt. The point here is that the whole left margin is increased by the amount of "indent". You can check that this is true by putting \the\leftmargin in the list, which in my case output soomething like 27.3747pt. If you want to "reallynoindent", you can do the following:

\begin{enumerate}
\item Some text.

{\setlength{\parindent}{-\leftmargin}\fbox{a}} Foo bar

\item Some more text.
\end{enumerate}
share|improve this answer
    
+1 for the explanation of how margins work inside enumerate. A limitation of your solution is that it only works if \box{a} is quite short. The custom label expands to the left. –  severin Feb 15 '13 at 9:00
add comment

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.