1

I would like to have a block of verbatim text in a figure, small, centered, and blue. By using the verbatimbox package I have managed to get three of four. If, however, I use \color{blue} in the options to \begin{verbox}, the colour does not change. If I place the command in the figure, only the first line changes, and the caption. Any suggestions how I can get this to work? I attach a small example file.

\documentclass[12pt]{article}
\usepackage{verbatimbox}
\usepackage[svgnames]{xcolor}

\begin{document}
\begin{verbbox}[\small\color{blue}]
  A B C D E F G H I J K L M N O P Q R S
A 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
B 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
C 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
D 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
E 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0
F 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(stuff deleted)
attr(,"class")
[1] "mst"
\end{verbbox}

\begin{figure}
\centering
\theverbbox
\caption{Output from the \texttt{mst()} command.\label{MSTMat}}
\end{figure}

\end{document}

Many thanks in advance, Kris.

1 Answer 1

1

You can use fancyvrb instead:

\documentclass[12pt]{article}
\usepackage{fancyvrb}
\usepackage[svgnames]{xcolor}

\begin{document}

\begin{figure}
\centering
\begin{BVerbatim}[fontsize=\small,formatcom=\color{blue}]
  A B C D E F G H I J K L M N O P Q R S
A 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
B 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
C 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
D 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
E 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0
F 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(stuff deleted)
attr(,"class")
[1] "mst"
\end{BVerbatim}
\caption{Output from the \texttt{mst()} command.\label{MSTMat}}
\end{figure}

\end{document}

enter image description here

1
  • Brilliant. Exactly what I wanted! Many thanks, Kris. Apr 30, 2020 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .