2

So, I am kind of new to LaTeX and I have a problem that I found no solution for in the internet (it might be just me not knowing how to describe this). I want to align the text of my theorems like this

Theorem 1. Lorem ipsum dolor sit amet, consetetur
           sadipscing elitr, sed diam nonumy eirmod
           tempor invidunt ut labore et dolore magna
           aliquyam erat, sed diam voluptua. At vero
           eos et accusam et justo duo dolores et ea
           rebum.

Instead of

Theorem 1. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor 
invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum.

This is generated by the following code

\documentclass{article}

\usepackage{lipsum}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}

\begin{document}
    \begin{theorem}
        \lipsum[1]
    \end{theorem}
\end{document}

Is this possible in any way? Personally I would perfer this kind of alignment since it clarifies what is still part of the theorem and what isn't. By the way: I am using the article document class if that somehow affects this.

  • How are you generating this theorems? Can you provide a minimal working example? – Troy Mar 18 '18 at 13:50
  • @Troy just added a short example. Didn't include anything related to encoding, because I feel like that is not really necessary – imjxsh Mar 18 '18 at 13:57
  • The theorem's label is usually in a distinctive font shape (boldface or smallcaps) and the body in italics; together with vertical space before and after the statement this makes quite clear what the statement is. Leaving large patches of white space on the left of the statement does not add to clarity. – egreg Mar 18 '18 at 15:10
1

A fast answer:

\documentclass{article}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}

\newsavebox{\mybox}

\xdef\myspbetween{0.25cm}


\newenvironment{myTheorem}[1][]
{\savebox\mybox{\hbox{Theorem \thetheorem}}%
\xdef\mdim{\the\dimexpr\wd\mybox+10pt}%
\xdef\mybdim{\the\dimexpr\textwidth-\mdim-\myspbetween}%
\noindent\begin{minipage}[t]{\mdim}%
\begin{theorem}[#1]\end{theorem}\end{minipage}\hspace{\fill}\begin{minipage}[t]{\mybdim}}
{\end{minipage}\medskip}
\begin{document}

\section{New Style}
    \begin{myTheorem}
        Here is the text that will be used and I haven't lipsum installed
    \end{myTheorem}

    \begin{myTheorem}
        Here is another text that will be used and I haven't lipsum installed
    \end{myTheorem}

    \begin{myTheorem}[Custom 3]
        Here is another text that will be used and I haven't lipsum installed
    \end{myTheorem}

\section{Old style to compare}

    \begin{theorem}
        Here is the text that will be used and I haven't lipsum installed
    \end{theorem}

    \begin{theorem}
        Here is another text that will be used and I haven't lipsum installed
    \end{theorem}

    \begin{theorem}[Custom 3]
        Here is another text that will be used and I haven't lipsum installed
    \end{theorem}
\end{document}

Output:

enter image description here

You can adjust the space by changing the : \myspbetween

PS: "comparsion" was incorrect and "Ols style" too.. fixed in the code.

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.