Text Formattingkeep indenting for source code with verbatim?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
albinoblacksheep
Posts: 12
Joined: Fri Mar 05, 2010 7:53 pm

Re: keep indenting for source code with verbatim?

Post by albinoblacksheep »

Hi!

Thank you for the tip! I would have never found that without you I guess.
If anyone encounters the same problem as I did, here is the solution:

1) include the moreverb package: \usepackage{moreverb}
2) use \begin{verbatimtab}[4] and \end{verbatimtab}
3) C/C++/Flash... source code goes in between.

The number [4] is the tabbing width. Change it to your personal needs.

Thanks again frabjous for your great help
Sebastian

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

VictorEijkhout
Posts: 1
Joined: Wed Jan 05, 2011 8:13 pm

keep indenting for source code with verbatim?

Post by VictorEijkhout »

Old verbatim:

Code: Select all

\catcode`\@=11
\let \saveverbatime \@xverbatim
\def \@xverbatim {\leftskip = 1cm\relax\saveverbatime}
\catcode`\@=12
verbatim style:

Code: Select all

\makeatletter 
\def\verbatim@startline{\verbatim@line{\leavevmode\kern20pt\relax}} 
\makeatother
Post Reply