1

I've found a awesome document (doing some research in Model Theory).

enter image description here

I would like to know how I can do those color boxes for definitions, theorems and other stuff. Thanks a lot!

  • 2
    Have a look at the tcolorbox manual, it is very informative – BambOo Sep 6 '18 at 17:14
  • I'm not so sure about the choice of colours... :) – Andrew Sep 7 '18 at 5:54
1

You can do like this

\documentclass[border=5mm]{standalone}
\usepackage[most]{tcolorbox}

\newtcolorbox{myBox}[3][]{
arc=5mm,
lower separated=false,
fonttitle=\bfseries,
colbacktitle=green!10,
coltitle=green!50!black,
enhanced,
attach boxed title to top left={xshift=0.5cm,
        yshift=-2mm},
colframe=green!50!black,
colback=green!10,
overlay={
\node[draw=green!50!black,thick,
%inner sep=2mm,
fill= green!10,rounded corners=1mm, 
yshift=0pt, 
xshift=-0.5cm, 
left, 
text=green!50!black,
anchor=east,
font=\bfseries] 
at (frame.north east) {#3};},
title=#2,#1}

\begin{document}


\begin{myBox}[]{content}{Some}
content text content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text 
\end{myBox}

\end{document}

enter image description here

UPDATE: sequence number to the definition

\documentclass{article}
\usepackage[most]{tcolorbox}

\newtcolorbox[auto counter,number within=subsection]{myBox}[3][]{
arc=5mm,
lower separated=false,
fonttitle=\bfseries,
colbacktitle=green!10,
coltitle=green!50!black,
enhanced,
attach boxed title to top left={xshift=0.5cm,
        yshift=-2mm},
colframe=green!50!black,
colback=green!10,
overlay={
\node[draw=green!50!black,thick,
%inner sep=2mm,
fill= green!10,rounded corners=1mm, 
yshift=0pt, 
xshift=-0.5cm, 
left, 
text=green!50!black,
anchor=east,
font=\bfseries] 
at (frame.north east) {#3};},
overlay={
\node[draw=green!50!black,thick,
%inner sep=2mm,
fill= green!10,rounded corners=1mm, 
yshift=0pt, 
xshift=-0.5cm, 
left, 
text=green!50!black,
anchor=east,
font=\bfseries] 
at (frame.north east) {#3};},
title=#2 \thetcbcounter,#1}



\begin{document}

\section{section title}
\subsection{subsection title}
\begin{myBox}[]{Content}{Some}
Content text content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text  content text 
\end{myBox}

\end{document}

enter image description here

  • Could you add a sequence number to the defintion and a label to refer back to the definition? – pzorba75 Apr 6 '19 at 12:28
  • I think a \newtcbtheorem box works better in this case than just a regular \newtcolorbox – Ignasi Sep 4 '19 at 7:03

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.