# Indent the new line in a theorem environment

I have been looking after a solution to this for a while and have found none. I'm trying to create a Theorem environment, through amsthm, such that there will be a linebreak (just like the break theorem model) but with the first line indented. I tried playing around with redefining environments and and stuff, but it didn't help so far. My current code is:

\documentclass{memoir}
\usepackage{amsthm}
\usepackage{lipsum}
\usepackage{amssymb}
\newtheoremstyle{teo}%〈name〉
{3pt}%〈Space above〉
{3pt}%〈Space below〉
{}%〈Body font〉
{}%〈Indent amount〉
{\thmname{#1}\thmnumber{ #2}{\mdseries\thmnote{ [#3]}}}%〈Theorem head spec(can be left empty, meaning ‘normal’)〉
\theoremstyle{teo}
\newtheorem{thmx}{Theorem}
\newenvironment{thm}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\square$}\thmx}
{\popQED\endthmx}
\usepackage{indentfirst}
\begin{document}
\begin{thm}[Bézout's Theorem]
\lipsum[1]
\end{thm}
\end{document}


I'm aiming at an automatized way of achieving a result similar to this:

\documentclass{memoir}
\usepackage{amsthm}
\usepackage{lipsum}
\usepackage{amssymb}
\newtheoremstyle{teo}%〈name〉
{3pt}%〈Space above〉
{3pt}%〈Space below〉
{}%〈Body font〉
{}%〈Indent amount〉
{\thmname{#1}\thmnumber{ #2}{\mdseries\thmnote{ [#3]}}}%〈Theorem head spec(can be left empty, meaning ‘normal’)〉
\theoremstyle{teo}
\newtheorem{thmx}{Theorem}
\newenvironment{thm}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\square$}\thmx}
{\popQED\endthmx}
\usepackage{indentfirst}
\begin{document}
\begin{thm}[Bézout's Theorem]
\null \hspace{1em} \lipsum[1]
\end{thm}
\end{document}


That is to say, with an arbitrary spacement when I type the so said theorem.

I apologize for any bad styles in this question, for I am new to this SE.

• Welcome to TeX.SE! It is very helpful that you posted example code. However, the code did not compile, because \square was not defined (requires \usepackage{amssymb} and there are two occurrences of \begin{document} in the first example. Furthermore, the second example does not show your desired behavior (it does not do the indentation). For future questions, please make sure the code example runs without errors - except when you are asking about an error of course. Other than that, good first question! – Marijn Aug 25 '18 at 15:01
• Thank you for the tips! Does the site compiles the code on its on or is it necessary to use some special commands ou so? – Nickolas Alves Aug 25 '18 at 19:37
• The site doesn't compile the code at all - many people would like that but there are some arguments against it (see for example tex.meta.stackexchange.com/questions/6883/… and the links there in the comments). So, the idea is that you write your example code (called MWE, i.e., Minimal Working Example) and run it on your own computer (or on Overleaf etc.) to make sure the example is ok. For questions, but especially for answers, you can make a screenshot of the result and upload it with the image icon in the post box. – Marijn Aug 26 '18 at 7:51

We can patch \newtheoremstyle to accept \newline<other tokens>:

\documentclass{memoir}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{etoolbox}
\usepackage{lipsum}

\makeatletter
\patchcmd{\newtheoremstyle}
{\def\@tempb{\newline}}
{\def\@tempb{\newline}\edef\@tempa{\unexpanded\expandafter{\@car#8\@nil}}}
{}{}
\patchcmd{\newtheoremstyle}
{}{}
\makeatother

\newtheoremstyle{teo}%〈name〉
{3pt}%〈Space above〉
{3pt}%〈Space below〉
{}%〈Body font〉
{}%〈Indent amount〉
%〈Theorem head spec follows (can be left empty, meaning ‘normal’)〉
{\thmname{#1}\thmnumber{ #2}{\mdseries\thmnote{ [#3]}}}
\makeatletter
\makeatother

\theoremstyle{teo}

\newtheorem{thmx}{Theorem}
\newenvironment{thm}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\square$}\thmx}
{\popQED\endthmx}

\begin{document}

\begin{thm}[Bézout's Theorem]
\lipsum[1]\lipsum*[2]
\end{thm}

\end{document}


It doesn't seem a good idea, though.

The third parameter of \newtheoremstyle (body font) can be used to change indentation settings. In this case (see also https://tex.stackexchange.com/a/67308) you can use \parshape, which defines the indentation and line length for a specified number of lines (see TeX by Topic, Section 18.2.2). After the lengths have been applied for the specified lines, the remainder of the paragraph will be formatted according to the lengths of the last specified line.

For a theorem, the first line is the theorem title, and the second and third lines are the first and second line of the contents, respectively. In the example below the indents are set to 0pt, \parindent (which is 15pt in this case) and 0pt. The line length is set to \textwidth, which for the second line is decreased by the indent value using \dimexpr, otherwise the line would continue into the right margin. If you want to change the amount of indentation, you should replace \parindent by some other value (e.g., 10mm) for both occurrences.

MWE:

\documentclass{memoir}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{lipsum}
\newtheoremstyle{teo}% name
{3pt}% Space above
{3pt}% Space below
{\parshape 3 0pt \textwidth \parindent \dimexpr\textwidth-\parindent 0pt \textwidth}% Body font
{}% Indent amount
{\thmname{#1}\thmnumber{ #2}{\mdseries\thmnote{ [#3]}}}% Theorem head spec(can be left empty, meaning ‘normal’)
\theoremstyle{teo}
\newtheorem{thmx}{Theorem}
\newenvironment{thm}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\square$}\thmx}
{\popQED\endthmx}

\begin{document}
\begin{thm}[B\'{e}zout's Theorem]
\lipsum[1]
\end{thm}
\end{document}


Result:

• Note that this doesn't quite work as one might like for theorms that contain multiple paragraphs, since the second line of any subsequent paragraph will be indented as well. – Circumscribe Aug 26 '18 at 11:11
• @Circumscribe indeed, I did not consider that. A workaround would be to manually add \parshape 1 0pt \textwidth in front of the second paragraph (which will be used for any subsequent paragraph as well). – Marijn Aug 26 '18 at 11:23