GeneralHow to insert Verbatim environment in \section?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
fractal.generator
Posts: 66
Joined: Tue Oct 07, 2008 9:39 am

How to insert Verbatim environment in \section?

Post by fractal.generator »

Dear all,

I want to insert Verbatim environment in moving arguments such as \section.

Is there a trick to do so?


Thanks in advance.


Hayashi

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to insert Verbatim environment in \section?

Post by gmedina »

Hi,

you could use some of the commands provided by the fancyvrb package, as the following example suggests:

Code: Select all

\documentclass{article}
\usepackage{fancyvrb}

\SaveVerb{myverb}|_verbatim%$|

\begin{document}
\tableofcontents

\section{A section title with \protect\UseVerb{myverb}}

\end{document}
Please refer to the package documentation for further information.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply