2

I understand that \boxed{} would give a box surrounding a math. However, I want to make answer this way instead of full rectangular box.

Is there a way to make this command to, say, \halfboxed{x=3}?

Thanks, enter image description here

4

You might like tcbhighmath from the tcolorbox package:

enter image description here

Here's a complete MWE:

% arara: pdflatex
\documentclass{article}

\usepackage[most]{tcolorbox} 

\begin{document}

\[
\tcbhighmath[frame hidden,colback=white,enhanced,overlay unbroken={%
\draw[thick,red,double] (interior.north east)--(interior.south east)--(interior.south west);
},]{x=3}
\]

\end{document}

Of course, you'd probably prefer to use something like:

\tcbset{Panha/.style={frame hidden,colback=white,enhanced,overlay unbroken={%
\draw[thick,red,double] (interior.north east)--(interior.south east)--(interior.south west);}}}

in your preamble, so that you can simply use \tcbhighmath[Panha]{x=3} in the document, for example:

% arara: pdflatex
\documentclass{article}

\usepackage[most]{tcolorbox} 

\tcbset{Panha/.style={frame hidden,colback=white,enhanced,overlay unbroken={%
\draw[thick,red,double] (interior.north east)--(interior.south east)--(interior.south west);}}}

\begin{document}

\[
\tcbhighmath[Panha]{x=3}
\]

\end{document}

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.