2

I need to declare a new theorem style in order to organize my lectures. I want it to be something in this spirit : colored boxed, background color, name of the theorem.

So i searched how and that's what I found :

http://mirror.hmc.edu/ctan/macros/latex/exptl/thmtools/thmtools.pdf

and this

http://iml.univ-mrs.fr/~beffara/soft/thmbox.pdf

unfortunately when I use the package of the second document, I can't change the color of the frame and the color of the background ( unless the graphism of the frame are totally accurate, that's exactly what I searched). Moreover, this package change the style of many original environnement like examples, proof or thrm. But I would like to write with a normal style too.

And when I used only the package of the first document, I have those problems: I don't know how to define a new color...

I don't know to tell the box to be the width of the paper? I can only say textwidth = 35 em

and apparently in the first package, there is also the package of thmbox... but I would like to do the same thing that I precise before : to change the color of the background and of the box...

i found another post where he asks how to do a box, but I would like to declare something at the beginning for using it after... Boxing and coloring background of text

thank you! Marine

Marine Galantin
  • 385
  • 4
  • 18

1 Answers1

4
\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{theorems}

\newtcbtheorem[number within = section]{mytheorem}{\emph{Theorem:}}{colback = blue!10, colframe = blue!50!black, fonttitle = \bfseries}{th}

\begin{document}

\section{Introduction}
\begin{mytheorem}{Pythagorean Theorem}{pythagoras}
  For a right triangle with legs $a$ and $b$ and hypotenuse $c$,
  \[
  a^2 + b^2 = c^2. 
  \]
\end{mytheorem}

This is a reference to Theorem \ref{th:pythagoras}.

\end{document}

enter image description here

caverac
  • 7,931
  • 2
  • 15
  • 31
  • 1
    thank you but you don't solve the problem of just putting a line on the right and not boxing the theorem.. :/ – Marine Galantin Jan 24 '18 at 11:23
  • 2
    @MarineGalantin Maybe if you add a little sketch of what you want exactly we could help you – caverac Jan 24 '18 at 11:25
  • yes sure, i d like to do the same box as in thmbox the 'S' one. I mean you have just a line on the right of your text. If I could also choose the color of the line it would be perfect – Marine Galantin Jan 24 '18 at 11:30