I would like to create frames / boxes for equations or text like in the Beamer class:
outisde of the beamer documentclass, for example in the article
class. Is there any package or trick to do this?
thanks
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI would like to create frames / boxes for equations or text like in the Beamer class:
outisde of the beamer documentclass, for example in the article
class. Is there any package or trick to do this?
thanks
tcolorbox
has also a beamer
skin:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\colorlet{xlightblue}{blue!5}
\newtcolorbox{beamerlikethm}[1]{
title=#1,
beamer,
colback=xlightblue,
colframe=blue!30,
fonttitle=\bfseries,
left=1mm,
right=1mm,
top=1mm,
bottom=1mm,
middle=1mm
}
\begin{document}
\begin{beamerlikethm}{Theorem (Pythagoras)}
\[ a^2 + b^2 = c^2 \]
\end{beamerlikethm}
\end{document}
As Gonzalo suggested, could happen that your box necessitate of being split on different pages. The library breakable
of the package deal with this problem.
An example:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\usepackage{lipsum}
\colorlet{xlightblue}{blue!5}
\newtcolorbox{beamerlikethm}[1]{
title=#1,
beamer,
colback=xlightblue,
colframe=blue!30,
fonttitle=\bfseries,
left=1mm,
right=1mm,
top=1mm,
bottom=1mm,
middle=1mm,
breakable,
}
\begin{document}
\begin{beamerlikethm}{Theorem (Pythagoras)}
\[ a^2 + b^2 = c^2 \]
\end{beamerlikethm}
\lipsum[1-4]
\begin{beamerlikethm}{Something}
\lipsum[5]
\end{beamerlikethm}
\end{document}
breakable
option so the box admits page breaks.
Sep 10, 2013 at 12:43
amsmath
package corrects the spacing before the equation. Alternatively, the tcolorbox
library theorems
could be used (which loads amsmath
). For multiline formulas, the library has special support for the spacing at the begin of the box, e.g. see the option 'ams nodisplayskip'. :-)
Sep 11, 2013 at 6:45
Another approach with the »tcolorbox« package and its theorems
library.
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}
\newtcbtheorem{corollary}{Corollary}{%
breakable,
colback=blue!10,
colframe=blue!25,
fonttitle=\bfseries
}{cor}
\begin{document}
\begin{corollary}{Title}{dummy}
\[
x+y=y+x
\]
\end{corollary}
\end{document}
breakable
option so the box admits page breaks.
Sep 10, 2013 at 12:43
breakable
option needs the breakable
library. Since it was not asked here for boxes which allow page breaks, there was no necessity to add it. But as you mention that now, the OP is aware of it.
Sep 10, 2013 at 12:53
tcolorbox
using \usepackage[most]{tcolorbox}
, so I don't have to worry about loading the libraries explicitly.
Sep 10, 2013 at 12:57
tcolorbox
package might be helpful.
\documentclass{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[colback=blue!5,colframe=blue!40!black,title=Theorem (Pythagoras)]
\[ a^2 + b^2 = c^2 \]
\end{tcolorbox}
\end{document}
The similar question was asked here.
breakable
option so the box admits page breaks.
Sep 10, 2013 at 12:44