From 022ecad12921815d7836230953b959498fab9d77 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 18 Feb 2011 00:13:23 +0000 Subject: newverbs 1.2+ (16feb11) git-svn-id: svn://tug.org/texlive/trunk@21441 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/newverbs/newverbs.pdf | Bin 211449 -> 220656 bytes .../texmf-dist/source/latex/newverbs/newverbs.dtx | 47 +++++++++++++++++++-- Master/texmf-dist/tex/latex/newverbs/newverbs.sty | 26 +++++++++++- 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Master/texmf-dist/doc/latex/newverbs/newverbs.pdf b/Master/texmf-dist/doc/latex/newverbs/newverbs.pdf index 4bfb2cf10b2..15d19550b2f 100644 Binary files a/Master/texmf-dist/doc/latex/newverbs/newverbs.pdf and b/Master/texmf-dist/doc/latex/newverbs/newverbs.pdf differ diff --git a/Master/texmf-dist/source/latex/newverbs/newverbs.dtx b/Master/texmf-dist/source/latex/newverbs/newverbs.dtx index 43c55b93057..3308c33784b 100644 --- a/Master/texmf-dist/source/latex/newverbs/newverbs.dtx +++ b/Master/texmf-dist/source/latex/newverbs/newverbs.dtx @@ -20,14 +20,14 @@ % %<*!copyright> % -%% $Id: newverbs.dtx 2086 2011-01-27 21:49:52Z martin $ +%% $Id: newverbs.dtx 2161 2011-02-16 16:19:38Z martin $ % %<*driver> \ProvidesFile{newverbs.dtx} % %\ProvidesPackage{newverbs} %<*package|driver> - [2010/04/13 v1.1 Define new 'verb' commands and short verb. characters] + [2011/02/16 v1.2 Define new 'verb' commands and short verb. characters] % % %<*driver> @@ -51,7 +51,7 @@ % % \fi % -% \CheckSum{65}\relax +% \CheckSum{131}\relax % % \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 @@ -72,6 +72,7 @@ % % \changes{v1.0}{2010/04/05}{Initial version} % \changes{v1.1}{2010/04/13}{Added usage of 'csquotes' macros if loaded.} +% \changes{v1.2}{2011/02/16}{Added support for 'tabularx' environments.} % % \DoNotIndex{\newcommand,\newenvironment,\providecommand} % @@ -154,6 +155,9 @@ % and \cs{MakeShortVerb}. Any package which changes these might break this package. % Users which encounter incompatibilities should not hesitate to contact the package author (with details!). % +% Since v1.2 from 2011/02/16 the new verbatim macros and their short versions can be used inside \env{tabularx} environments. +% This package patches an internal macro of \pkg{tabularx} to achieve this compatibility. +% % \StopEventually{} % \section{Implementation} % \iffalse @@ -184,12 +188,49 @@ \begingroup \newverbcommand@settings \def\verb@egroup{\verb@orig@egroup#4\endgroup}% + \def\newverbs@txend{#4\endgroup} #3\verb }% } % \end{macrocode} % \end{macro} % +% \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 +% an end-macro. +% \begin{macrocode} +\def\newverbs@tabularxsupport{% + \begingroup + \def\orig@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 + \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 +} +% \end{macrocode} +% The end-macro is initially empty and is set for every call of a new verb macro. +% \begin{macrocode} +\def\newverbs@txend{} +% \end{macrocode} +% The support is activated either now or at the begin of the document if the \pkg{tabularx} is loaded. +% \begin{macrocode} +\@ifpackageloaded{tabularx}{% + \newverbs@tabularxsupport +}{% + \AtBeginDocument{\@ifpackageloaded{tabularx}{\newverbs@tabularxsupport}{}}% +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\newverbcommand@settings} % Some settings required for all new \cs{verb}-like commands. % The original end group macro from \cs{verb} is saved away. diff --git a/Master/texmf-dist/tex/latex/newverbs/newverbs.sty b/Master/texmf-dist/tex/latex/newverbs/newverbs.sty index 9e0f3520413..4c856f47d88 100644 --- a/Master/texmf-dist/tex/latex/newverbs/newverbs.sty +++ b/Master/texmf-dist/tex/latex/newverbs/newverbs.sty @@ -24,9 +24,9 @@ %% This work consists of the files newverbs.dtx and newverbs.ins %% and the derived file newverbs.sty. %% -%% $Id: newverbs.dtx 2086 2011-01-27 21:49:52Z martin $ +%% $Id: newverbs.dtx 2161 2011-02-16 16:19:38Z martin $ \ProvidesPackage{newverbs} - [2010/04/13 v1.1 Define new 'verb' commands and short verb. characters] + [2011/02/16 v1.2 Define new 'verb' commands and short verb. characters] \newcommand*\newverbcommand{\new@verbcommand\newcommand} \newcommand*\renewverbcommand{\new@verbcommand\renewcommand} \newcommand*\provideverbcommand{\new@verbcommand\providecommand} @@ -35,9 +35,31 @@ \begingroup \newverbcommand@settings \def\verb@egroup{\verb@orig@egroup#4\endgroup}% + \def\newverbs@txend{#4\endgroup} #3\verb }% } +\def\newverbs@tabularxsupport{% + \begingroup + \def\orig@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 + \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 +} +\def\newverbs@txend{} +\@ifpackageloaded{tabularx}{% + \newverbs@tabularxsupport +}{% + \AtBeginDocument{\@ifpackageloaded{tabularx}{\newverbs@tabularxsupport}{}}% +} \def\newverbcommand@settings{% \let\verb@orig@egroup\verb@egroup \let\verbbox\@tempboxa -- cgit v1.2.3