# Frame box around the TOC

I'm trying to put a frame box around ALL e table of contents in an article document class. Someone can help me?

Depending on how big your ToC is, the following works without any packages (duckuments is only loaded to quickly produce a few pages of contents with sections and subsections).

## Small ToC (no need for column or page breaks)

This solution will only work as long as your ToC fits on a single page/in a single column.

You can change the rule thickness of the box by using \setlength{\fboxrule}{<your length>}, and change the distance between the frame and the contents by using \setlength{\fboxsep}{<your length>} (best done in a group around \fbox to not change anything else in the document, e.g., \begingroup\setlength{\fboxrule}{1cm}\fbox{...}\endgroup).

\documentclass[]{article}

\usepackage{duckuments}

\begin{document}
\noindent
\fbox
{%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule}%
\tableofcontents
\end{minipage}%
}%

\duckument
\end{document}


## Bigger ToC (or fancy boxes)

If your ToC requires to be page breakable, you can use the tcolorbox package and its breakable library. The following is an example which uses the default looks of a tcolorbox (but tcolorbox is really customisable, so you can achieve almost any looks you could imagine with this, this includes a plain looking frame as done with \fbox)


\documentclass[]{article}

\usepackage{tcolorbox}
\tcbuselibrary{breakable}

\usepackage{duckuments}

\begin{document}
\noindent
\begin{tcolorbox}[breakable]
\tableofcontents
\end{tcolorbox}

\duckument
\end{document}


• That's great! Thank you so much!
– mcp
Oct 17 '20 at 13:36