diff options
author | Karl Berry <karl@freefriends.org> | 2011-11-23 01:49:43 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-11-23 01:49:43 +0000 |
commit | afcf9657fc327b8852f9a39feebb0fd00fb3a33c (patch) | |
tree | fddc458a5ea10157c05e32c0c961b0efb1758490 /Master/texmf-dist/source/latex/jvlisting | |
parent | b39338a5f1024304ab706fb8d4d59cfc24ba4b8a (diff) |
jvlisting 0.7 (18nov11)
git-svn-id: svn://tug.org/texlive/trunk@24638 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/jvlisting')
-rw-r--r-- | Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx b/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx index d269491bb57..c1f038906a9 100644 --- a/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx +++ b/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx @@ -269,9 +269,16 @@ listings with additional line numbers can be defined as follows: \medbreak -\textbf{Example.} The following code defines a new -\verb|copylisting| environment which does not only typeset the source -code, but also saves a copy in an external file. +\textbf{Example.} The following code defines a new \verb|copylisting| +environment which does not only typeset the source code, but also +saves a copy in an external file. Here we need to be careful in case +the quote character \verb|`| can be present in the listing: by +default, \verb|\listingfont| makes \verb|`| an active character in +order to prevent problems with ligatures, but this fix causes damage +to the output of the \verb|\write| command. To work around this +problem, we can use \verb|\DisableLigatureFix| (defined by the +\verb|jvlisting| package for just this purpose) to temporarily disable +the ligature fix. % \iffalse %</usage> %<*examples|usage> @@ -279,8 +286,8 @@ code, but also saves a copy in an external file. % \begin{macrocode} \newwrite\outfile -\newcommand{\copytypeset}[1]{\immediate\write\outfile{#1}% - \ListingTypesetLine{#1}} +\newcommand{\copytypeset}[1]{\ListingTypesetLine{#1}% + {\DisableLigatureFix\immediate\write\outfile{#1}}} \NewListingEnvironment{copylisting}{1}{\prelistingskip}% {\immediate\openout\outfile=#1\listingfont}{\copytypeset}% {\immediate\closeout\outfile\postlistingskip} @@ -391,7 +398,7 @@ string. % for the package file. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jvlisting}[2011/10/28 v0.6 Formatted Program Listings] +\ProvidesPackage{jvlisting}[2011/11/17 v0.7 Formatted Program Listings] % \end{macrocode} % \subsection{Processing the Lines of Input} @@ -499,14 +506,12 @@ string. % In order to allow for verbatim printing, the macro % \verb|jvl@fixparsing| switches off the special meaning of most % characters. Some care is needed to avoid problems with spaces and -% ligatures like \verb|?`|. +% hyphenation. % \begin{macrocode} {\catcode`\ =\active% \gdef\jvl@obeyspaces{\frenchspacing\catcode`\ =\active\let \space}} -{\catcode`\`=\active\gdef`{\relax\lq}} -\gdef\jvl@noligs{\catcode`\`=\active} \def\jvl@fixparsing{\let\do\@makeother\dospecials\catcode`\^^I=12 - \jvl@obeyspaces\jvl@noligs\hyphenchar\font\m@ne} + \jvl@obeyspaces\hyphenchar\font\m@ne} % \end{macrocode} % Since the \verb|\hyphenchar| setting is global, we save save the @@ -595,7 +600,16 @@ string. \newcount\prelistingpenalty \prelistingpenalty=100 \newcount\listingpenalty \listingpenalty=500 \newcount\postlistingpenalty \postlistingpenalty=-50 -\def\normallistingfont{\normalfont\ttfamily} +% \end{macrocode} +% Finally, we define the default font for use in listings. Some care +% is needed to avoid problems with ligatures like \verb|?`|. We break +% such ligatures by making \verb|`| and active character. For use in +% file listings we also provide \verb|\DisableLigatureFix| to +% (temporarily) disable this fix. +% \begin{macrocode} +{\catcode`\`=\active\gdef`{\relax\lq}% +\gdef\DisableLigatureFix{\def`{\lq}}} +\def\normallistingfont{\normalfont\ttfamily\catcode`\`=\active} % \end{macrocode} % \iffalse %</package> |