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 create a theorem style which indents the theorem exactly like a \hangindent would do, expect that the indention should continue for all paragraphs of the theorem.

For example:

Theorem 1.2.3: Lipsum Lorem ipsum dolor sit amet,
    consectetuer adipiscing elit.  Ut purus elit, 
    vestibulum ut, placerat ac, adipiscing vitae, felis.

    Curabitur dictum gravida mauris. Nam arcu libero, 
    nonummy eget, consectetuer id, vulputate ...

I tried this, but it does not work correctly:

\documentclass[parskip=half]{scrartcl}
\usepackage{amsthm,thmtools}
\usepackage{lipsum}
\usepackage{showframe}

\let\thm\relax
\declaretheoremstyle[
    headfont=\bfseries,
    bodyfont=\normalfont\leftskip2.5em,
    headindent={-2.5em}
]{INDENTthm}
\declaretheorem[
    within=section,
    style=INDENTthm,
    name=Theorem
]{thm}

\begin{document}
\begin{thm}
    \lipsum[1]

    \lipsum[2]
\end{thm}
\end{document}

What happens is that the theorem header suddenly has a negative indention relative to the page, i.e. starts just a little to the left of the actual page, although I would expect "2.5em-2.5em=0em"... :-)

share|improve this question
    
Welcome to TeX.sx! –  texenthusiast Apr 2 '13 at 17:09
    
is there anything helpful in the question Indent text after line 1? –  barbara beeton Apr 2 '13 at 17:33
    
The solution given there for amsthm/thmtools actually uses \hangintent to create the indention, which is reset after the first paragraph of the theorem (as \hangindent only lasts for one paragraph). This is what I wanted to work around... –  Endzone Apr 5 '13 at 8:09
add comment

2 Answers

up vote 4 down vote accepted

I'm not a fan of this kind of indentation. However no solution using \leftskip is good, since theorems are implemented as lists; try adding an enumerate environment to your theorem and see.

Your problem is that you use two different ems: the medium series one and the boldface one, which are different. So the two facts require a different solution.

\documentclass[a4paper]{scrartcl}
\usepackage{amsthm,thmtools}
\usepackage{lipsum}
\usepackage{showframe}

\declaretheoremstyle[
  headfont=\kern-2.5em\bfseries,
  bodyfont=\normalfont,
  headindent=0pt,
]{INDENTthm}
\declaretheorem[
  within=section,
  style=INDENTthm,
  name=Theorem
]{thm}

\usepackage{etoolbox}
\makeatletter
\AtBeginEnvironment{thm}{%
  \patchcmd\@thm
    {\trivlist}
    {\list{}{\leftmargin2.5em\itemindent-15em}}
    {}{}%
  \patchcmd\thmt@original@endthm{\endtrivlist}{\endlist}{}{}%
}
\makeatother

\begin{document}
\begin{thm}
\lipsum*[2]
\begin{enumerate}
\item a
\item b
\end{enumerate}
\end{thm}
\end{document}

This does the patch only for the thm environment. As Zhen Lin correctly remarks in a comment, the

  \patchcmd\thmt@original@endthm{\endtrivlist}{\endlist}{}{}%

line for a theorem named lemma should become

  \patchcmd\thmt@original@endlemma{\endtrivlist}{\endlist}{}{}%

enter image description here

share|improve this answer
    
Thanks, this looks like a good solution. What is the "\itemindent-15em" actually needed for? –  Endzone Apr 5 '13 at 8:03
1  
It's perhaps worth mentioning that the last three characters in \thmt@original@endthm should also be replaced with the environment name, to prevent problems with “too much nesting”... –  Zhen Lin Apr 13 '13 at 11:26
add comment

I've hardwired the indents, but you should be able to change them to an argument, and restore them to their original

\documentclass{article}
\parindent 0in
\parskip 1em
\let\svpar\par
\newenvironment{hang}{\hangindent 0.7in\def\par{\svpar\hangindent
0.7in\parindent 0.7in}}
{\let\par\svpar\parindent 0in}
\begin{document}

non-indented text

\begin{hang}
erew ewr ewr ew rwe fsgfkgwerlktmn gghlkrgtkj rgngmn
krwghj,gn ghrgtkrkltgrkgfremgrtgklrwtklrgfd,m srjhgksg 

continuing test to new paragraph

finally ending test now
\end{hang}

non-indent

\end{document}

enter image description here

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.