diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/jvlisting/README | 50 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/jvlisting/examples.pdf | bin | 32633 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jvlisting/jvlisting.pdf | bin | 185589 -> 193106 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jvlisting/test.tex | 324 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx | 179 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/jvlisting/jvlisting.sty | 127 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkginfo | 2 |
7 files changed, 555 insertions, 127 deletions
diff --git a/Master/texmf-dist/doc/latex/jvlisting/README b/Master/texmf-dist/doc/latex/jvlisting/README new file mode 100644 index 00000000000..0ed384d218c --- /dev/null +++ b/Master/texmf-dist/doc/latex/jvlisting/README @@ -0,0 +1,50 @@ +jvlisting --- a customizable replacement for LaTeX's verbatim class +Copyright (C) 2011 Jochen Voss <voss@seehuhn.de> + +Please send any problem reports and/or suggestions to the the program's +author Jochen Voss <voss@seehuhn.de> + + +INSTALLATION +------------ + +- For simple installation, just move "jvlisting.sty" in a directory + where LaTeX can find it. The jvlisting manual is in the file + "jvlisting.pdf". + +- The regenerate the manual: + + latex jvlisting.dtx + +- To regenerate "jvlisting.sty" and to create an additional file + with examples, you can run the following command: + + tex jvlisting.ins + + After this step, you can try the examples by running the newly + created file "examples.tex" through LaTeX: + + latex examples.tex + +- A list of test cases which I use for debugging can be found in the + file "test.tex". + + +COPYING +------- + +This work may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3 of this license +or (at your option) any later version. The latest version of this +license is in + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. + +This work has the LPPL maintenance status `maintained' and the current +Maintainer of this work is Jochen Voss <voss@seehuhn.de>. + +This work consists of the files jvlisting.dtx and the derived files +jvlisting.sty, jvlisting.ins and examples.tex. diff --git a/Master/texmf-dist/doc/latex/jvlisting/examples.pdf b/Master/texmf-dist/doc/latex/jvlisting/examples.pdf Binary files differdeleted file mode 100644 index dfedc38c17e..00000000000 --- a/Master/texmf-dist/doc/latex/jvlisting/examples.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/jvlisting/jvlisting.pdf b/Master/texmf-dist/doc/latex/jvlisting/jvlisting.pdf Binary files differindex 84c2b709a01..65fd47d333a 100644 --- a/Master/texmf-dist/doc/latex/jvlisting/jvlisting.pdf +++ b/Master/texmf-dist/doc/latex/jvlisting/jvlisting.pdf diff --git a/Master/texmf-dist/doc/latex/jvlisting/test.tex b/Master/texmf-dist/doc/latex/jvlisting/test.tex new file mode 100644 index 00000000000..f863f324205 --- /dev/null +++ b/Master/texmf-dist/doc/latex/jvlisting/test.tex @@ -0,0 +1,324 @@ +\documentclass{article} + +\usepackage[a4paper,margin=1in]{geometry} +\usepackage{jvlisting} +\usepackage{multicol} + +\newcommand{\testbreak}{\vskip0pt plus 10cm\penalty-100\vskip0pt plus-10cm + \bigskip} +\newenvironment{test}[1]{\testbreak\begingroup\textbf{Test~#1}}% + {\par\endgroup} +\newenvironment{testpages}[1]{\parskip0pt + \vskip2pt\hrule\begin{minipage}[c][#1\baselineskip]{1\linewidth}% + \begin{multicols}{2}\parskip1ex}% + {\end{multicols}\end{minipage}\vskip3pt\hrule} +\parindent0pt +\parskip1ex + +\begin{document} + +\begin{center} + \bf Test Cases for the jvlisting Package +\end{center} + + +This document contains test cases to exercise different features of +the \verb|jvlisting| \LaTeX\ package. + + +\begin{test}{1.1} (printing of special characters). + The following two lines should be the same + \setlength{\listingindent}{0pt} + \setlength{\listingskipamount}{0pt} + \begin{listing} + start %\{}~``''$ end + \end{listing} + \verb|start %\{}~``''$ end| +\end{test} + + +\begin{test}{1.2} (ligatures). + The following two lines should be the same + \setlength{\listingindent}{0pt} + \setlength{\listingskipamount}{0pt} + \begin{listing} + start ?` !` end + \end{listing} + \verb|start ?` !` end| +\end{test} + + +\begin{test}{2.1} (indentation). + The following five lines should align horizontally. + \setlength{\listingskipamount}{0pt} + \begin{listing} + |line1| + \end{listing} + \begin{listing} +|line2| + \end{listing} + \begin{listing} |line3| + |line4| + |line5|\end{listing} +\end{test} + + +\begin{test}{2.2} (decreasing indentation level). + The left end of the following lines should align horizontally. + \begin{listing} |line0 + |line1 + |line2 + |line3 + \end{listing} +\end{test} + + +\begin{test}{2.3} (increasing indentation level). + The right end of the following lines should align horizontally. + \begin{listing} + xxline1| + xline2| + line3| + \end{listing} +\end{test} + + +\begin{test}{2.4} (\verb|\listingindent|). + The following two lines should align horizontally. + \setlength{\listingskipamount}{0pt} + +\hskip3cm\texttt{|line1|} + +\setlength{\listingindent}{3cm} +\begin{listing} + |line2| +\end{listing} +\end{test} + + +\begin{test}{3.1} (\verb|\listingskipamount|, part~1). +The lines of the listing should vertically align with the lines to the +right. + +\setlength{\listingskipamount}{0pt} +\begin{minipage}{.4\linewidth} + line1 line1 line1 line1 line1 + \begin{listing} + line2 line2 line2 line2 line2 + line3 line3 line3 line3 line3 + \end{listing} + line4 line4 line4 line4 line4 +\end{minipage}% +\begin{minipage}{.6\linewidth} + line1 \\ + line2 \\ + line3 \\ + line4 +\end{minipage} +\end{test} + + +\begin{test}{3.2} (\verb|\listingskipamount|, part~2). +The lines of the listing should vertically align with the lines to the +right. + +\begin{minipage}{.4\linewidth} + line1 line1 line1 line1 line1 + \setlength{\listingskipamount}{1\baselineskip} + \begin{listing} + line3 line3 line3 line3 line3 + \end{listing} + line5 line5 line5 line5 line5 +\end{minipage}% +\begin{minipage}{.6\linewidth} + line1 \\ + line2 \\ + line3 \\ + line4 \\ + line5 +\end{minipage} +\end{test} + + +\begin{test}{3.3} (no extra parskip before/after listings). +The lines of the listing should vertically align with the lines to the +right. + +\begin{minipage}{.4\linewidth}\parskip12pt +\setlength{\listingskipamount}{0pt} + line1 line1 line1 line1 line1 + \begin{listing} + line2 line2 line2 line2 line2 + line3 line3 line3 line3 line3 + line4 line4 line4 line4 line4 + \end{listing} + line5 line5 line5 line5 line5 + + line7 +\end{minipage}% +\begin{minipage}{.6\linewidth}\parskip1\baselineskip + line1 + + line3 + + line5 + + line7 +\end{minipage} +\end{test} + + +\begin{test}{4.1} (page breaks). +The columns should be of equal height (four rows each). +\setlength{\listingskipamount}{0pt}% +\begin{testpages}{6} + Some text \dots \\ + \dots\ before the listing. + \begin{listing} + line1 + line2 + line3 + line4 + line5 + line6 + \end{listing} +\end{testpages} +\end{test} + + +\begin{test}{4.2} (page breaks, \verb|\listingpenalty|). +The column break should be before \verb|line1|. +\setlength{\listingskipamount}{0pt}% +\listingpenalty=10000 +\begin{testpages}{6} + Some text \dots \\ + \dots\ before the listing. + \begin{listing} + line1 + line2 + line3 + line4 + line5 + line6 + \end{listing} +\end{testpages} +\end{test} + + +\begin{test}{4.3} (page breaks, \verb|\prelistingpenalty|). +The column break should {\em not} be before \verb|line1|. +\setlength{\listingskipamount}{0pt}% +\prelistingpenalty=10000 +\begin{testpages}{3} + Some text \dots \\ + \dots\ before \dots \\ + \dots the listing. + \begin{listing} + line1 + line2 + \end{listing} +\end{testpages} +\end{test} + + +\begin{test}{4.4} (page breaks, \verb|\postlistingpenalty|). +The column break should {\em not} be after \verb|line3|. +\setlength{\listingskipamount}{0pt}% +\postlistingpenalty=10000 +\begin{testpages}{3} + \begin{listing} + line1 + line2 + line3 + \end{listing} + Some text \dots \\ + \dots\ after the listing. +\end{testpages} +\end{test} + + +\begin{test}{5} (\verb|\filelisting|) +The following two listings should look the same. +\newwrite\outfile +\immediate\openout\outfile=tmp.txt +\immediate\write\outfile{line1} +\immediate\write\outfile{line2} +\immediate\write\outfile{line3} +\immediate\closeout\outfile + +\begin{minipage}{.5\linewidth} +\begin{listing} +line1 +line2 +line3 +\end{listing} +\end{minipage}% +\begin{minipage}{.5\linewidth} +\filelisting{tmp.txt} +\end{minipage} +\end{test} + + +\begin{test}{6.1} (\verb|\listingstarthook|, prepending a character) + The following two lines should be the same. + \setlength{\listingskipamount}{0pt}% + \begin{listing} + xtest + \end{listing} + \def\listingstarthook#1{#1x\ignorespaces}% + \begin{listing} + test + \end{listing} +\end{test} + +\begin{test}{6.2} (\verb|\listingstarthook|, prepending a line) + The following listing should have two lines. + \setlength{\listingskipamount}{0pt}% + {\obeylines + \gdef\listingstarthook#1{#1{ }{ }{ }{ }line1 + }}% + \begin{listing} + line2 + \end{listing} + \global\let\listingstarthook=\undefined +\end{test} + +\begin{test}{6.3} (\verb|\listingstarthook|, removing the first line) + The following listing should have two lines. + \setlength{\listingskipamount}{0pt}% + {\obeylines + \gdef\listingstarthook#1#2 + {#1}}% + \begin{listing} + this should not be shown + line1 + line2 + \end{listing} + \global\let\listingstarthook=\undefined +\end{test} + +\begin{test}{6.4} (\verb|\listingstarthook|, conditionally removing the first line) + The following listing should have two lines. + \setlength{\listingskipamount}{0pt}% + {\catcode`\#=12\gdef\hash{#}} + {\obeylines + \gdef\skiptoeol#1#2 + {\noindent\hbox to0pt{\hss (a line was removed)\hskip-\textwidth}#1}} + \def\x#1#2#3{\if#3 \def\next{\x{#1}{#2#3}}\else + \expandafter\ifx\hash#3\def\next{\skiptoeol{#1}}\else + \def\next{#1#2#3}\fi\fi\next} + \def\listingstarthook#1{\x{#1}{}} + \begin{listing} + #line0 + line1 + line2 + \end{listing} + The following listing should have three lines. + \begin{listing} + line0 + line1 + line2 + \end{listing} +\end{test} + +\end{document} diff --git a/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx b/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx index 3796931f94c..162eee6be56 100644 --- a/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx +++ b/Master/texmf-dist/source/latex/jvlisting/jvlisting.dtx @@ -54,12 +54,12 @@ \begin{abstract} This package provides the \LaTeX\ environment \verb|listing|, an alternative to the built-in \verb|verbatim| environment. The - \verb|listing| environment is specially taylored for including + \verb|listing| environment is specially tailored for including listings of computer program source code into documents. The main advantages over the original \verb|verbatim| environment are that \verb|listing| environments automatically fix leading white-space so that the environment and program listing can be indented with - the rest of the \LaTeX\ source code and that \verb|listing| + the rest of the document source and that \verb|listing| environments can easily be customised and extended. \end{abstract} @@ -159,7 +159,7 @@ the \verb|\filelisting| command. \verb|\listingfont|. The default value is \verb|\normallistingfont| which sets up a typewriter-like font. Example: The following command can be used to obtain more compact listings by slightly - reducing the fontsize and the line spacing. + reducing the font size and the line spacing. \begin{xlist} \renewcommand{\listingfont}% {\normallistingfont\small\renewcommand{\baselinestretch}{0.95}} @@ -191,7 +191,7 @@ order, are the fourth argument of \verb|\NewListingEnvironment|); see the \verb|copylisting| environment, below, for an example. \item Commands to execute before the environment is entered - (\textit{e.g.}\ to add vertical whitespace). + (\textit{e.g.}\ to add vertical white space). \item Initialisation commands, executed inside the environment (\textit{e.g.}\ font/margin setup). \item The name of a macro (receiving one argument) which will be used @@ -210,14 +210,15 @@ order, are % \begin{macrocode} \let\listingfont=\normallistingfont -\newcommand{\ListingTypesetLine}[1]{\noindent\hskip\listingindent\strut - #1\par\penalty\listingpenalty} -\newcommand{\prelistingskip}{\endgraf\ifdim\lastskip<\listingskipamount +\newcommand{\ListingTypesetLine}[1]{\ifvmode\penalty\listingpenalty\noindent\fi + \hskip\listingindent\strut#1\par} +\newcommand{\prelistingskip}{\endgraf\ifdim\lastskip>\listingskipamount\else \removelastskip\penalty\prelistingpenalty\vskip\listingskipamount\fi} \newcommand{\postlistingskip}{\endgraf\penalty\postlistingpenalty - \vskip\listingskipamount} + \vskip-\parskip\nobreak\vskip\listingskipamount\noindent} \NewListingEnvironment{listing}{0}{\prelistingskip}% - {\listingfont}{\ListingTypesetLine}{\postlistingskip} + {\listingfont\let\ListingStartHook\listingstarthook}{\ListingTypesetLine}% + {\postlistingskip\ignorespacesafterend} % \end{macrocode} % \iffalse %</listingdef|usage> @@ -314,7 +315,7 @@ and uses them to define a new macro. The arguments, in order, are \verb|\NewFileListingCommand|); see the \verb|\prefixfilelisting| command, below, for an example. \item Commands to execute before the listing is started - (\textit{e.g.}\ to add vertical whitespace). + (\textit{e.g.}\ to add vertical white space). \item Initialisation commands, executed inside the scope of the listing (\textit{e.g.}\ font/margin setup). \item The name of a macro (receiving one argument) which will be used @@ -376,62 +377,73 @@ string. % for the package file. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jvlisting}[2011/06/27 v0.1 Formatted Program Listings] +\ProvidesPackage{jvlisting}[2011/10/17 v0.5 Formatted Program Listings] % \end{macrocode} % \subsection{Processing the Lines of Input} % % We start by provinding a macro \verb|\jvl@iterlines| which can be % used to iterate over all lines of input until a line containing some -% marker is found. The marker is given as the argument \verb|#1| to -% the \verb|\jvl@iterlines| macro. Each line is processed by -% appending the token \verb|\jvl@eol| (used later to recognise the end -% of line) and by prepending \verb|\jvl@dropempty| (for the first and -% last line) or \verb|\jvl@countspaces| (for all other lines). +% marker is found. The marker is given as argument \verb|#1| to the +% \verb|\jvl@iterlines| macro. Each line is processed by prepending +% \verb|\jvl@dropempty| (for the first and last line) or +% \verb|\jvl@tryhook| (for all other lines). % \begin{macrocode} -\def\jvl@iterlines#1{\obeylines - \expandafter\jvl@iterla\expandafter{#1}{\jvl@dropempty}} -{\obeylines -\gdef\jvl@iterla#1#2#3 +\def\jvl@iterlines#1{\expandafter\jvl@iterla\expandafter{#1}{\jvl@dropempty}} +{\obeylines\gdef\jvl@iterla#1#2#3 {\def\jvl@testmarker##1#1{}% \expandafter\def\expandafter\w\expandafter{\jvl@testmarker#3#1}% \ifx\w\empty% - \def\next{#2#3\jvl@eol\jvl@iterla{#1}{\jvl@countspaces}}% + \def\next{#2{\jvl@iterla{#1}{\jvl@tryhook}}#3 + }% \else% - \def\y##1#1##2#1{\jvl@dropempty ##1\jvl@eol\jvl@end##2}% + % special treatment for the last line + \def\y##1#1##2#1{\jvl@dropempty{\jvl@end##2}##1 + }% \def\next{\y#3#1}% \fi\next}} % \end{macrocode} % The next step in processing is to drop the first line (whatever % comes directly after the opening \verb|begin| statement) and the -% last line (whatever comes directly after the closing \verb|end| -% statement), if they consist only of white space. +% last line (whatever comes directly before the closing \verb|end| +% statement), if these lines consist only of white space. +% \begin{macrocode} +\def\jvl@dropempty#1{\jvl@dropa{#1}{}} +{\obeylines\gdef\jvl@dropa#1#2#3{\ifx + #3\def\next{#1}% + \else% + \if#3 \def\next{\jvl@dropa{#1}{#2#3}}\else% + \def\next{\jvl@tryhook{#1}#2#3}\fi% + \fi\next}} +% \end{macrocode} + +% Next we try to apply the \verb|\ListingStartHook|. % \begin{macrocode} -\def\jvl@dropempty{\jvl@dropa{}} -\def\jvl@dropa#1#2{\ifx\jvl@eol#2% - \let\next=\relax +\def\jvl@tryhook#1{\ifx\ListingStartHook\undefined + \def\next{\jvl@countspaces{#1}}% \else - \if#2 \def\next{\jvl@dropa{#1#2}}\else - \def\next{\jvl@countspaces #1#2}\fi - \fi\next} + \def\jvl@trya{\let\ListingStartHook\undefined\jvl@countspaces{#1}}% + \def\next{\ListingStartHook{\jvl@trya}}% + \fi + \next} % \end{macrocode} % Next we determine the indentation level of the current line by % expanding TAB characters and then counting spaces. The result is % stored in the scratch counter \verb|@tempcnta|. % \begin{macrocode} -\def\jvl@countspaces{\@tempcnta=0\jvl@counta} +\def\jvl@countspaces#1{\@tempcnta=0\jvl@counta{#1}} {\catcode`\^^I=12 -\gdef\jvl@counta#1{\expandafter\if\noexpand#1^^I% +\gdef\jvl@counta#1#2{\if^^I#2% \advance\@tempcnta by8\divide\@tempcnta by8\multiply\@tempcnta by8 - \let\next=\jvl@counta + \def\next{\jvl@counta{#1}}% \else - \expandafter\if\noexpand#1 % + \expandafter\if\noexpand#2 % \advance\@tempcnta by1 - \let\next=\jvl@counta + \def\next{\jvl@counta{#1}}% \else - \def\next{\jvl@fixspaces #1} + \def\next{\jvl@fixspaces{#1}#2}% \fi \fi\next}} % \end{macrocode} @@ -441,26 +453,27 @@ string. % and then inserting the required number of spaces (using % \verb|\space|). % \begin{macrocode} -\newcount\jvl@idt \jvl@idt=-1 -\def\jvl@fixspaces#1{\ifx\jvl@eol#1\else - \ifnum\jvl@idt<0 - \jvl@idt=\@tempcnta - \else - \ifnum\@tempcnta<\jvl@idt\jvl@idt=\@tempcnta\fi - \fi\fi\jvl@fixa#1} -\def\jvl@fixa{\ifnum\@tempcnta>\jvl@idt +\newcount\jvl@idt \jvl@idt=\m@ne +{\obeylines\gdef\jvl@fixspaces#1#2{\ifx + #2\else% + \ifnum\jvl@idt<0% + \jvl@idt=\@tempcnta% + \else% + \ifnum\@tempcnta<\jvl@idt\jvl@idt=\@tempcnta\fi% + \fi\fi\jvl@fixa{#1}#2}} +\def\jvl@fixa#1{\ifnum\@tempcnta>\jvl@idt \advance\@tempcnta by\m@ne - \def\next{\jvl@fixa\space}% + \def\next{\jvl@fixa{#1}\space}% \else - \let\next\jvl@output + \def\next{\jvl@output{#1}}% \fi\next} % \end{macrocode} -% Finally, by matching the \verb|jvl@eol| inserted by the -% \verb|\jvl@iterlines| function above, we can apply the output -% function \verb|\jvl@typeset| to the processed line. +% Finally, we apply the output function \verb|\jvl@typeset| to the +% processed line and starting processing of the next line. % \begin{macrocode} -\def\jvl@output#1\jvl@eol{\jvl@typeset{#1}} +{\obeylines\gdef\jvl@output#1#2 + {\jvl@typeset{#2}#1}} % \end{macrocode} % The symbol \verb|\jvl@typeset| will be defined inside the % \verb|\begin{listing}| command; since neested listings are not @@ -469,11 +482,34 @@ string. % \subsection{Defining Listing Environments} % +% 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|?`|. +% \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} +% \end{macrocode} + +% Since the \verb|\hyphenchar| setting is global, we save save the +% value of \verb|hyphenchar| before entering the listing environment +% end restore the original setting at the end. +% \begin{macrocode} +\newcount\jvl@tmphyphenchar +\def\jvl@begingroup{\jvl@tmphyphenchar=\hyphenchar\font + \begingroup \parskip0pt \advance\leftskip by\@totalleftmargin} +\def\jvl@endgroup{\endgroup \hyphenchar\font=\jvl@tmphyphenchar} +% \end{macrocode} + % Given the code above, we can now define the % \verb|\NewListingEnvironment| macro. Some care is needed when -% constructing the marker for use in the \verb|\jvl@iterlines| method, +% constructing the marker for use in the \verb|\jvl@iterlines| macro, % because the text we need to match uses category code 12 (``other'') -% for all characters. +% for the characters \verb|\|, \verb|{| and~\verb|}|. % \begin{macrocode} \begingroup \catcode`|=0 \catcode`[=1 \catcode`]=2 @@ -481,14 +517,15 @@ string. |gdef|jvl@makemarker#1[% |expandafter|gdef|csname jvl@@#1marker|endcsname[\end{#1}]] |endgroup -\def\jvl@setup{\begingroup - \parskip0pt \advance\leftskip by\@totalleftmargin - \let\do\@makeother\dospecials \catcode`\^^I=12} \def\NewListingEnvironment#1#2#3#4#5#6{\jvl@makemarker{#1}% - \expandafter\newcommand\csname #1\endcsname[#2]{#3\jvl@setup + \expandafter\newcommand\csname #1\endcsname[#2]{#3\jvl@begingroup #4\def\jvl@end{\end{#1}}\let\jvl@typeset=#5% - \expandafter\jvl@iterlines\csname jvl@@#1marker\endcsname}% - \expandafter\gdef\csname end#1\endcsname{\endgroup #6}} + \jvl@fixparsing\obeylines + \expandafter\def\expandafter\jvl@start\expandafter{% + \expandafter\jvl@iterlines\csname jvl@@#1marker\endcsname}% + \let\next\jvl@start + \next}% + \expandafter\gdef\csname end#1\endcsname{\jvl@endgroup #6}} % \end{macrocode} % \subsection{Reading Listings from File} @@ -496,7 +533,7 @@ string. % When reading listings from a file, we get the lines terminated by % \verb|^^M| characters. The following function is a replacement for % \verb|\jvl@iterlines|, used to read lines from a file and to strip -% of the trailing \verb|^^M| characters: +% the trailing \verb|^^M| characters: % \begin{macrocode} \newread\jvl@fileinput \def\jvl@iterfile{\read\jvl@fileinput to\l @@ -507,7 +544,9 @@ string. \let\next\jvl@iterfile \fi\next} {\catcode`\^^M=12 -\gdef\jvl@iterfa#1^^M{\jvl@countspaces#1\jvl@eol}} +\gdef\jvl@iterfa#1^^M{\jvl@iterfb{#1}}} +{\obeylines\gdef\jvl@iterfb#1{\jvl@tryhook{\relax}#1 + }} % \end{macrocode} % % In analogy to \verb|\NewListingEnvironment|, the following macro is @@ -522,11 +561,13 @@ string. least 1. }% \fi - \newcommand{#1}[#2]{#3\jvl@setup\catcode`\^^M=12 + \newcommand{#1}[#2]{#3\jvl@begingroup #4\let\jvl@typeset=#5% + \jvl@fixparsing\catcode`\^^M=12 \openin\jvl@fileinput=##1\jvl@iterfile\closein\jvl@fileinput - \endgroup #6 - } + \jvl@endgroup#6% + \ignorespaces + }% } % \end{macrocode} @@ -540,17 +581,7 @@ string. \newcount\prelistingpenalty \prelistingpenalty=100 \newcount\listingpenalty \listingpenalty=500 \newcount\postlistingpenalty \postlistingpenalty=-50 -% \end{macrocode} - -% Finally, we need to define the font for use in listing environments. -% Some care is needed to avoid problems with spaces and ligatures. -% \begin{macrocode} -{\catcode`\ =\active% -\gdef\jvl@obeyspaces{\frenchspacing\catcode`\ =\active\let \space}} -{\catcode`\`=\active\gdef`{\relax\lq}} -\gdef\jvl@noligs{\catcode`\`=\active} -\def\normallistingfont{\normalfont\ttfamily - \jvl@obeyspaces\jvl@noligs\hyphenchar\font-1} +\def\normallistingfont{\normalfont\ttfamily} % \end{macrocode} % \iffalse %</package> diff --git a/Master/texmf-dist/tex/latex/jvlisting/jvlisting.sty b/Master/texmf-dist/tex/latex/jvlisting/jvlisting.sty index 7794887939a..dffc5378215 100644 --- a/Master/texmf-dist/tex/latex/jvlisting/jvlisting.sty +++ b/Master/texmf-dist/tex/latex/jvlisting/jvlisting.sty @@ -26,58 +26,81 @@ %% jvlisting.sty, jvlisting.ins and examples.tex. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jvlisting}[2011/06/27 v0.1 Formatted Program Listings] +\ProvidesPackage{jvlisting}[2011/10/17 v0.5 Formatted Program Listings] -\def\jvl@iterlines#1{\obeylines - \expandafter\jvl@iterla\expandafter{#1}{\jvl@dropempty}} -{\obeylines -\gdef\jvl@iterla#1#2#3 +\def\jvl@iterlines#1{\expandafter\jvl@iterla\expandafter{#1}{\jvl@dropempty}} +{\obeylines\gdef\jvl@iterla#1#2#3 {\def\jvl@testmarker##1#1{}% \expandafter\def\expandafter\w\expandafter{\jvl@testmarker#3#1}% \ifx\w\empty% - \def\next{#2#3\jvl@eol\jvl@iterla{#1}{\jvl@countspaces}}% + \def\next{#2{\jvl@iterla{#1}{\jvl@tryhook}}#3 + }% \else% - \def\y##1#1##2#1{\jvl@dropempty ##1\jvl@eol\jvl@end##2}% + % special treatment for the last line + \def\y##1#1##2#1{\jvl@dropempty{\jvl@end##2}##1 + }% \def\next{\y#3#1}% \fi\next}} -\def\jvl@dropempty{\jvl@dropa{}} -\def\jvl@dropa#1#2{\ifx\jvl@eol#2% - \let\next=\relax +\def\jvl@dropempty#1{\jvl@dropa{#1}{}} +{\obeylines\gdef\jvl@dropa#1#2#3{\ifx + #3\def\next{#1}% + \else% + \if#3 \def\next{\jvl@dropa{#1}{#2#3}}\else% + \def\next{\jvl@tryhook{#1}#2#3}\fi% + \fi\next}} + +\def\jvl@tryhook#1{\ifx\ListingStartHook\undefined + \def\next{\jvl@countspaces{#1}}% \else - \if#2 \def\next{\jvl@dropa{#1#2}}\else - \def\next{\jvl@countspaces #1#2}\fi - \fi\next} + \def\jvl@trya{\let\ListingStartHook\undefined\jvl@countspaces{#1}}% + \def\next{\ListingStartHook{\jvl@trya}}% + \fi + \next} -\def\jvl@countspaces{\@tempcnta=0\jvl@counta} +\def\jvl@countspaces#1{\@tempcnta=0\jvl@counta{#1}} {\catcode`\^^I=12 -\gdef\jvl@counta#1{\expandafter\if\noexpand#1^^I% +\gdef\jvl@counta#1#2{\if^^I#2% \advance\@tempcnta by8\divide\@tempcnta by8\multiply\@tempcnta by8 - \let\next=\jvl@counta + \def\next{\jvl@counta{#1}}% \else - \expandafter\if\noexpand#1 % + \expandafter\if\noexpand#2 % \advance\@tempcnta by1 - \let\next=\jvl@counta + \def\next{\jvl@counta{#1}}% \else - \def\next{\jvl@fixspaces #1} + \def\next{\jvl@fixspaces{#1}#2}% \fi \fi\next}} -\newcount\jvl@idt \jvl@idt=-1 -\def\jvl@fixspaces#1{\ifx\jvl@eol#1\else - \ifnum\jvl@idt<0 - \jvl@idt=\@tempcnta - \else - \ifnum\@tempcnta<\jvl@idt\jvl@idt=\@tempcnta\fi - \fi\fi\jvl@fixa#1} -\def\jvl@fixa{\ifnum\@tempcnta>\jvl@idt +\newcount\jvl@idt \jvl@idt=\m@ne +{\obeylines\gdef\jvl@fixspaces#1#2{\ifx + #2\else% + \ifnum\jvl@idt<0% + \jvl@idt=\@tempcnta% + \else% + \ifnum\@tempcnta<\jvl@idt\jvl@idt=\@tempcnta\fi% + \fi\fi\jvl@fixa{#1}#2}} +\def\jvl@fixa#1{\ifnum\@tempcnta>\jvl@idt \advance\@tempcnta by\m@ne - \def\next{\jvl@fixa\space}% + \def\next{\jvl@fixa{#1}\space}% \else - \let\next\jvl@output + \def\next{\jvl@output{#1}}% \fi\next} -\def\jvl@output#1\jvl@eol{\jvl@typeset{#1}} +{\obeylines\gdef\jvl@output#1#2 + {\jvl@typeset{#2}#1}} + +{\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} + +\newcount\jvl@tmphyphenchar +\def\jvl@begingroup{\jvl@tmphyphenchar=\hyphenchar\font + \begingroup \parskip0pt \advance\leftskip by\@totalleftmargin} +\def\jvl@endgroup{\endgroup \hyphenchar\font=\jvl@tmphyphenchar} \begingroup \catcode`|=0 \catcode`[=1 \catcode`]=2 @@ -85,14 +108,15 @@ |gdef|jvl@makemarker#1[% |expandafter|gdef|csname jvl@@#1marker|endcsname[\end{#1}]] |endgroup -\def\jvl@setup{\begingroup - \parskip0pt \advance\leftskip by\@totalleftmargin - \let\do\@makeother\dospecials \catcode`\^^I=12} \def\NewListingEnvironment#1#2#3#4#5#6{\jvl@makemarker{#1}% - \expandafter\newcommand\csname #1\endcsname[#2]{#3\jvl@setup + \expandafter\newcommand\csname #1\endcsname[#2]{#3\jvl@begingroup #4\def\jvl@end{\end{#1}}\let\jvl@typeset=#5% - \expandafter\jvl@iterlines\csname jvl@@#1marker\endcsname}% - \expandafter\gdef\csname end#1\endcsname{\endgroup #6}} + \jvl@fixparsing\obeylines + \expandafter\def\expandafter\jvl@start\expandafter{% + \expandafter\jvl@iterlines\csname jvl@@#1marker\endcsname}% + \let\next\jvl@start + \next}% + \expandafter\gdef\csname end#1\endcsname{\jvl@endgroup #6}} \newread\jvl@fileinput \def\jvl@iterfile{\read\jvl@fileinput to\l @@ -103,7 +127,9 @@ \let\next\jvl@iterfile \fi\next} {\catcode`\^^M=12 -\gdef\jvl@iterfa#1^^M{\jvl@countspaces#1\jvl@eol}} +\gdef\jvl@iterfa#1^^M{\jvl@iterfb{#1}}} +{\obeylines\gdef\jvl@iterfb#1{\jvl@tryhook{\relax}#1 + }} \def\NewFileListingCommand#1#2#3#4#5#6{% \ifnum#2<1 \PackageError{jvlisting}{% @@ -113,11 +139,13 @@ least 1. }% \fi - \newcommand{#1}[#2]{#3\jvl@setup\catcode`\^^M=12 + \newcommand{#1}[#2]{#3\jvl@begingroup #4\let\jvl@typeset=#5% + \jvl@fixparsing\catcode`\^^M=12 \openin\jvl@fileinput=##1\jvl@iterfile\closein\jvl@fileinput - \endgroup #6 - } + \jvl@endgroup#6% + \ignorespaces + }% } \newskip\listingskipamount \listingskipamount=1ex @@ -125,23 +153,18 @@ \newcount\prelistingpenalty \prelistingpenalty=100 \newcount\listingpenalty \listingpenalty=500 \newcount\postlistingpenalty \postlistingpenalty=-50 - -{\catcode`\ =\active% -\gdef\jvl@obeyspaces{\frenchspacing\catcode`\ =\active\let \space}} -{\catcode`\`=\active\gdef`{\relax\lq}} -\gdef\jvl@noligs{\catcode`\`=\active} -\def\normallistingfont{\normalfont\ttfamily - \jvl@obeyspaces\jvl@noligs\hyphenchar\font-1} +\def\normallistingfont{\normalfont\ttfamily} \let\listingfont=\normallistingfont -\newcommand{\ListingTypesetLine}[1]{\noindent\hskip\listingindent\strut - #1\par\penalty\listingpenalty} -\newcommand{\prelistingskip}{\endgraf\ifdim\lastskip<\listingskipamount +\newcommand{\ListingTypesetLine}[1]{\ifvmode\penalty\listingpenalty\noindent\fi + \hskip\listingindent\strut#1\par} +\newcommand{\prelistingskip}{\endgraf\ifdim\lastskip>\listingskipamount\else \removelastskip\penalty\prelistingpenalty\vskip\listingskipamount\fi} \newcommand{\postlistingskip}{\endgraf\penalty\postlistingpenalty - \vskip\listingskipamount} + \vskip-\parskip\nobreak\vskip\listingskipamount\noindent} \NewListingEnvironment{listing}{0}{\prelistingskip}% - {\listingfont}{\ListingTypesetLine}{\postlistingskip} + {\listingfont\let\ListingStartHook\listingstarthook}{\ListingTypesetLine}% + {\postlistingskip\ignorespacesafterend} \NewFileListingCommand{\filelisting}{1}{\prelistingskip}% {\listingfont}{\ListingTypesetLine}{\postlistingskip} diff --git a/Master/tlpkg/bin/tlpkginfo b/Master/tlpkg/bin/tlpkginfo index 0848ff94558..b072fc96b67 100755 --- a/Master/tlpkg/bin/tlpkginfo +++ b/Master/tlpkg/bin/tlpkginfo @@ -18,7 +18,7 @@ sub main { # erroneous or problematic tds files (warn Robin about them) # list format: pkg1|pkg2|etc $erroneous_tds = join ("|", - qw(engpron fmtcount imtekda purifyeps spanish svn-multi + qw(ccaption engpron fmtcount imtekda purifyeps spanish svn-multi thailatex tugboat tufte-latex xetexref xtab), qw(lastpage papermas papertex undolabl)); |