share
TeX - LaTeXIndent text after line 1
[+8] [1] Thomas
[2013-02-21 22:35:16]
[ indentation theorems paragraphs ]
[ https://tex.stackexchange.com/questions/99344/indent-text-after-line-1 ]

How can I accomplish something like this:

enter image description here

Basically, I want my text to be "indented" after the first line. It would be great if somebody knew an answer. Ideally I would like to do this, because I want my theorems/proofs to look like this:

enter image description here

In my opinion, it makes the whole format much clearer.

(3) have a look at this answer tex.stackexchange.com/questions/2787/… - prettygully
(2) It seems \hangindent1em does the job perfectly. Thanks a lot prettygully. :) - Thomas
(2) The fact that something is easily doable with a word processor doesn't mean it's typographycally sound. I always teach this golden rule: if something is not easy to attain with LaTeX, then it's probably wrong. ;-) - egreg
If you are doing this sort of indent for every X (theorem, etc., etc.), it is better to use/design an environment that achieves what you want. This will make modifying the style much easier to maintain. Manual intervention each time is best suited for things like word processors (and even then there are 'styles' or something that one can use for a similar reason). - jon
[+8] [2013-02-21 23:25:27] A.Ellett

Using the enumitem package, you can fairly easily muck around with the dimensions of a list:

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\pagestyle{empty}
\begin{document}
\lipsum[1]
\begin{itemize}[label={},itemindent=-2em,leftmargin=2em]
\item \lipsum[1]
\end{itemize}

\end{document}

enter image description here

If you want to do this for every paragraph, that's a bit more involved.

It doesn't appear that amsthm, or even thm-tools, provide the means for easily creating a theorem with a hanging indent. But, theorem-like environments are built up from \trivlist. So, if you know what you want, you can define your own theorem style from a list environment. You'll probably also want to define your own counter to go with it.

To begin to get a theorem-like structure, you can do something like the following:

\newcounter{mytheoremcounter}[chapter]%% to number within chapters
\newenvironment{mytheorem}
    {\refstepcounter{mytheoremcounter}%% so ref/labels work as you expect
     \begin{list}
           {\bfseries\upshape Theorem \arabic{mytheoremcounter}.}
           {\setlength{\labelwidth=2em}
            \em%
          }
          \item 
    }
    {\end{list}}

enter image description here

Per @GonzaloMedina You can get the amsthm package to work for this purpose. You cleverly sneak the formatting through the argument of a \newtheoremstyle for the body font. As in

\documentclass{book}
\usepackage{enumitem}
\usepackage{lipsum}
\pagestyle{empty}
\usepackage{amsthm}
\newtheoremstyle{mythrm}%
    {0pt}{0pt}
    {\hangindent 2.5em}% body font
    {}
    {\bfseries}
    {.}% punctuation
    {0.5em}
    {}
\theoremstyle{mythrm}
\newtheorem{mytheorem}{Theorem}

\setlength{\parindent}{0pt}
\pagestyle{empty}
\begin{document}

\chapter{Hi}

\lipsum[2]

\begin{mytheorem}{}
\lipsum[2]
\end{mytheorem}

A second theorem
\begin{mytheorem}{}
\lipsum[3]
\end{mytheorem}

\chapter{There}


\begin{mytheorem}{}
\lipsum[2]
\end{mytheorem}

A second theorem
\begin{mytheorem}{}
\lipsum[3]
\end{mytheorem}

\end{document}

enter image description here


(1) Your affirmation about amsthm is not entirely true, as the following example shows (sorry, but the code formatting gets lost in comments): \documentclass{article} \usepackage{amsthm} \usepackage{lipsum} \newtheoremstyle{hindent} {\topsep}{\topsep} {\hangindent 2.5em}{} {\bfseries}{:} {.5em}{} \theoremstyle{hindent} \newtheorem{theo}{Theorem} \begin{document} \begin{theo} \lipsum[4] \end{theo} \end{document} - Gonzalo Medina
@GonzaloMedina very clever. Why not make that another answer? - A.Ellett
I think it would be better if you add this possibility to your answer, to make it comprehensive. What do you think? - Gonzalo Medina
1