# Dotted frame around the text

I need to do a dotted frame, something this one:

Is it possible to do?

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jun 23 '15 at 8:40

You can use TikZ:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[draw,dotted] {My text};
\end{tikzpicture}

\end{document}


Zooming in your example picture reveals that you might wish a “dashed” instead of a “dotted” frame. In this case, just replace dotted with dashed:

EDITED to improve box corners. I use dot \cleaders to make the dots. The optional argument to \dotbox controls the dot spacing of the box border.

I added the 3rd example, in case the gray frame in the OP's image is actually part of the desired box, rather than just the clip field from the photo editor.

\documentclass{article}
\usepackage{verbatimbox,stackengine,graphicx,lipsum,xcolor}
\newlength\replength
\newsavebox\dtbx
\def\wdbox{\kern-1pt\makebox[\dimexpr\wd\dtbx+1pt]{\tdotfill\hfil}\kern1pt}
\def\htboxraw{\makebox[\dimexpr\ht\dtbx+\dp\dtbx+3pt]{\tdotfill\hfil}}
\def\htbox{\raisebox{\dimexpr-\dp\dtbx-2pt}{\rotatebox{90}{\htboxraw}}}
\newcommand\dotbox[2][3pt]{%
\setlength\replength{#1}%
\savebox\dtbx{#2\kern1pt}%
\stackunder[-.6pt]{\stackon[-1.2pt]{\htbox\usebox{\dtbx}\htbox}{\wdbox}}{\wdbox}%
}
\begin{document}
\begin{verbbox}[\strut]
print *, 'Hello World'
stop
end
\end{verbbox}
\dotbox{\theverbbox}

\dotbox[2pt]{\parbox{3in}{\lipsum[1]}}

{\fboxsep=1pt\fboxrule=10pt
\textcolor{black!10}{\fbox{\color{black}\dotbox{\theverbbox}}}}
\end{document}