summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/newverbs
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-18 00:13:23 +0000
committerKarl Berry <karl@freefriends.org>2011-02-18 00:13:23 +0000
commit022ecad12921815d7836230953b959498fab9d77 (patch)
tree8b91ee7b8e62c395fb112f8e7f665bdaadb5552c /Master/texmf-dist/source/latex/newverbs
parent7f045818321b40b2a8aa30ebbabc6485b8793584 (diff)
newverbs 1.2+ (16feb11)
git-svn-id: svn://tug.org/texlive/trunk@21441 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/newverbs')
-rw-r--r--Master/texmf-dist/source/latex/newverbs/newverbs.dtx47
1 files changed, 44 insertions, 3 deletions
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>
%<*!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}
%</driver>
%<package>\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]
%</package|driver>
%
%<*driver>
@@ -51,7 +51,7 @@
%</driver>
% \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.