[texhax] The Listings package, with Perl
Heiko Oberdiek
heiko.oberdiek at googlemail.com
Mon Feb 13 04:28:24 CET 2012
On Sun, Feb 12, 2012 at 07:57:55PM -0700, Gordon Haverland wrote:
> I am generating a document where I am encorporating source code
> listings of Perl (with POD) in the document.
>
> The preamble doesn't like printpod=... or podcomment=... at all.
A new language can be defined that sets these entries:
\documentclass{article}
\usepackage{listings}
\lstdefinelanguage{PodPerl}[]{Perl}{podcomment,printpod}[pod]
\begin{document}
\begin{lstlisting}[language=PodPerl]
#!/usr/bin/env perl
use strict;
$^W=1;
my $title = "Hello World";
print $title;
1;
__DATA__
=head1 NAME
My title with ' as single quote.
...
\end{lstlisting}
\end{document}
> In a section of POD in the code, as soon as a single quote comes
> up, output goes screwy. Every space becomes that square "U" to
> explicitly show a space. Yes, changing doesn't to does not, and so
> on fixes the problems.
Also the example above shows the problem.
Perhaps a bug?
If you have a POD section without Perl code, you could use
deletestring=[b]", deletestring=[b]'
Yours sincerely
Heiko Oberdiek
More information about the texhax
mailing list