# Two-line boxed equation

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{split} &hijoiojoij \\ &=iuiouooipip \end{split}$$

\end{document}


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

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

\begin{document}

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

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

\end{document}


You can use hf-tikz:

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

\begin{document}

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

\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.

The ornament style can be customized.

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

\hfsetbordercolor{black}

\begin{document}

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

\end{document}


• 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 9:25
• @Fib1123 Look at the package documentation for fine tuning, there are several examples. – egreg Jun 17 '18 at 9:26