How to create two box side by side in latex without using tikzlibrary

You can use \fcolorbox from the xcolor package and a tabular to align them side by side.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\begin{document}

\setlength\fboxrule{1pt}
\begin{tabular}{cc}
  moments & canonical \\
  \fcolorbox{red!50!black}{white}{$
  \begin{aligned}
    \Sigma &= \Omega^{-1} \\
    \mu &= \Omega^{-1} \xi
  \end{aligned}
  $} &
  \fcolorbox{red!50!black}{white}{$
  \begin{aligned}
    \Omega &= \Sigma^{-1} \\
    \xi &= \Sigma^{-1} \mu
  \end{aligned}
  $} \\
\end{tabular}

\end{document}

enter image description here


Another alternative is to use MetaPost with LuaTeX.

\documentclass{article}
\usepackage{amsmath}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\everymplib{
  input rboxes;
  beginfig(0);
}
\everyendmplib{endfig;}
\begin{document}

\begin{mplibcode}
  boxit.moments(btex
  $
  \begin{aligned}
    \Sigma &= \Omega^{-1} \\
    \mu &= \Omega^{-1} \xi
  \end{aligned}
  $
  etex);
  moments.c = (-1cm,0);
  boxit.canonical(btex
  $
  \begin{aligned}
    \Omega &= \Sigma^{-1} \\
    \xi &= \Sigma^{-1} \mu
  \end{aligned}
  $
  etex);
  canonical.c = (1cm,0);

  draw bpath moments withpen pencircle scaled 1pt withcolor .5[red,black];
  draw bpath canonical withpen pencircle scaled 1pt withcolor .5[red,black];
  drawunboxed(moments, canonical);

  label.top("moments", moments.n);
  label.top("canonical", canonical.n);
\end{mplibcode}

\end{document}

enter image description here


You can use a tabular, with a little help from hhline:

\documentclass{article}
\usepackage{hhline}
\usepackage[table]{xcolor}

\begin{document}

\begin{center} % or \[
\arrayrulecolor{red!50!black}
\setlength{\arrayrulewidth}{1pt}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|c|c|c|}
\multicolumn{1}{c}{moments} &
\multicolumn{1}{c}{\qquad} &
\multicolumn{1}{c}{canonical} \\
\hhline{|-|~|-|}
$\Sigma=\Omega^{-1}$ && $\Omega=\Sigma^{-1}$ \\
$\mu=\Omega^{-1}\xi$ && $\xi=\Sigma^{-1}\mu$ \\
\hhline{|-|~|-|}
\end{tabular}
\arrayrulecolor{black} % because `\arrayrulecolor` is global
\end{center} % or \]

\end{document}

enter image description here