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 am currently putting a \noindent before the first paragraph of each theorem, proof, etc. in my memoir document. Is there any way to have memoir do this automatically?

For example, is there any way to make this MWE more concise?

\documentclass{memoir}

\usepackage{amsthm}
\newtheorem{thm}{Theorem}[chapter]

\begin{document}

\noindent This is my introduction.

This is the next paragraph of the introduction, which should be indented.

\begin{thm} (Theorem Name)

\noindent This is my theorem.
Note that I do want the ``(Theorem Name)'' to appear on the same line as where it says \textbf{Theorem 0.1}.

This is the next paragraph of the theorem, which should be indented.

\end{thm}

\noindent Here is a note about the theorem.

\begin{proof}

\noindent This proof has no name.

This is the next paragraph of the proof, which should be indented.

\end{proof}

\noindent This is my conclusion.

The end.

\end{document}
share|improve this question
2  
I see neither sections nor any other heading level in your example. –  Thorsten Donig Jan 29 '12 at 18:29
    
I think I mean "environment" rather than "section"; I'll edit the question title accordingly, thanks! –  jamaicanworm Jan 29 '12 at 18:30
1  
Does removing the empty lines get rid of the problem? –  Seamus Jan 29 '12 at 19:09
    
No, because then the words "This is my theorem" appear on the same line as the "(Theorem Name)". –  jamaicanworm Jan 29 '12 at 19:16
add comment

2 Answers 2

up vote 2 down vote accepted

To typeset the name of a certain theorem, use the optional argument of the theorem's environment, e.g., \begin{thm}[Theorem Name]. In my example, I use the thmtools package to conveniently define a new style.

To suppress indentation in the first paragraph after a theorem, one may patch the commands \@endtheorem and \endproof (using the etoolbox package) and then use % (the comment sign) in the text body. (EDIT: For details about amsthms implementation of theorems, see my answer to How to prevent paragraph breaks after theorem environments?)

The \noindent in your example's first paragraph would be superfluous if it was preceded by a sectioning command like \chapter or \section.

\documentclass{memoir}

\usepackage{amsthm}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@endtheorem}{\@endpefalse}{}{}{}
\patchcmd{\endproof}{\@endpefalse}{}{}{}
\makeatother

\usepackage{thmtools}
\declaretheoremstyle[within=chapter,spaceabove=\topsep,notefont=\normalfont\itshape,
    bodyfont=\itshape,postheadspace=\newline]{mystyle}
\declaretheorem[style=mystyle,name=Theorem]{thm}

\begin{document}

\noindent This is my introduction.

This is the next paragraph of the introduction, which should be indented.

\begin{thm}[Theorem Name]
This is my theorem. Note that I do want the ``(Theorem Name)'' to appear on the same
    line as where it says \textbf{Theorem 0.1}.

This is the next paragraph of the theorem, which should be indented.
\end{thm}
% <-- Supresses indentation of following paragraph
Here is a note about the theorem.

\begin{proof}
This proof has no name.

This is the next paragraph of the proof, which should be indented.
\end{proof}
% <-- Supresses indentation of following paragraph
This is my conclusion.

The end.

\end{document}

enter image description here

share|improve this answer
add comment

You have to define a theorem style for that:

\usepackage{amsthm}
\newtheoremstyle{break}% name
  {9pt}%      Space above, empty = `usual value'
  {9pt}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {\newline}% Space after thm head: \newline = linebreak
  {}%         Thm head spec
\theoremstyle{break}
\newtheorem{thm}{Theorem}[chapter]

Then the input

\begin{thm}[Theorem Name]
This is my theorem.
Note that I do want the ``(Theorem Name)'' to appear on the
same line as where it says \textbf{Theorem 0.1}.

This is the next paragraph of the theorem, which should be indented.
\end{thm}

will do what you're looking for.

To get "Proof" on a line by itself you can patch the proof environment

\usepackage{xpatch}
\xpatchcmd{\proof}{\ignorespaces}{\mbox{}\\\ignorespaces}{}{}

If you've not the xpatch package, then the more convolute

\usepackage{etoolbox}
\expandafter\patchcmd\csname\string\proof\endcsname
  {\ignorespaces}{\mbox{}\\\ignorespaces}{}{}

is needed.

For the text after a theorem or a proof you need a \noindent, but I think it's bad style; it's also bad style to leave "Proof" on a line by itself.

share|improve this answer
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.