I have the following text box:

\documentclass{article}
\usepackage{xcolor}
\usepackage{fancybox}

\makeatletter
\setbox\@fancybox\hbox{\fbox{#1}}%
\leavevmode\vbox{%
\offinterlineskip
\vskip\dimexpr-\dimen@+0.5\fboxrule\relax
\makeatother

\begin{document}

\end{document}


How should I do to customize it equal to the following figure:

• Will all the boxes contain code listings? Oct 10 '15 at 16:09
• Hello Gonzalo Medina, in fact must enter a String with the text very large identical to the figure with the Boolean operators in bold. Can you help me? Oct 10 '15 at 18:40

No shadowbox solution (admitted) but I suggest the tcolorbox package and its extreme bunch of options

\documentclass{article}
\usepackage{xcolor}
\usepackage{fancybox}

\usepackage[most]{tcolorbox}

\makeatletter
\setbox\@fancybox\hbox{\fbox{#1}}%
\leavevmode\vbox{%
\offinterlineskip
\vskip\dimexpr-\dimen@+0.5\fboxrule\relax
\makeatother

\begin{document}

String1 = String2
\end{tcolorbox}

And as listing box:

String1 = String2

\end{tcblisting}

\end{document}


• Hello Christian Hupfer, that's exactly what I needed, but how should I do to remove the gray background of the text box? The rest is perfect. Oct 10 '15 at 17:59
• @ricardoramos: You can use the colback=white option (replace the colorname by your favourite one) in the tcolorbox or tcblisting options. (Sorry for the late answer -- I was at the cinema ;-)
– user31729
Oct 10 '15 at 21:02
• Thank​ you so much for your help Christian Hupfer, now it's all working! Oct 10 '15 at 21:04
• Key point for future readers. Don't bother with the big markup in the preamble. You just require \usepackage{tcolorbox} and the part after the begin document that uses tcolorbox. Other preamble markup is from OP's original failed effort to us fancybox. Dec 4 '20 at 2:28