# tcolorbox breaks the verbatim definition of ltugboat documentclass

This code:

\documentclass{ltugboat}
\usepackage{tcolorbox}

\begin{document}
\begin{verbatim}[\small]
\documentclass{article}
\usepackage{tikzduck}
\begin{document}
\begin{tikzpicture}
\duck
\end{tikzpicture}
\end{document}
\end{verbatim}
\end{document}

produces this output:

whereas if you comment out \usepackage{tcolorbox}, the output is correct:

• tcolorbox loads the verbatim package and this redefine verbatim. Probably it would be the best to ask @barbarabeeton how to handle this. – Ulrike Fischer Aug 10 '17 at 21:15

The [\small] is a feature of ltugboat verbatim. If you use a different verbatim, you have to get rid of it. At least, I can't picture a different solution, sorry.

Instead, you can use something like

{\small \begin{verbatim}
...
\end{verbatim}
}

But I would guess you already knew that.

• I knew about that but it didn't come to my mind! Thank you! – CarLaTeX Aug 11 '17 at 2:50
• It should be {\par\small\begin{verbatim}, otherwise \small will have effect on the paragraph before the verbatim material, unless a blank line is added in between. – egreg Aug 11 '17 at 9:04

I don't know how much tcolorbox relies on verbatim as defined by the homonym package that it loads, so something like

\documentclass{ltugboat}

\let\ltverbatim\verbatim
\let\ltendverbatim\endverbatim

\usepackage{tcolorbox}

\let\verbatim\ltverbatim
\let\endverbatim\ltendverbatim

may possibly yield problems when embedding verbatim material in tcolorbox environments.

A different approach is to use fancyvrb for your verbatim (non tcolorbox) material:

\documentclass{ltugboat}

\usepackage{tcolorbox}
\usepackage{fancyvrb}

\usepackage{lipsum}

\begin{document}

\lipsum*[2]
\begin{Verbatim}[fontsize=\small]
\documentclass{article}
\usepackage{tikzduck}
\begin{document}
\begin{tikzpicture}
\duck
\end{tikzpicture}
\end{document}
\end{Verbatim}
\lipsum[3-5]

\end{document}

(avoid indenting verbatim). You can also set \small size by default with \fvset{fontsize=\small} in the preamble.

• Thank you, yours is a very good solution! However, I still prefer to use Karl Berry's one because he is the manager of ltugboat documentclass. I'll look at TUGboat to see which is the standard for indentation. Ciao :) – CarLaTeX Aug 11 '17 at 8:57