Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical Supply Distributor100,000+ medical supplies. 48-hour critical dispatch.Ships from 8 regional U.S. hubs. Net-30 terms for verified institutional accounts.Shop lac.us CodeCASRAIlac.us

LaTeX Framed: Framed, Shaded and Leftbar Boxes for Theses

How to use the LaTeX framed package for breakable boxes in theses and manuscripts, with its limits and a tcolorbox comparison.

Written and maintained by CASRAI Editorial Board

Last updated

Short answer: the framed package (v0.96, by Donald Arseneau) gives LaTeX boxes that can break across pages: load it with \usepackage{framed} and wrap text in framed, shaded or leftbar. It is aimed at researchers boxing definitions, remarks or quotations in a thesis or manuscript. This page lists every environment the manual defines, the documented limits that decide whether it suits your document, and how it compares with tcolorbox. Package facts were checked against the CTAN manuals on 2026-11-07.

What the framed package does

CTAN describes framed as “Breakable framed and shaded boxes”. Its three headline environments, framed, shaded and leftbar, can split across pages, which an ordinary \fbox or \colorbox cannot. The package is in TeX Live and MiKTeX, is licensed “other-free”, and CTAN lists mdframed as a related package. The manual calls the more general purpose “the definition of new environments that take multi-line material, wrap it with some non-breakable formatting” and allow page breaks in the material.

Environments in the framed package

Environment Behaviour according to the manual
framed Ordinary frame box (\fbox) with its edge at the margin
oframed Like framed, with open top and bottom at page breaks
shaded Shaded background (\colorbox) bleeding into the margin
shaded* Shaded background with the edge at the margin
snugshade Shaded with a tight fit around the text, especially in lists
snugshade* Like snugshade with the shading edge at the margin
leftbar Thick vertical line in the left margin
titled-frame Frame with a title bar; also serves as a template for other environments

Minimal working example: a framed box

This is the usage the manual gives: \begin{framed} copious text \end{framed}. In a complete document:

\documentclass{article}
\usepackage{framed}
\begin{document}
\begin{framed}
Definition. A long definition that may run across a page break.
\end{framed}
\end{document}

By default framed draws an \fbox with \fboxrule set to \FrameRule and \fboxsep set to \FrameSep. Change the line thickness and padding with \setlength:

\setlength{\FrameRule}{1pt}
\setlength{\FrameSep}{8pt}

Shading and colour

The manual says the shaded environment “just redefines \FrameCommand to be \colorbox{shadecolor}”, and that you have to define the colour shadecolor yourself. A common way is with the xcolor package:

\usepackage{xcolor}
\definecolor{shadecolor}{gray}{0.92}
% ...
\begin{shaded}
A remark set on a light grey background.
\end{shaded}

Without that definition, shaded has no colour to use. Use shaded* or snugshade* when the shading should stop at the text margin instead of bleeding into it.

A left bar for quotations

leftbar draws a thick vertical line in the left margin and no box, which suits block quotations or remarks in a thesis that should not look like a call-out:

\begin{leftbar}
A passage quoted from a source, set off by a vertical rule.
\end{leftbar}

Titles and custom environments

For a frame with a heading, the manual offers titled-frame, and you must define two colours first: TFFrameColor for the frame and a contrasting TFTitleColor for the title text. If you attach a title yourself, the manual states the text “should be inserted by \FrameCommand so it cannot be separated from the body”.

To build your own environment, wrap the body in \MakeFramed{settings} … \endMakeFramed. The manual says a common setting is \advance\hsize-\width, which narrows the text so the outer edge of the frame aligns with the margins, plus a restore command such as \FrameRestore. A minimal sketch following that description:

\newenvironment{remarkbox}
  {\def\FrameCommand{\fbox}%
   \MakeFramed{\advance\hsize-\width \FrameRestore}}
  {\endMakeFramed}

Broken boxes can be styled per part: unbroken text uses \FrameCommand, while split text uses \FirstFrameCommand, optionally \MidFrameCommand, and \LastFrameCommand. By default the three simply invoke \FrameCommand, so all portions look alike. The oframed environment is the manual’s example of distinct first, middle and last frames.

Limits that matter in a thesis or manuscript

  • The manual states: “Floats, footnotes, marginpars and head-line entries will be lost” inside the framed regions. Keep figures, tables and footnote marks outside the box.
  • “This package will not work with the page breaking of multicol.sty, or other systems that perform column-balancing.” Do not use framed environments inside multicols.
  • A page break is allowed, and “even encouraged”, before framed environments.
  • The manual calls v0.96 a “pre-production” version; its own to-do list includes handling footnotes, floats and marginpars.

framed vs tcolorbox

framed tcolorbox
Version 0.96 (manual dated 2012/05/31) 6.10.0 (2026/05/28)
Author Donald Arseneau Thomas F. Sturm
Licence (CTAN) other-free LPPL 1.3
Purpose, per the manual Breakable framed and shaded boxes; building new environments Coloured and framed text boxes with a heading line, optional lower part (\tcblower)
Page breaking Built in for its environments Via the breakable library: \tcbuselibrary{breakable}, enabled by the key breakable
Load line \usepackage{framed} \usepackage{tcolorbox}

The tcolorbox manual’s own starter example gives a titled, coloured box: \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My nice heading] … \end{tcolorbox}. It also notes that with the breakable library, if the whole box fits on the current page it is shipped out unbroken. Choose framed for plain frames, shading or a left rule with a one-line setup; consider tcolorbox when you need a built-in title line or per-box styling keys.

Common mistakes

  • Using shaded without defining shadecolor.
  • Putting a footnote, figure or margin note inside a framed region, where the manual says it is lost.
  • Using a framed environment inside multicols.
  • Adding a box title as a separate paragraph before the environment, so it can separate from the body; insert it through \FrameCommand instead.
  • Expecting titled-frame to work without defining TFFrameColor and TFTitleColor.

Checklist

  • \usepackage{framed} in the preamble (and xcolor if you use shading).
  • shadecolor defined before any shaded or snugshade use.
  • No floats, footnotes or marginpars inside the boxes.
  • Not inside multicols.
  • \FrameRule and \FrameSep set once, not per box.
  • Compile twice and check each box where it crosses a page break.

FAQ

How do I put a box around text in LaTeX that can break across pages?

Load framed and wrap the text in \begin{framed} … \end{framed}. Unlike \fbox, the environment can split over pages.

What is a LaTeX framed box?

It is a box drawn around multi-line text. With the framed package it is an \fbox-style frame whose rule and padding are controlled by \FrameRule and \FrameSep.

Is there a LaTeX framed example for shaded text?

Yes: define shadecolor with \definecolor, then use \begin{shaded} … \end{shaded}, as shown above.

Can I use footnotes inside a framed environment?

No. The manual states footnotes, floats, marginpars and head-line entries are lost inside framed regions.

Where do I find the framed package?

On CTAN at https://ctan.org/pkg/framed; it is included in TeX Live and MiKTeX. See also the neighbouring guides on placing figures in LaTeX, matrices in LaTeX, aligned equations in LaTeX and LaTeX bibliography styles, or the guide to collaborative writing in Overleaf.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about LaTeX Framed: Framed, Shaded and Leftbar Boxes for Theses

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →