3

I would like to have every theorem with the same style to have the same colored box and to be able to configure the color. Like this : enter image description here

I tried to use the package ntheorem with the option framed and to call the package framed but LaTeX returned the following errors :

! Undefined control sequence.\att@framecommand ->\psframebox[fillstyle=solid, fillcolor=red, linecolor=red] \begin{att}

Compiled with the following code :

\documentclass[12pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{fourier}


\usepackage{etoolbox} %Pour la forme des démonstrations
\usepackage{fancybox,lipsum,changepage}
\usepackage[thmmarks, amsmath, framed]{ntheorem}
\usepackage{framed} % Pour les fonds colorés
\usepackage{pifont} % Pour les symboles !
\usepackage[x11names]{xcolor} % Pour la couleur !


\begin{document}

{
    \shadecolor{red}
    \theoremstyle{break}
    \theoremheaderfont{\sffamily\bfseries}
    \theorembodyfont{\sffamily}
    \newshadedtheorem{att}{\danger Attention !}

}

\begin{att}
\lipsum[1]
\end{att}


\end{document}

My try for the package tcolorbox give this result :

enter image description here

the following error :

! Undefined control sequence.\kvtcb@fonttitle ->\sffamily \bfserie L

With this code :

\documentclass[12pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{fourier}


\usepackage{etoolbox} %Pour la forme des démonstrations
\usepackage{fancybox,lipsum,changepage}
\usepackage[thmmarks, amsmath, framed]{ntheorem}
\usepackage{framed} % Pour les fonds colorés
\usepackage{pifont} % Pour les symboles !
\usepackage[theorems]{tcolorbox} % Pour la couleur !



\begin{document}

\newtcbtheorem
{att}{\danger Attention !}
%
{colback=green!5,colframe=green!35!black,fonttitle=
\sffamily\bfserie
}{th} 

\begin{att*}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulumut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Namarcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus
eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium
quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
\end{att*}


\end{document}
  • You might have a look into the documentation of tcolorbox and its theorem library? – user31729 Aug 11 '14 at 21:33
  • Sure ! I take a look ! – Le Duc Banal Aug 11 '14 at 21:35
  • 1
    Done ! I give it a try. – Le Duc Banal Aug 11 '14 at 21:37
  • Errors poorfully ! – Le Duc Banal Aug 11 '14 at 22:16
  • You have written \bfserie, the command is \bfseries ;-) Correcting that, it should run... You are misusing the environment in my point of view – user31729 Aug 11 '14 at 22:19
7
\documentclass[12pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{fourier}


\usepackage{etoolbox} %Pour la forme des démonstrations
\usepackage{fancybox,lipsum,changepage}
\usepackage[thmmarks, amsmath, framed]{ntheorem}
\usepackage{framed} % Pour les fonds colorés
\usepackage{pifont} % Pour les symboles !
\usepackage[theorems]{tcolorbox} % Pour la couleur !




\begin{document}

\newtcbtheorem{att}{\danger Attention !}{colback=green!5,colframe=green!35!black,fonttitle=
{\sffamily\bfseries}}{th}%

\begin{att*}{}{}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulumut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Namarcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus
eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium
quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
\end{att*}


\end{document}

enter image description here

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.