1

I need to do this box enter image description here. How can I do that?

2
  • I tried but result is box around whole equation, not like in the picture.
    – Blichar
    Commented Jan 19, 2017 at 13:49
  • ok, I misunderstood your question. I thought your picture shown your current result, and not what you're expecting.
    – ebosi
    Commented Jan 19, 2017 at 13:51

2 Answers 2

2

Hackjob to get

enter image description here

First I print a boxed equation with horizontal space equivalent of the root, then print the root in box with white background on top.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\begin{document}
\[
\fboxsep=1pt\relax
\newcommand\MyRoot{{}= \sqrt{\frac{4\pi\delta}{\sigma_1\bigl((X+Y)(X-Y)\bigr)^{\sigma_2}}}}
\ooalign{%
$\displaystyle\boxed{\hat{g} \hphantom{\displaystyle\MyRoot} \approx 999.121}$\cr
\fboxsep=0pt\relax\hspace{0.8em}\colorbox{white}{$\displaystyle\MyRoot$}
}
\]
\end{document}
4

egreg suggests using \boxed macro of the amsmath package.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\fboxsep=1pt\relax
\boxed{\hat g} = \sqrt{\frac{4\pi\delta}{\sigma_1\bigl((X+Y)(X-Y)\bigr)^{\sigma_2}}} 
\boxed{{}\approx 999.121}
\]
\end{document}

Without any packages, (i.e., with \fbox):

\documentclass{article}
\begin{document}
\[
\fboxsep=1pt\relax
\fbox{$\hat g$} = \sqrt{\frac{4\pi\delta}{\sigma_1\bigl((X+Y)(X-Y)\bigr)^{\sigma_2}}} 
\fbox{${}\approx 999.121$}
\]
\end{document}

enter image description here

FOLLOW UP

I did not originally perceive the 3-sided nature of the applied boxes in the OP's figure. That can be achieved using the current method, with the addition of a \clipbox upon the \fbox. It has been macroed as \boxl{} and \boxr{}:

\documentclass{article}
\usepackage{trimclip}
\newcommand\boxl[1]{\clipbox{0pt 0pt 1.4\fboxrule{} 0pt}{\fbox{$#1{}$}}}
\newcommand\boxr[1]{\clipbox{1.4\fboxrule{} 0pt 0pt 0pt}{\fbox{${}#1$}}}
\begin{document}
\[
\fboxsep=1pt\relax
\boxl{\hat g}
= \sqrt{\frac{4\pi\delta}{\sigma_1\bigl((X+Y)(X-Y)\bigr)^{\sigma_2}}} 
\boxr{\approx 999.121}
\]
\end{document}

enter image description here

1
  • 1
    Load amsmath and use \boxed
    – egreg
    Commented Jan 19, 2017 at 13:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .