Written and maintained by CASRAI Editorial Board
Last updated
Short answer: load the package with \usepackage{tcolorbox}, then wrap text in \begin{tcolorbox} ... \end{tcolorbox}. Colours, a title and a lower section are all set with key-value options. This page gives a copy-paste preamble and eight graduated examples, each traced to the package’s own manual, for researchers who need a callout, a definition box, or a framed result in a paper, thesis or handout.
What tcolorbox is used for in research
According to its CTAN entry (read 2026-11-07), tcolorbox provides “coloured, framed text boxes with a heading line”. A box can be split into an upper and a lower part, for example LaTeX source above and its typeset output below, and the package is also used for theorem-style environments. CTAN lists version 6.10.0 (dated 2026-05-28), the LaTeX Project Public License 1.3, and Prof. Dr. Dr. Thomas F. Sturm as maintainer. The package depends on pgf, verbatim, environ and etoolbox.
Typical research uses are highlighted definitions, key results, warnings in a methods appendix, and boxed equations. If you only need a plain frame around text, the framed package guide covers that lighter option, including a short comparison with tcolorbox.
Install or access (official source only)
The manual (section 1.1) says tcolorbox “will be installed as part of a major LaTeX distribution”, so in most setups there is nothing to install. For a manual installation, place tcolorbox.sty and all *.code.tex files in your local texmf tree. The package page, manual and examples PDF are on CTAN:
- Package page: ctan.org/pkg/tcolorbox
- Manual: tcolorbox.pdf
- Examples PDF: tcolorbox-example.pdf
- Source repository: github.com/T-F-S/tcolorbox
Section 1.2 of the manual explains that the core loads tikz, verbatim, etoolbox and environ, and that package options use key-value syntax, for example \usepackage[listings]{tcolorbox}. Section 1.3 describes loading libraries with \tcbuselibrary{...}.
Step-by-step: eight tcolorbox examples
All snippets below follow the manual’s own examples (read 2026-11-07). Start with this preamble line and add libraries only when an example calls for them.
\usepackage{tcolorbox}
1. A minimal box
\begin{tcolorbox}
This is a \textbf{tcolorbox}.
\end{tcolorbox}
2. Colours and a title
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My nice heading]
This is another \textbf{tcolorbox}.
\end{tcolorbox}
colback is the background colour, colframe the frame colour and title the heading line.
3. An upper and a lower part
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My nice heading]
This is another \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}
\tcblower separates the two parts; per the manual, “visually, both parts are separated by a line.”
4. Set options once for every later box
\tcbset{colback=red!5!white,colframe=red!75!black}
Put this in the preamble and every later box inherits those colours.
5. A reusable environment with a title argument
\newtcolorbox{mybox}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title={#1}}
\begin{mybox}{Hello there}
Box content.
\end{mybox}
The manual states that \newtcolorbox “operates like \newenvironment“: you can declare a number of arguments and a default for an optional first argument. \renewtcolorbox redefines an existing one. For a definition box used throughout a thesis, this is the right pattern, because the colours live in one place.
6. Side-by-side upper and lower parts
\begin{tcolorbox}[title=My title,sidebyside]
Upper part
\tcblower
Lower part
\end{tcolorbox}
The manual notes that the resulting box is unbreakable.
7. An inline box and a highlighted equation
\tcbox[tcbox raise base]{Hello World}
\tcbox sizes the box to its content inside running text. For mathematics, \tcbhighmath boxes a formula; the manual’s example places it inside an align environment:
\tcbhighmath{\sum\limits_{n=1}^{\infty} \frac{1}{n}} = \infty
With empheq it is passed as [box=\tcbhighmath]. The manual describes \tcbhighmath as a special case of \tcboxmath.
8. A box that breaks across pages
\tcbuselibrary{breakable}
\begin{tcolorbox}[breakable]
Long content that may continue on the next page.
\end{tcolorbox}
Breaking is provided by the breakable library; the manual notes that height-control keys apply only to unbreakable boxes.
Output and how to read it
Compile as usual; each example renders as a framed, coloured block with the title in a heading strip. Example 3 shows a divider line between the two parts, and example 6 puts them in two columns. The official examples PDF shows the output of every feature. Its sections are coloured boxes (titles, upper and lower parts, hidden lower part, image fill, boxed title), LaTeX examples with code and output side by side, numbered theorems, watermarks, boxes in boxes, and breakable boxes.
Which feature needs which library
| Feature | What to load | Manual reference |
|---|---|---|
Basic boxes, titles, \tcblower, \newtcolorbox, \tcbox, \tcbhighmath |
\usepackage{tcolorbox} only |
Sections 1.2 and following examples |
| Boxes that break across pages | \tcbuselibrary{breakable} |
Breakable library |
| Numbered theorem boxes | \tcbuselibrary{theorems} |
Section 1.3 |
| Code listings in boxes | \tcbuselibrary{listings} (or \usepackage[listings]{tcolorbox}) |
Sections 1.2 and 1.3 |
| Most libraries at once | \tcbuselibrary{most} (everything except minted, documentation and xparse) |
Section 1.3 |
Other libraries named in the manual include skins, raster, minted, fitting, hooks, magazine, poster, vignette and external.
Troubleshooting
- A key or box type has no effect. Check whether it belongs to a library and load it with
\tcbuselibrary{...}. Breaking across pages, for instance, needs thebreakablelibrary. - Manual installation does not work. The manual requires
tcolorbox.styand all*.code.texfiles in the local texmf tree, not just the.sty. - Listings with
pdflatex. The manual says to uselistingsutf8with pdfLaTeX; with XeLaTeX or LuaLaTeX, uselistings. - Height keys ignored on a long box. The manual states height-control keys apply only to unbreakable boxes.
Free alternatives
tcolorbox itself is free software under the LaTeX Project Public License 1.3 (CTAN). For a plain frame without the colour and title machinery, CASRAI’s guide to the LaTeX framed package compares the two. Related LaTeX how-tos on this site: boldface in LaTeX, the aligned environment, and Greek symbols in LaTeX.
FAQ
Where can I find the official tcolorbox example PDF?
On CTAN at tcolorbox-example.pdf (read 2026-11-07); the full manual is tcolorbox.pdf.
Is there a tcolorbox GitHub repository?
Yes: github.com/T-F-S/tcolorbox, linked from the CTAN package page.
How do I put a box around a formula?
Use \tcbhighmath{...}, shown in example 7; it is a special case of \tcboxmath.
How do I draw a simple LaTeX box?
For a coloured, titled box use example 1 or 2 above. For an unstyled frame, see the framed package guide.
Sources (official documentation)
- CTAN, tcolorbox package page, ctan.org/pkg/tcolorbox, read 2026-11-07.
- T. F. Sturm, The tcolorbox package (manual), tcolorbox.pdf, read 2026-11-07.
- T. F. Sturm, tcolorbox examples, tcolorbox-example.pdf, read 2026-11-07.







