Tag Info

Hot answers tagged

5

There is a case, where \null makes a difference: At the start of a line TeX removes glue and penalties. If \verb starts with an invisible space, then it would be removed: \documentclass{article} \begin{document} \noindent x\\ \begingroup % \let\null\relax \verb| |y \endgroup \end{document} \null as \hbox{} prevents that the space is gobbled ...


4

For fancyvrb, you need to use \VerbatimEnvironment before the \begin{Verbatim}. That tells fancyvrb to detect the name of the current environment, and look for the end of that environment, rather than looking for a literal \end{Verbatim}. You will probably want to use a proper framing package to provide the background color...that way you won't have to ...


3

One possibility using the listings package; since apparently you only want to highlight some specific strings, you can escape to LaTeX and do the coloring there (in my example I used the bera package just to have a mono-spaced font allowing boldface) \documentclass{article} \usepackage{xcolor} \usepackage{listings} \usepackage{bera}% for boldfaced ...


2

Using fragile does not work for me when changing the mode as when generating slides and handouts from separate driver files calling the same content file so I came up with an ugly but effective work around. Let me give an example expanding on the one given above. The driver file to create slides is called contentfile.beamer and has the following: ...


1

First, here is a solution that uses only the xcolor package and the standard verbatim environment. But it is not a new environment, per se, and so does not directly answer the OP's question (for that, see below). \documentclass{article} \usepackage{xcolor} \fboxrule=1pt \begin{document} \setbox0=\hbox{\begin{minipage}{3in} \color{red!90} \begin{verbatim} ...



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