# Tag Info

## Hot answers tagged verbatim

17

The error is due to breqn, of course. Only one definition for an active character can be valid at a given time. Since you have a math comma in the section title, this goes in the header and, with that long verbatim, it gets typeset when verbatim is active, which gives a different meaning to the active comma. Here's a minimal example showing the issue. ...

14

The main problem is the breqn math comma being written to the mark used in headings while verbatim is active. which gives a classic fragile command in moving argument cryptic error. \hbox hides this (a better fix allowing the comma to be used normally may be posted later) The fact that luatex segfaults after the runaway argument is a separate lower level ...

7

Try \documentclass[preview]{standalone}% <-- added option "preview" \begin{document} \begin{verbatim} Ciao \end{verbatim} \end{document} This should work ... Edit: Also work with option varwidth. Both options enable to show verbatim environments and as well as displayed math. This is not special described in standalone manual, but seems that for ...

3

You can use \texttt{++} instead, can't you? \documentclass{article} \usepackage{tcolorbox} \definecolor{mycolor}{rgb}{0.122, 0.435, 0.698} \newtcbox{\mybox}{nobeforeafter,colframe=mycolor,colback=mycolor!10!white,boxrule=0.5pt,arc=4pt, boxsep=-3pt,left=6pt,right=6pt,top=6pt,bottom=6pt,tcbox raise base} \begin{document} \mybox{C\texttt{++}} ...

3

I hope, at least this compiles for the O.P. ;-) \tcboxverb is designed for such small boxes with verbatim content. I've added a myboxstyle TikZ style for this. \documentclass{article} \usepackage[most]{tcolorbox} \definecolor{mycolor}{rgb}{0.122, 0.435, 0.698} ...

2

You can't use ¬ and ¦ as “command chars” if you have \usepackage[utf8]{inputenc}. Only one byte characters can be used for the purpose (and not all of them, actually). If you are willing to switch to XeLaTeX or LuaLaTeX, then it's possible.

2

Here's the listings way, without no further configuration, and a tcolorbox listings box, which is configurable for the listing options and other other options for the pure display \documentclass{article} \usepackage{listings} \usepackage[most]{tcolorbox} \begin{document} \begin{lstlisting}[language=C] #include<stdio.h> int main(int argc,char ...

2

I'm not sure this is what you're looking for, but here it is. \documentclass{article} \usepackage{verbatim} \makeatletter \newenvironment{mycode} {\def\@xobeysp{\ }\verbatim\rightskip=0pt plus 6em\relax} {\endverbatim} \makeatother \begin{document} \begin{mycode} aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } aaa { \ } ...

2

There is no \@alltt but like verbatim (and most latex display constructs) alltt is a trivlist so the same settings apply, you just need \preto{\alltt}{\topsep=0pt \partopsep=0pt}

1

Here's a proposition with tcblisting stuff, which is very powerful, but I restricted to the basic usage -- it can be easily extended with a lot of options. Be sure to use the listing only option to the environment, otherwise tcolorbox tries to typeset both code and its LaTeX output. This must fail with of course with things like \documentclass, ...

1

The verbatimbox package allows inline verbatim environments that work directly with the standalone class. Once the box is created with the verbbox environment, it is displayed with \theverbbox. \documentclass{standalone} \usepackage{verbatimbox} \begin{document} \begin{verbbox} Ciao \end{verbbox} \theverbbox \end{document} Example 2 (longer code and ...

Only top voted, non community-wiki answers of a minimum length are eligible