4

enter image description here I want to set "Theorem" on the left of the content and its "Numbering"(1.4.6 in the image) under it in stead of default putting these things within the content, so that readers could recognise the "Theorem" and "numbering" more easily.

Does anybody know how to achieve this? just like the image uploaded.

Please show me the Tex code about this. Thank you very much!

  • Are you currently using any theorem-related packages? – Werner Jul 28 '16 at 16:01
  • Thanks for asking, yes, I'm using {amsmath},{amsthm},{thmtools} these 3 theorem-related packages. For the best of solving the problem, I am happy to learn and use another theorem-related package. @Werner – Forfaiting Jul 28 '16 at 16:13
  • Do you mean right or left? (Your question asks for right, your picture shows left.) – Willie Wong Jul 28 '16 at 18:52
  • Also, if your Theorem has a name (say you want it to show "Theorem 1.2.1 [Hahn-Banach]"), where should the name go? As a starting point you can try to modify the answer given http://tex.stackexchange.com/questions/59244/theorem-name-numbering-in-margin ; but that answer has also other things put into the margin making it a bit more complicated. – Willie Wong Jul 28 '16 at 18:55
  • Sorry, I made a mistake, I mean on the left of the content as my picture. @Willie Wong – Forfaiting Jul 28 '16 at 19:23
  • The name of the Theorem does not need to be shown on the left of the content. Just as the picture shows, "Experiment and Event" is the "Theorem" name, and it's in the content. Thanks for giving me the link. @Willie Wong – Forfaiting Jul 28 '16 at 19:26

1 Answers1

5

Here's one attempt at producing the desired output. The main tool used is thmtools together with amsthm. For most of the configuration options you can see the thmtools manual.

\documentclass{article}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{thmtools}

\declaretheoremstyle[%
    spaceabove=3pt,spacebelow=3pt,%
    headfont=\normalfont\bfseries,% 
    notefont=\normalfont\bfseries,%
    notebraces={}{. },%
    headpunct={},%
    postheadspace=0pt,%
    headindent=0pt,%
    bodyfont=\normalfont,%
    headformat={\llap{\smash{\parbox[t]{1.3in}{\centering \NAME\\ \NUMBER}}}\NOTE}%
]{marginheads}
%hack to kill some extra space
\makeatletter
\renewcommand\thmt@space{}
\makeatother


\declaretheorem[style=marginheads, numberwithin=section, title=Definition]{defn}
\declaretheorem[style=marginheads, sibling=defn, title=Theorem]{them}

\begin{document}
First let us write a paragraph of something or another. 

\begin{defn}[Vector spaces over $\mathbb{R}$]
    A set $S$ equipped with operations addition $+: S\times S\to S$ and scalar multiplication $\cdot: \mathbb{R}\times S \to S$ satisfying the following list of 10 axioms
    \begin{enumerate}
        \item Something
        \item \ldots
        \item Let's quit
    \end{enumerate}
\end{defn}

Now we can state a theorem. Just to show it off.

\begin{them}
    Suppose that $a$ and $b$ are the lengths of the legs of a right triangle, and $c$ is the length of the hypotenuse, then it is known that $a^2 + b^2 = c^2$. 
\end{them}

\end{document}

Output

enter image description here

Discussion

The main lifting is done in the setting of the headformat key, which creates a parbox with a certain width (1.3in here) and places the theorem heading and number on two lines, centered. \smash is used to make it take effectively 0 vertical space in the layout (so that the second line of the theorem will not be pushed down). \llap lets the box protrude into the margin.

I had to \renewcommand\thmt@space{} since the code for \NOTE in \thmtools prepends the theorem name with \thmt@space to give a space between the heading and the name. But in our case our heading is set elsewhere and the space creates an unintentional indent if the optional name is given. Similarly postheadspace is set to be zero, and the space needed to separate the name of the theorem from the theorem text is appended in notebraces.

In the above demonstration both named and unnamed theorems are shown.

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
  • Alternatively one can try to place the theorem names using \marginpar or similar. For onesided document issuing \reversemarginpar will work well enough. But for twosided documents the changing margins between even and odd pages make it a bit more challenging. – Willie Wong Jul 28 '16 at 19:59
  • OMG, this solution is just creative, enlightening & brilliant. This is just what I want to achieve. Thanks for correct my errors in the 1st time statement. & also thanks for spending time in writing the commands and instructions. The instructive discussion comment helped me a lot to understand your idea and the whole picture here. Now I'm not able to make a contribution to the challenging twosided problem. It is indeed challenging as even my picture uploaded belongs to a onesided book. Thanks for the whole work you've achieved. Thank you very much! @Willie Wong – Forfaiting Jul 28 '16 at 21:07
  • Caveat: the amount the label protrudes depends on the current left margin. If you are working within some environment which indents everything, then the label may protrude insufficient amounts. One can possibly deal with those changes automatically; but that will depend on what is the culprit for changing the margin/indentation, and will make the code more complicated. – Willie Wong Jul 28 '16 at 22:30