1

I want to box the following two-line single equation. I checked the existing posts to no avail. Appreciate any help.

\documentclass[12 pt]{article}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\begin{document}

\begin{equation}
\begin{split}
&hijoiojoij \\
&=iuiouooipip
\end{split}
\end{equation}

\end{document}
Eureka
  • 1,013

2 Answers2

4

Using only the basic \boxed command, or \fcolorbox from xcolor:

\documentclass[12 pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[svgnames]{xcolor}

\begin{document}

\begin{equation}
\boxed{\quad\begin{split}
&hijoiojoij \\
&=iuiouooipip
\end{split}\quad}
\end{equation}

\begin{equation}
\setlength{\fboxrule}{0.8pt}
\fcolorbox{IndianRed}{Seashell}{\quad$ \begin{split}
&hijoiojoij \\
&=iuiouooipip
\end{split} $\quad}
\end{equation}

\end{document} 

enter image description here

Bernard
  • 271,350
1

You can use hf-tikz:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{hf-tikz}

\begin{document}

\begin{equation}
\begin{split}
\tikzmarkin{a}&hijoiojoij \\
&=iuiouooipip\tikzmarkend{a}
\end{split}
\end{equation}

\end{document}

Every ornament needs a new label (in the example case a), but it wouldn't be very difficult to assign the label automatically.

enter image description here

The ornament style can be customized.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[customcolors,nofill,norndcorners]{hf-tikz}

\hfsetbordercolor{black}

\begin{document}

\begin{equation}
\begin{split}
\tikzmarkin{a}&hijoiojoij \\
&=iuiouooipip\tikzmarkend{a}
\end{split}
\end{equation}

\end{document}

enter image description here

egreg
  • 1,121,712
  • thank you. It almost worked. Can the size of the box be customized? In my actual situation, the box doesn't fill up the whole equation. – Eureka Jun 17 '18 at 09:25
  • @Fib1123 Look at the package documentation for fine tuning, there are several examples. – egreg Jun 17 '18 at 09:26