From 187c81e82ee38ee4e617ea4be4d191812892581e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 8 May 2012 22:31:55 +0000 Subject: newverbs 1.3a (8may12) git-svn-id: svn://tug.org/texlive/trunk@26258 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/newverbs/newverbs.dtx | 242 ++++++++++++++++++--- .../texmf-dist/source/latex/newverbs/newverbs.ins | 28 +-- 2 files changed, 218 insertions(+), 52 deletions(-) (limited to 'Master/texmf-dist/source/latex/newverbs') diff --git a/Master/texmf-dist/source/latex/newverbs/newverbs.dtx b/Master/texmf-dist/source/latex/newverbs/newverbs.dtx index 8b95838f06d..f7014ef8d91 100644 --- a/Master/texmf-dist/source/latex/newverbs/newverbs.dtx +++ b/Master/texmf-dist/source/latex/newverbs/newverbs.dtx @@ -1,13 +1,12 @@ -% \iffalse -%<*copyright> -%% Copyright (c) 2010-2011 by Martin Scharrer -%% WWW: http://latex.scharrer-online.de/ -%% +% \iffalse meta-comment +%<=*COPYRIGHT> +%% Copyright (C) 2012 by Martin Scharrer +%% -------------------------------------------------------------------- %% 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 +%% 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. %% @@ -17,16 +16,22 @@ %% %% This work consists of the files newverbs.dtx and newverbs.ins %% and the derived file newverbs.sty. -% -%<*!copyright> -% -%% $Id: newverbs.dtx 2536 2011-07-26 22:45:59Z martin $ +%<=/COPYRIGHT> +% \fi % +% \iffalse %<*driver> -\ProvidesFile{newverbs.dtx} +\ProvidesFile{newverbs.dtx}[% +%<=*DATE> + 2012/05/08 +%<=/DATE> +%<=*VERSION> + v1.3a +%<=/VERSION> + newverbs DTX file] \documentclass{ydoc} \GetFileInfo{newverbs.dtx} -\usepackage{newverbs} +\usepackage{newverbs}[\filedate] %\EnableCrossrefs %\CodelineIndex @@ -39,7 +44,7 @@ % % \fi % -% \CheckSum{245}\relax +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -100,7 +105,7 @@ % This macro adds quote characters around the verbatim material. % Two macros are used to insert the quotes: \cs{qverbbeginquote} (`) and \cs{qverbendquote} ('). % They can be redefined by the user if required. If the \pkg{csquotes} package was loaded beforehand -% the above macros use its macros \cs{openinnerquote} and \cs{closeinnerquote} to take advantage of the language +% the above macros use its macros \cs{openinnerquote} and \cs{closeinnerquote} to take advantage of the language % dependent quotation marks. See the manual of \pkg{csquotes} for more details. % % Using \Macro\qverb is equal to \\ @@ -122,15 +127,15 @@ % \DescribeMacro\MakeSpecialShortVerb {<\textbackslash macro>}{\textbackslash\meta{char}} % \DescribeMacro\MakeSpecialShortVerb*{<\textbackslash macro>}{\textbackslash\meta{char}} % This package also defines a special version of the \cs{MakeShortVerb} macro from the \pkg{shortvrb} package. -% The orignal command \Macro\MakeShortVerb*{\textbackslash\meta{char}} changes the meaning of \meta{char} so that +% The orignal command \Macro\MakeShortVerb*{\textbackslash\meta{char}} changes the meaning of \meta{char} so that % \MacroArgs\ is a shorter alternative to % \Macro\verb*. % -% The new macro \Macro\MakeSpecialShortVerb*{\textbackslash\meta{verb variant}}{\textbackslash\meta{char}} does the same, but +% The new macro \Macro\MakeSpecialShortVerb*{\textbackslash\meta{verb variant}}{\textbackslash\meta{char}} does the same, but % instead of \Macro\verb*\relax\relax\ it uses a \MacroArgs'\'*\relax which needs to be defined using \cs{newverbcommand}. % The package \pkg{shortvrb} must be loaded by the user in order to make this macro work. It is not loaded automatically by \pkg{newverbs}. % -% The special meaning of \meta{char} can be removed using \pkg{shortvrb}'s \cs{DeleteShortVerb}, i.e.\ the same way as for +% The special meaning of \meta{char} can be removed using \pkg{shortvrb}'s \cs{DeleteShortVerb}, i.e.\ the same way as for % characters defined with the normal \cs{MakeShortVerb}. % If a character was already made a short verbatim character it must be ``deleted'' before it can be redefined by \cs{MakeShortVerb} or % \cs{MakeSpecialShortVerb}. @@ -159,7 +164,7 @@ % \DescribeMacro\Collectverb*{} % \DescribeMacro\Collectverb{}{} % \DescribeMacro\Collectverb*{}{} -% This macro is supposed to be used with its \marg{code} argument at the end of user or package macro which want to collect plain verbatim material suitable to be +% This macro is supposed to be used with its \marg{code} argument at the end of user or package macro which want to collect plain verbatim material suitable to be % written in auxiliary files or log messages. % It will collect everything between the following \meta{char} and its next occurrence as verbatim material without adjusting the font or defining any characters in a special way (besides being verbatim). % The starred version will make spaces appear as `\Collectverb*{}: :' when typeset but still be written to auxiliary files as normal spaces. @@ -186,11 +191,19 @@ % % \StopEventually{} % \section{Implementation} +% % \iffalse -%<*package> +%<*newverbs.sty> % \fi % \begin{macrocode} -\ProvidesPackage{newverbs}[2011/07/24 v1.3 Define new 'verb' commands and short verb. characters] +% +\ProvidesPackage{newverbs}[% +% +% +%<*DRIVER> + 2099/01/01 develop +% + Define new 'verb' commands and short verb. characters] % \end{macrocode} % % \subsection{Verb Definition Commands} @@ -227,21 +240,26 @@ % \begin{macro}{\newverbs@tabularxsupport} % Enables support for the new verbatim macros inside \env{tabularx} environments. % This environment defines its own almost-verbatim form of |\verb|%^^A| -% which lacks the end-macro we patch above. The following code inserts such +% which lacks the end-macro we patch above. The following code inserts such % an end-macro. % \begin{macrocode} \def\newverbs@tabularxsupport{% \begingroup - \def\orig@TX@vb##1{\def\@tempa####1##1{\toks@{####1}\edef\@tempa{\the\toks@}% + \def\origa@TX@vb##1{\def\@tempa####1##1{\toks@{####1}\edef\@tempa{\the\toks@}% + \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!} + \def\origb@TX@vb##1{\def\@tempa####1##1{\toks@{####1}\edef\@tempa{\the\toks@}% \expandafter\TX@v\meaning\@tempa\\\\\ifnum0=`{\fi}}\@tempa!}% - \ifx\TX@vb\orig@TX@vb + \ifcase0% + \ifx\TX@vb\origa@TX@vb 1\else + \ifx\TX@vb\origb@TX@vb 1\fi\fi + \relax + \endgroup + \PackageWarning{newverbs}{Couldn't patch 'TX@vb' macro of the 'tabularx' package. Definition unknown.}% + \else \endgroup \PackageInfo{newverbs}{Patching 'TX@vb' macro of the 'tabularx' package.}% \def\TX@vb##1{\def\@tempa####1##1{\toks@{####1}\edef\@tempa{\the\toks@}% \expandafter\TX@v\meaning\@tempa\\\\\ifnum0=`{\fi}\newverbs@txend}\@tempa!}% - \else - \endgroup - \PackageWarning{newverbs}{Couldn't patch 'TX@vb' macro of the 'tabularx' package. Definition unknown.}% \fi \let\newverbs@tabularxsupport\relax } @@ -394,6 +412,65 @@ % \end{macro} % % +% \begin{macro}{\collectverbenv} +% Collects verbatim text which can be typeset. +% Checks for an existing star. +% \begin{macrocode} +\newcommand*\collectverbenv{% + \begingroup + \verbatim@font + \@ifstar + \@scollectverbenv + \@collectverbenv +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@collectverbenv}[1]{} +% Changes catcodes and ensures that spaces are displayed normally. +% \begin{macrocode} +\def\@collectverbenv#1{% + \newverb@catcodes + \@vobeyspaces + \frenchspacing + \@noligs + \expandafter\@@collectverbenv\expandafter{\@currenvir}{#1}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@scollectverbenv}[1]{} +% Changes catcodes. +% \begin{macrocode} +\def\@scollectverbenv#1{% + \newverb@catcodes + \@noligs + \expandafter\@@collectverbenv\expandafter{\@currenvir}{#1}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@collectverbenv}[2]{}{} +% \begin{macrocode} +\begingroup +\catcode`\|=0 +\catcode`\(=1 +\catcode`\)=2 +\@makeother\{ +\@makeother\} +\@makeother\\ +|catcode`|^^M=|active% +|gdef|@@collectverbenv#1#2(% + |long|def|@@@collectverb##1^^M##2^^M\end{#1}(#2(##2)|endgroup|end(#1))% + |@@@collectverb% +)% +|endgroup% +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\Collectverb} % Collects argument as plain verbatim and feeds it to the given code. % The text is suitable to be printed to auxiliary files. @@ -455,6 +532,116 @@ % \end{macro} % % +% \begin{macro}{\Collectverbenv} +% Collects environment content as plain verbatim and feeds it to the given code. +% The text is suitable to be printed to auxiliary files. +% \begin{macrocode} +\newcommand*\Collectverbenv{% + \begingroup + \@ifstar + \@sCollectverbenv + \@Collectverbenv +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@Collectverbenv} +% \begin{macrocode} +\def\@Collectverbenv#1{% + \newverb@catcodes + \obeyspaces + \expandafter\@@Collectverbenv\expandafter{\@currenvir}{#1}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newverb@catcodes} +% \begin{macrocode} +\begingroup +\catcode`\^^I=\active +\gdef\newverb@catcodes{% + \let\do\@makeother + \dospecials + \obeylines + \endlinechar=13 + \catcode`\^^I=\active + \def^^I{\newverb@tab}% +} +\gdef^^I{\newverb@tab}% +\endgroup +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newverb@tab} +% \begin{macrocode} +\edef\newverb@tab{\space}%\space\space\space} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@sCollectverbenv} +% \begin{macrocode} +\def\@sCollectverbenv#1{% + \newverb@catcodes + \expandafter\@@Collectverbenv\expandafter{\@currenvir}{#1}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@Collectverbenv} +% \begin{macrocode} +\begingroup +\catcode`\|=0 +\catcode`\(=1 +\catcode`\)=2 +\@makeother\{ +\@makeother\} +\@makeother\\ +|catcode`|^^M=|active% +|gdef|@@Collectverbenv#1#2(% + |long|def|@@@Collectverb##1^^M##2^^M\end{#1}(|endgroup#2(##2)|end(#1))% + |@@@Collectverb% +)% +|gdef|misj(|def^^M(^^J))% +%|gdef|misj(|def^^M##1(|ifx##1|endmarker|else|noexpand^^M|expandafter##1|fi))% +|endgroup% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newverbenvironment} +% \begin{macrocode} +\newcommand\newverbenvironment{} +\long\def\newverbenvironment#1#2#{% + \@newverbenvironment{#1}{#2}% +} +\long\def\@newverbenvironment#1#2#3#4{% + \newenvironment{#1}#2{% + \begingroup + \newverb@catcodes + \obeyspaces + #3% + \expandafter\@@Collectverbenv\expandafter{\@currenvir}{\long\def\BODY}% + }{#4}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newverbsfont} +% \begin{macrocode} +\newcommand\newverbsfont{% + \verbatim@font + \frenchspacing +} +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\Verbdef} % \begin{macrocode} \newcommand*\Verbdef{% @@ -475,7 +662,8 @@ % \end{macro} % % \iffalse -% +% % \fi +% % \Finale \endinput diff --git a/Master/texmf-dist/source/latex/newverbs/newverbs.ins b/Master/texmf-dist/source/latex/newverbs/newverbs.ins index 7fb81c14d49..a40a13d6acb 100644 --- a/Master/texmf-dist/source/latex/newverbs/newverbs.ins +++ b/Master/texmf-dist/source/latex/newverbs/newverbs.ins @@ -1,34 +1,12 @@ -% $Id$ -% -% Copyright (c) 2010 by Martin Scharrer -% WWW: http://latex.scharrer-online.de/ +% Copyright (c) 2010-2012 by Martin Scharrer % See file 'newverbs.dtx' for copyright and licence information. -\let\originput\input -\input docstrip - -\declarepreamble\dtxpreamble -\endpreamble - -\def\prewrapper{\string\declarepreamble\string\dtxpreamble^^J} -\def\postwrapper{^^J\string\endpreamble} - +\input ydocstrip \askforoverwritefalse -\def\gobble#1{} - -% Extract copyright message from DTX file and use it as preamble for all (real) source files -\generate{% - \let\MetaPrefix\empty - \file{newverbs.tmp}{\usepreamble\prewrapper\usepostamble\postwrapper\from{newverbs.dtx}{copyright}}% -} -\originput newverbs.tmp - -\usepreamble\dtxpreamble - \generate{% - \file{newverbs.sty}{\from{newverbs.dtx}{package}}% + \file{newverbs.sty}{\from{newverbs.dtx}{newverbs.sty}}% } \endbatchfile -- cgit v1.2.3