Dashed version of \boxed
You can use the small dashbox
package:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{dashbox}
\newcommand\dboxed[1]{\dbox{\ensuremath{#1}}}
\begin{document}
\[ \dboxed{t\cdot u}\iff\dboxed{t} * \dboxed{u}\]%
\end{document}
A possibility with tcolorbox
(Description below)
\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\tcbox[colback=white,boxrule=0pt,enhanced jigsaw,borderline horizontal={1pt}{0pt}{dashed},borderline vertical={1pt}{0pt}{dashed}]{$E=mc^2$}
\end{document}
Easier version
tcolorbox
provides nice features for boxes and frames etc. I've defined a \dashedbox
command, that has a dashed frame of 1pt
width and white background (colback=white), the usual frame is not drawn (boxrule=0pt
). In order to provide equal heights, a equal height group is used.
All settings can be overruled by using the optional parameter of \dashedbox
(as have been done for the second example!)
\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcbox{\dashedbox}[1][]{equal height group=dashedbox,
nobeforeafter,
colback=white,
boxrule=0pt,
enhanced jigsaw,
borderline horizontal={1pt}{0pt}{dashed},
borderline vertical={1pt}{0pt}{dashed},
#1
}
\begin{document}
\dashedbox{$E=mc^2$} \dashedbox[colback=yellow]{$E^2=(mc^2)^2 + (pc)^2$}
\end{document}
Next update
\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcbox{\dashedbox}[1][]{
math upper,
baseline=0.4\baselineskip,
equal height group=dashedbox,
nobeforeafter,
colback=white,
boxrule=0pt,
enhanced jigsaw,
boxsep=0pt,
top=2pt,
bottom=2pt,
left=2pt,
right=2pt,
borderline horizontal={0.5pt}{0pt}{dashed},
borderline vertical={0.5pt}{0pt}{dashed},
drop lifted shadow,
#1
}
\begin{document}
Einstein said: $\dashedbox{E=mc^2} \; \dashedbox[colback=yellow]{E^2=(mc^2)^2 + (pc)^2}$
\end{document}