I am trying to get my equations to show up like:
This is my attempt thus far:
\documentclass[11pt,fleqn]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{243,102,25}
\usepackage{avant}
\usepackage{empheq}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{calc}
\begin{document}
\newcommand*\Ocrebox[2][Example]{%
\sbox{\mysaveboxM}{#2}%
\sbox{\mysaveboxT}{\fcolorbox{ocre}{ocre!10}{#1}}%
sbox{\mysaveboxM}{%
\parbox[b][\ht\mysaveboxM+.5\ht\mysaveboxT+.5\dp\mysaveboxT][b]{%
\wd\mysaveboxM}{#2}%
}%
\sbox{\mysaveboxM}{%
\fcolorbox{black}{shadecolor}{%
\makebox[\linewidth-10em]{\usebox{\mysaveboxM}}%
}%
}%
\usebox{\mysaveboxM}%
\makebox[0pt][r]{%
\makebox[\wd\mysaveboxM][c]{%
\raisebox{\ht\mysaveboxM-0.5\ht\mysaveboxT
+0.5\dp\mysaveboxT-0.5\fboxrule}{\usebox{\mysaveboxT}}%
}%
}%
}
\begin{empheq}[box=\Ocrebox]
\frac{C(s)}{R(s)}= \frac{G(s)}{1+G(s)H(s)}
\label{e5}
\end{empheq}
\end{document}
I am not getting this to compile though. Any help will be greatly appreciated!
Best Answer
For the frame around theorem-like structures, one possibility is to use
mdframed
andamsthm
; for a simple frame around equations,empheq
-style, it's enough to say something like:and then use
box=\mymathbox
in the optional argument ofempheq
. A complete example:In a comment, it has been requested to have a framed box similar for those for theorems in my previous solution, but for math expressions; one possibility here is to use the
tcolorbox
package:Or, using
mdframed
again,