How to draw a dotted rectangle around part of equation?
1,570
Solution 1
The dashbox package can be tweaked to do what you want:
\documentclass{article}
\usepackage{dashbox}
\newcommand\emptydottedbox{%
\setlength{\dashlength}{1pt}% % length of dash + gap
\setlength{\dashdash}{0.5pt}% % length of dash
\setlength{\fboxrule}{0.5pt}% % width of line
\setlength{\fboxsep}{0pt}% % separation between box and inner content
\dbox{\ensuremath{\phantom{x}}}%
}
\begin{document}
\[
\int_{\emptydottedbox}^{\emptydottedbox} \emptydottedbox
\]
\end{document}
Solution 2
With tikz you can draw these boxes:
\documentclass{article}
\usepackage{tikz}
\newcommand{\smallbox}{\begin{tikzpicture}
\draw[thick,dotted] (0,0) rectangle
(0.3, 0.3);
\end{tikzpicture}
}
\newcommand{\medbox}{\begin{tikzpicture}
\draw[thick,dotted] (0,0) rectangle
(0.5, 0.5);
\end{tikzpicture}
}
\begin{document}
\[\int_{\smallbox}^{\smallbox} {\medbox} \]
\end{document}
Maybe you need to fiddle a bit with the dimensions and/or the spacing.
Related videos on Youtube
Author by
Denis Sletkov
Updated on November 18, 2020Comments

Denis Sletkov over 1 year
I need to produce a following image:
I found a
\boxdot
symbol in ams package but can not find any dotted box.
John Kormylo over 5 years\boxdot (from amssymb) is a box with a dot inside. The easiest way to create a dotted box of a given size is to use TikZ (or possibly graphicx if you have an image).

shadowtalker over 5 yearsSo that's how Microsoft Word makes those boxes in the equation editor!


Torbjørn T. over 5 yearsYou might want some more
%
, trya\emptydottedbox b
outside math mode. 
Torbjørn T. over 5 yearsYou could generalize it, with e.g.
\newcommand\DotBox[1][0.3]{\tikz\draw[thick,dotted] (0,0) rectangle (#1,#1);}
. (And by the way, you also have a spurious space, add a%
right after\end{tikzpicture}
, or move the closing brace up.) 
Robert Seifert over 5 years@TorbjørnT. you're right, thanks. Though it probably won't be used outsite math mode.