# Creating a Highlight Box Using tcolorbox in Latex

Sometimes, you need to summarise or highlight the most important points of a document. Preferably, it should be a centred box with a width less than the width of the page with a title. I could manage to build with tcolorbox beautifully. This is an amazing package with a great user’s manual. It is so comprehensive and powerful that its manual is about 500 pages.

\documentclass{article}
\usepackage[letterpaper, margin=1.2in]{geometry}
\usepackage[many]{tcolorbox}
\usepackage{xcolor}

\begin{document}
\begin{tcolorbox}[colback=yellow!10!white,
colframe=white!20!black,
title=\textsc{\texttt{tcolorbox} at a glance},
center,
valign=top,
halign=left,
before skip=0.8cm,
after skip=1.2cm,
center title,
width=12cm]

This is a highlight box created by \texttt{tcolorbox} package. \\
\tiny P.S.: Tons of features come with the package. Check out
the user manual on http://ctan.sharelatex.com/tex-archive/macros/latex2e/contrib/tcolorbox/tcolorbox.pdf
\end{tcolorbox}
\end{document}


colback sets the color for the background. Here, I am asking for 10% of yellow mixed with full white color. You can create any combinations of colours using xcolor package.
colframe define colour of the frame around the box. center put the box in the middle of the page horizontally. It fit the whole page unless you specify a width for the box, as I chosen to have width=12cm. If you want to have some white space before and after the box, use before skip and after skip commands. To style the text within the box, you can use valign for vertical alignment and halign for horizontal alignment. Use title to set a title for the box. You can use any standard text styling commands as I am using \textsc here. I also want to centre the title using center title. Then, it comes the main body of the box where you can use all standard commands and features in .
tcolorbox is an amazing package. Read their manual here for more features.

Share if you liked: