diff options
author | Karl Berry <karl@freefriends.org> | 2008-05-19 00:43:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-05-19 00:43:52 +0000 |
commit | d3f343ee35e87efabdba0a81fde2208bcc8d63ce (patch) | |
tree | 52311bb024fe5f46021e903727fb4a735933ad74 /Master/texmf-dist/source | |
parent | c0b73351a96be22cbc2192b8cd8c4ace184c3fd7 (diff) |
fancyvrb update (13may08)
git-svn-id: svn://tug.org/texlive/trunk@8226 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/fancyvrb/README.contrib | 57 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/fancyvrb/fancyvrb.dtx | 135 |
2 files changed, 120 insertions, 72 deletions
diff --git a/Master/texmf-dist/source/latex/fancyvrb/README.contrib b/Master/texmf-dist/source/latex/fancyvrb/README.contrib deleted file mode 100644 index b3f2966f8c8..00000000000 --- a/Master/texmf-dist/source/latex/fancyvrb/README.contrib +++ /dev/null @@ -1,57 +0,0 @@ - ------------------------------------- - | `fvrb-ex' | - | Version 1.7 | - | March 27, 1998 | - | | - | Denis Girou (CNRS/IDRIS - France) | - | <Denis.Girou@idris.fr> | - ------------------------------------- - - - This package, built above the `fancyvrb' one (from Timothy van Zandt), -offer several kinds of the so-called "example" environments to format some -code both in "verbatim" mode and in the "normal" way, below or on the side. -The advantage of such environments is that the code itself is included only -one time in the source code, which allow to be sure of the consistence of the -two versions shown. - - Some other kinds of such environments are specially devoted to graphics, -allowing to give the size of them. It is also possible in this case to draw -also a grid. - - Warning! - -------- - - * You must be aware that it has been reported that this package doesn't work -at all on some platforms, due to the way the 8 bits characters are managed by -some TeX systems. - You can make first the following test (courtesy Sebastian Rahtz): - -\documentclass{article} -\usepackage{moreverb} % CTAN/macros/latex/contrib/supported/moreverb -\begin{document} -\begin{verbatimwrite}{test.txt} - £hello -\end{verbatimwrite} -\end{document} - - If you got in the file "test.txt" not the exact input line but ^^a3 for -the first character, this package has no change to really work for you... - - Just try to position (courtesy Thomas Esser) LC_CTYPE=C if your system -accept it and retry the preceding test. - - * We suppose here that you already know the `fancyvrb' package. If not, look -at it own documentation! - - * The standard `color' package must be available, with a correct "color.cfg" -file defining the dvi converter that must be used. - - * Some environments, specially devoted to graphics, require PSTricks, -but `fvrb-ex' desactivate them if PSTricks is not available so it can be used -without it. - -............................................................................. - - Comments, suggestions and bug reports (with version number and the -keyword "fancyvrb" in the subject of the message) to <Denis.Girou@idris.fr> diff --git a/Master/texmf-dist/source/latex/fancyvrb/fancyvrb.dtx b/Master/texmf-dist/source/latex/fancyvrb/fancyvrb.dtx index a06cf159520..dfdb8778a59 100644 --- a/Master/texmf-dist/source/latex/fancyvrb/fancyvrb.dtx +++ b/Master/texmf-dist/source/latex/fancyvrb/fancyvrb.dtx @@ -12,7 +12,8 @@ %% July 17, 1998 %% % \fi -% +% \changes{v2.7a}{2008/02/07}{NMM fixed lastline=firstline bug} +% \changes{v2.7}{2000/03/21}{DG/SR changed how fancyvrb.cfg included} % \changes{v2.6}{1998/07/17}{. Three bug corrected, options numberblanklines, % label, labelposition and leftline added and few % precisions.} @@ -20,7 +21,7 @@ % \changes{v2.0 Beta}{1994/03/30}{First version personally shown by Timothy % \textsc{van Zandt}.} % -% \CheckSum{3107} +% \CheckSum{3113} % % \newif\ifPostScriptFonts % \IfFileExists{times.sty}{\PostScriptFontstrue}{} @@ -195,14 +196,12 @@ % \title{The `\textsf{fancyvrb}' package\\Fancy Verbatims in \LaTeX} % \author{Timothy Van Zandt\\Princeton University\\Princeton -- USA\\ % {\footnotesize email: tvz@Princeton.EDU}\\[5mm] -% {Packaging, documentation and support}\\ -% {\footnotesize Denis Girou (CNRS/IDRIS -- France) -- % -% Denis.Girou@idris.fr}\\[-2mm] +% {Packaging, documentation and support originally (but no longer) by}\\ +% {\footnotesize Denis Girou (CNRS/IDRIS -- France)}\\[-2mm] % {\footnotesize and}\\[-2mm] -% {\footnotesize Sebastian Rahtz (Elsevier -- GB) -- % -% s.rahtz@elsevier.co.uk}} -% \date{Version 2.6\\July 17, 1998\\ -% {\small Documentation revised July 17, 1998}} +% {\footnotesize Sebastian Rahtz (Elsevier -- GB)}} +% \date{Version 2.7a\\ 7-Feb-2008\\ +% {\small Documentation revised 7-Feb-2008}} % % \maketitle % @@ -817,6 +816,28 @@ % \end{Verbatim} % \end{SideBySideExample} % +% % Instead of specifying a firstline at which to start printing a range +% of lines, you can define a start string; the start of the range is +% the first line that exactly equals the string. (The comparison is made +% before any characters are gobbled off the front of the line.) Similarly for a stop +% string. You can mix line-numbers and strings, e.g.\ start at +% firstline, and end at a stop string. Specifying the strings is a +% bit klunky. Initially you must define the strings with +% \cs{newcommand*} as in: +% \begin{SideBySideExample} +% \newcommand*\FancyVerbStartString{FROM} +% \newcommand*\FancyVerbStopString{TO} +% \begin{Verbatim}[gobble=2] +% First verbatim line. +% FROM +% Second verbatim line. +% TO +% Third verbatim line. +% \end{Verbatim} +% \end{SideBySideExample} +% +% \noindent To redefine the strings, you must use \cs{renewcommand*}. + % \subsubsection{Spaces and tab characters} % % \begin{optlist} @@ -1397,8 +1418,8 @@ % % Who we are. % \begin{macrocode} -\def\fileversion{2.6, with DG/SPQR fixes} -\def\filedate{1998/07/17} +\def\fileversion{2.7a, with DG/SPQR fixes, and firstline=lastline fix} +\def\filedate{2008/02/07} \ProvidesPackage{fancyvrb}[\filedate] \message{Style option: `fancyvrb' v\fileversion \space <\filedate> (tvz)} \csname fancyvrb@loaded\endcsname @@ -1810,6 +1831,12 @@ % \noindent if value is a number, then after the assignment the next token is % \cs{relax}. % +% "Preprocessing the line" involves: +% \begin{itemize} +% \item Checking whether this line falls in the range specified by start or stop strings. +% or \texttt{firstline} or \texttt{lastline} line-numbers, or a mixture. +% \item Gobble'ing initial characters. +% \end{itemize} % \begin{macrocode} \define@key{FV}{firstline}{% \afterassignment\FV@ParseStart\@tempcnta=0#1\relax\@nil{#1}} @@ -1891,6 +1918,80 @@ % The definition of \cs{FV@FindStartStop} changes, so that we don't % have to check irrelevant conditions with each line. % +% Here's how it works; for simplicity we assume \texttt{firstline} and \texttt{lastline} +% have been specified, rather than start or stop strings. +% +% The first time \cs{FV@FindStartStop} is called: +% \begin{enumerate} +% \item It calls +% \cs{FV@DefineFindStart}. (The name roughly means "define\\ +% \cs{FV@FindStartStop} to detect when we've reached the \underline{start} of the +% specified range".) This checks the range parameters that have been +% specified, and then redefines \cs{FV@FindStartStop} (yes, the +% function that has called this code) to contain only +% the necessary checks, for efficiency reasons: +% +% \begin{itemize} +% +% \item If we haven't printed any lines yet, which is true when\\ +% \cs{FV@FindStartStop} is first called, we only need to check +% the current line-number against \texttt{firstline}, so we redefine +% \cs{FV@FindStartStop} to be\\ +% \cs{FV@FindStartNum}. +% +% \item If \texttt{firstline} isn't set, we only have to check the +% current line-number against \texttt{lastline}, so we redefine +% \cs{FV@FindStartStop} to be \cs{FV@DefineFindStop}. +% (The name roughly means "define\\ +% \cs{FV@FindStartStop} to detect when we've reached the +% \underline{stop} (end) of the +% specified range", but unlike the START case, it includes code +% (\cs{FV@@PreProcessLine}) to print the current line.) +% +% \end{itemize} +% +% +% \item It then calls the newly-defined \cs{FV@FindStartStop} to see +% if the current line being processed is within the range to be printed. +% +% \end{enumerate} +% +% \cs{FV@FindStartStop} is redefined once as described above, but it +% can be redefined again: +% +% \begin{enumerate} +% +% \item When we have reached \texttt{firstline}, i.e.\ have entered the +% range to be printed, we redefine +% \cs{FV@FindStartStop} to be \cs{FV@DefineFindStop}. (We know +% we've reached the start, so there's no point checking that again on +% future calls.) +% +% \item When we reach \texttt{lastline} and have printed it, we won't +% want to print any more lines, so we redefine +% \cs{FV@FindStartStop} to \cs{relax} so we do nothing (and do +% it efficiently). +% +% Note that when \texttt{firstline} = \texttt{lastline} (= 6, say), it is +% \cs{FV@FindStartNum} (which \cs{FV@FindStartStop} has +% initially been redefined to) that notices when we reach line +% 6, and prints it, and redefines \cs{FV@FindStartStop} to be \cs{FV@DefineFindStop}. +% Then we read line 7, so \cs{FV@DefineFindStop} has to check +% whether we've passed \texttt{lastline}, and therefore shouldn't print +% the current line, before +% redefining \cs{FV@FindStartStop} to \cs{relax} as explained above. +% +% By contrast, when \texttt{firstline} is less than \texttt{lastline} (= 6, 8, say), when we +% reach line 8, \cs{FV@DefineFindStop} sees that we're at the +% end of the range, and \emph{does} print the line, before +% redefining \cs{FV@FindStartStop} to \cs{relax} as above. +% +% This slight weirdness is because several of the macros are +% defining themselves and one another, resulting in a slightly weird +% execution flow. +% +% \end{enumerate} +% % \begin{macro}{\FV@FindStartStop} % \begin{macrocode} \def\FV@FindStartStop{\FV@DefineFindStart\FV@FindStartStop} @@ -1969,13 +2070,17 @@ % \begin{macro}{\FV@FindStopNum} % \begin{macrocode} \def\FV@FindStopNum{% - \ifnum\FancyVerbStopNum=\FV@CodeLineNo + \ifnum\FancyVerbStopNum>\FV@CodeLineNo + \else \let\FV@FindStartStop\relax \ifeof\FV@InFile\else \immediate\closein\FV@InFile \fi \fi - \FV@@PreProcessLine} + \ifnum\FancyVerbStopNum<\FV@CodeLineNo + \else + \FV@@PreProcessLine + \fi} % \end{macrocode} % \end{macro} % @@ -4423,9 +4528,9 @@ % \end{macrocode} % % \begin{macrocode} -%% DG/SR modification begin - Jan. 22, 1998 +%% DG/SR modification begin - Mar 21 2000 %%\@input{fancyvrb.rc} -\@input{fancyvrb.cfg} +\InputIfFileExists{fancyvrb.cfg}{}{} %% DG/SR modification end % \end{macrocode} % |