3

I'm trying to replicate the equation shown below. I can't figure out how to put parts of it in a frame without one of the borders.

enter image description here

4

You can go with a normal tabular with one open column. Defining a new command can be quite handy for this. Here is one implementation of it:

\documentclass[12pt]{article}
\begin{document}

\newcommand{\ltab}[1]{\begin{tabular}{|@{}l@{}}
\hline
\ensuremath{#1}\\
\hline
\end{tabular}
}

\newcommand{\rtab}[1]{\begin{tabular}{@{}r@{}|}
\hline
\ensuremath{#1}\\
\hline
\end{tabular}
}

\[
\ltab{\hat{g}} = \sqrt{\frac{4\pi\delta}{\sigma_1((X+Y)(X-Y))^{\sigma_2}}} 
\;\rtab{\approx 999.121}
\]

\end{document}

enter image description here

1
  • Worked perfectly and commands proved to be useful in later equations, thank you ;)
    – Vash
    Jan 18 '17 at 14:14
2

An alternative solution with a tcbox from tcolorbox which offers all its bells and whistles.

\documentclass[12pt]{article}
\usepackage[theorems]{tcolorbox}

\tcbset{%
    nobeforeafter,
    math upper,
    tcbox raise base,
    sharp corners,
    colback=white,
    colframe=black,
    boxsep=0pt,
    left=1pt,
    right=1pt,
    top=2pt,
    bottom=2pt,
    boxrule=1pt
    }

\newtcbox{\lbox}[1][]{
    rightrule=0pt, #1}

\newtcbox{\rbox}[1][]{
    leftrule=0pt, #1}

\begin{document}

\[
    \lbox[colback=green!30]{\hat{g}} = 
    \sqrt{\frac{4\pi\delta}{\sigma_1((X+Y)(X-Y))^{\sigma_2}}} 
    \;\rbox[colframe=red]{\approx 999.121}
\]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.