Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to draw a box around verbatim text in LaTeX

📅 2012-Dec-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ box, fancyvrb, frame, latex, verbatim ⬩ 📚 Archive

It is possible to draw a box around text inside a verbatim environment by using the fancyvrb package. Change the environment to Verbatim (note the uppercase V) and set the frame parameter to single.

Here is a simple example:

\usepackage{fancyvrb}

% ...

\begin{Verbatim}[frame=single]
A
bit
of
Verbatim
text
\end{Verbatim}

Tried with: MikTeX 2.9 and Windows 8 Pro x64


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email