# Editing theorem environments

I have two questions about editing theorem environments on Tex. I did not see concrete answers among answered questions, so I ask here mines, hoping that there are not frequently asked.

First, I would like to know how to create the left line form the underlined title and followed by a little line at the bottom of a theorem like on this picture : Then, which packages are needed to do that - and in which order (I encountered some trouble with adding some packages together, something like incompatibility, especially with "hyperref" and "ntheorem" packages)?

I am not an expert at all with Tex, so an answer like "cut and past it in your code" will be satisfying!

Thanks.

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
– user31729
Mar 28, 2015 at 11:31
• Thank you for the welcome. I did not posted my "work" because I did not managed to do something correct for Tex, sorry. I just needed a concrete example, as provided below. Mar 28, 2015 at 12:11

You can do this with thmbox package

\documentclass{article}
\usepackage{thmbox}
\newtheorem[L]{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem[S]{cor}[thm]{Corollary}

\begin{document}

\begin{lem}{First resualt}
Here a lemma
\end{lem}

\begin{thm}{Important}
Great theorem
\end{thm}

\begin{cor}{Final}
Here the corollary
\end{cor}

\end{document}


for ntheorem compatibilite may be

\usepackage[amsmath,hyperref,thmmarks]{ntheorem}


or if amsthm theorem style is used

\usepackage[amsthm,amsmath,hyperref,thmmarks]{ntheorem}

• As far as I know, thmbow has a drawback: it can't break across pages. Mar 28, 2015 at 15:55

I wanted to try an answer with \tcolorbox just as an exercise, but Bernard gave a good reason, thmbox can't break across pages and tcbtheorems can. So, in case someone is interested, here you have a starting point.

A tcbthmbox looks similar to thmbox, tcbSthmbox like [S]-thmbox and tcbLthmbox like [L]-thmbox.

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{lmodern}

\tcbset{
thmbox/.style={
enhanced,
breakable,
sharp corners=all,
fonttitle=\bfseries\normalsize,
fontupper=\normalsize\itshape,
top=0mm,
bottom=0mm,
right=0mm,
colback=white,
colframe=white,
colbacktitle=white,
coltitle=black,
attach boxed title to top left,
boxed title style={empty, size=minimal, bottom=1.5mm},
overlay unbroken ={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)|-%
(frame.south east)--(frame.north east);},
overlay first={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
\draw (frame.north east)--(frame.south east);},
overlay middle={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
\draw (frame.north east)--(frame.south east);},
overlay last={
\draw ([xshift=3.5mm]frame.north west)|-%
(frame.south east)--(frame.north east);},
},
S/.style={thmbox,
overlay unbroken ={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay first={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay middle={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay last={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
},
L/.style={thmbox,
overlay unbroken ={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);},
overlay first={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay middle={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay last={
\draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);},
},
LQ/.style={thmbox,
overlay unbroken ={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
\node[anchor=east] at (frame.south east) {$\square$};},
overlay first={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay middle={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay last={
\draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
\node[anchor=east] at (frame.south east) {$\square$};},
},
}

\newtcbtheorem[]{tcbthmbox}{Theorem}{thmbox}{theo}
\newtcbtheorem[]{tcbSthmbox}{Theorem}{thmbox,S}{theo}
\newtcbtheorem[]{tcbLthmbox}{Theorem}{thmbox,L}{theo}
\newtcbtheorem[]{proof}{Démonstration}{thmbox,LQ}{theo}

\begin{document}

\begin{tcbthmbox}{First result}{}
\lipsum[3]
\end{tcbthmbox}

\begin{tcbSthmbox}{Important}{}
\lipsum[2]
\end{tcbSthmbox}

\begin{tcbLthmbox}{Final}{}
\lipsum[1]
\end{tcbLthmbox}

\begin{proof}{Proof}{}
\lipsum[1]
\end{proof}
\end{document}


Update:

\newtcbtheorem[<init options>]{<name>}{<display name>}{<options>}{<prefix>}


has five parameters <init options> are related with automatic numbering; name is the name used as environment \begin{name}...\end{name}; display name, the word or words used before title: Theorem, Lemma, Démonstration, ...; options are all tcolorbox options to define its appearance and prefix a prefix used before the label assigned to each environment. Once defined, every tcbtheorem environment is declared with

\begin{name}{title}{label}
...
\end{name}


which uses two mandatory arguments, title and label. They are mandatory but can be empty. If a proof doesn't have any title except Démonstration, just leave the title empty. In this case : (or any other character used between display name and title) will vanish.

If you also want to suppress theorem numbers, you have two options, the first one is \begin{name*}...\end{name*}. The starred variant doesn't have number but it's also unlabeled and not listed in list of theorems. A second possibility consists in using option theorem name is theorem options. This options can be added inside \tcbset command, in \newtcbtheorem <options> parameter or through an optional argument in theorem environment: \begin{proof}[theorem name]{}{}.

Following code which has been a little bit simplified from previous version, shows some examples with proof:

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{lmodern}

\tcbset{
thmbox/.style={
enhanced,
breakable,
sharp corners=all,
fonttitle=\bfseries\normalsize,
fontupper=\normalsize\itshape,
top=0mm,
bottom=0mm,
right=0mm,
colback=white,
colframe=white,
colbacktitle=white,
coltitle=black,
attach boxed title to top left,
boxed title style={empty, size=minimal, bottom=1.5mm},
overlay unbroken ={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay first={
\draw (title.south west)--(title.south east);
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay middle={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
overlay last={
\draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
},
Boxed/.style={
overlay unbroken and last app ={
\draw ([xshift=3.5mm]frame.south west)-|(frame.north east);},
},
L/.style={
overlay unbroken and last app ={
\draw ([xshift=3.5mm]frame.south west)--++(0:11.5mm);},
},
Q/.style={
overlay unbroken and last app={
\node[anchor=east] at (frame.south east) {$\square$};},
},
}

\newtcbtheorem[]{tcbthmbox}{Theorem}{thmbox,Boxed}{theo}
\newtcbtheorem[]{tcbSthmbox}{Theorem}{thmbox}{theo}
\newtcbtheorem[]{tcbLthmbox}{Theorem}{thmbox,L}{theo}
\newtcbtheorem[]{proof}{Démonstration}{thmbox,Q}{theo}

\begin{document}

\begin{proof}{Title}{}
\textcolor{red}{A demonstration with title and number}

\lipsum[2]
\end{proof}

\begin{proof}{}{}
\textcolor{red}{A demonstration without title but with number}

\lipsum[3]
\end{proof}

\begin{proof}[theorem name]{}{}
\textcolor{red}{A demonstration without title and number}

\lipsum[3]
\end{proof}

\begin{proof*}{}

\textcolor{red}{Starred version}

\lipsum[3]
\end{proof*}

\end{document}


• Thank you Ignasi for your answer. Maybe can I add another question : using this theorem environment for my definitions, lemma, etc., how can I change create a special "proof" environment with the title "Démonstration" in french, ending with the white square usually used at the end of the proof ? Apr 1, 2015 at 14:43
• @Nicolas Glad to help you. I can answer your new question but in a couple of days. In the mean time you can look at tex.stackexchange.com/a/184530/1952 for better details about tcolorbox theorems. Apr 1, 2015 at 15:44
• @Nicolas I've updated the answer with a proof environment (similar to [L] thmbox) and a little square at bottom right. Apr 2, 2015 at 15:02
• @Nicolas A new edition introduces some simplifications in code and also some comments to explain how it works. Now proof only shows the vertical left line, no horizontal one. Apr 6, 2015 at 18:28
• @Nicolas Yes. Just comment or delete \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west); from overlay unbroken, overlay first, overlay middle and overlay last. But in this case the result will be completely different from your initial question. Apr 6, 2015 at 19:28