5

I use amsmath to provide the proof environment. However, if a itemize (or tikzpicture) environment immediately follows the proof environment, xelatex will produce a messy result:

\begin{proof}
\begin{itemize}
\item 1
\item 2
\end{itemize}
\end{proof}

Will produce something like this:

Proof. * 1

  • 2

So I have to manually add a \mbox after the proof env. Is it possible to make proof automatically add a newline in these situations?

  • 4
    In my opinion it's better not to format a proof as an itemized or enumerated list. Just add at the beginning of the paragraph a marker (for instance the number of the substatement, or a symbol such as ($\Rightarrow$)). Having a long (or even short) proof with a shifted margin makes for bad pages. – egreg Apr 28 '13 at 10:14
  • Related: tex.stackexchange.com/questions/36851/… and tex.stackexchange.com/questions/85059/… (so that this helps someone searching!) – kan Apr 28 '13 at 10:22
  • These two questions asked for a newline without any condition. I want to have a 'smart' proof: only add a new line when the first 'thing' inside the proof is itemize, enumerate, description, tikzpicture, or something like these environments. Seems I did not make it clear in the first place. Sorry about that. – capsensitive Apr 29 '13 at 7:04
  • @egreg That is a good advice. But sometimes I need to start proof with a tikzpicture, and without \mbox{}, the tikzpicture will float at the top of the proof environment: – capsensitive Apr 29 '13 at 7:07
3

You can redefine the proof environment and add a \mbox:

\documentclass[a5paper]{article}
\usepackage{amsmath,amsthm}
\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \itshape
    #1\@addpunct{.}]\mbox{}\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother
\begin{document}
\begin{proof}
\begin{itemize}
\item 1
\item 2
\end{itemize}
\end{proof}
\end{document}
  • But this code seems always add a \mbox{}. Is it possible to add \mbox{} only when it is needed (such as itemize immediately after proof? – capsensitive Apr 29 '13 at 7:01
  • @capsensitive: Indeeed. But in a normal case (without a par or empty line) it should work. – Marco Daniel Apr 29 '13 at 8:03
  • I see. That really is the perfect solution for me. Thanks. – capsensitive Apr 29 '13 at 8:19
  • It's not a good suggestion to manually redefine an enviornment which is often the result of complicated package work... – einpoklum Jun 14 '17 at 18:34

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.