Math & Science ⇒ The best way to emphasize equations ?
The best way to emphasize equations ?
What do you suggest, to make a nice looking emphasized equation ?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
The best way to emphasize equations ?
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
The best way to emphasize equations ?

Code: Select all
\begin{empheq}[boxtype=\fbox]
\begin{equation}
\label{hamiltonian}
H(q, p) = \tensor{\dot q}{^i} \hspace{1pt} \tensor{p}{_i} - L.
\end{equation}
\end{empheq}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
The best way to emphasize equations ?
You didn't use the »empheq« environment correctly. This environment needs a certain syntax as described in the package manual.
Code: Select all
\documentclass[11pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools} % loads »amsmath«
\usepackage{empheq}
\usepackage{tensor}
\begin{document}
\begin{empheq}[box=\fbox]{equation}\label{eqn:hamiltonian}
H(q,p) = \tensor{\dot{q}}{^i}\,\tensor{p}{_i}-L
\end{empheq}
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
The best way to emphasize equations ?
EDIT : Wow ! Now it's awesome

Again, thanks A LOT for all of your precious help !

The best way to emphasize equations ?
Currently, my emphasized equations are all working great, but I would like to add a simple black line all around the gray box (no white space), or even a double-frame. Here's a compilable example of a gray box around an equation :
Code: Select all
\documentclass[11pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{empheq}
\usepackage{tensor}
\usepackage[dvipsnames,table]{xcolor}
\definecolor{someGray}{RGB}{230,230,230}
\begin{document}
\begin{empheq}[box={\setlength{\fboxsep}{10pt}\colorbox{someGray}}]{equation}
H(q,p) = \tensor{\dot{q}}{^i}\,\tensor{p}{_i}-L
\end{empheq}
\end{document}
What about a black double-frame around the gray box, for the most extremely important equations ?
The empheq package documentation isn't obvious about this !
The best way to emphasize equations ?

Geez, I had to experiment a lot before finding this one !
Here's a compilable code to emphasize equations with a gray box, and a gray box with a red frame. The colors can be edited very easily.
Code: Select all
\documentclass[11pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{empheq}
\usepackage{tensor}
\usepackage[dvipsnames,table]{xcolor}
\definecolor{medGray}{RGB}{230,230,230}
\newenvironment{important}[2][]{
\setkeys{EmphEqEnv}{#2}
\setkeys{EmphEqOpt}{box={\setlength{\fboxsep}{10pt}\colorbox{medGray}},#1}
\EmphEqMainEnv}
{\endEmphEqMainEnv}
\newenvironment{tres important}[2][]{
\setkeys{EmphEqEnv}{#2}
\setkeys{EmphEqOpt}{box={\setlength{\fboxsep}{10pt}\fcolorbox{red}{medGray}},#1}
\EmphEqMainEnv}
{\endEmphEqMainEnv}
\begin{document}
\begin{tres important}{equation}
H(q,p) = \tensor{\dot{q}}{^i}\,\tensor{p}{_i}-L
\end{tres important}
\begin{important}{equation}
H(q,p) = \tensor{\dot{q}}{^i}\,\tensor{p}{_i}-L
\end{important}
\end{document}
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Re: The best way to emphasize equations ?
Stefan