summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/newverbs
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-01-28 23:13:57 +0000
committerKarl Berry <karl@freefriends.org>2011-01-28 23:13:57 +0000
commitdbd662faa59efb8881c0183fe2778284297b2360 (patch)
tree974b6b74a8768b1fd1492a60da3a017f3d336edc /Master/texmf-dist/source/latex/newverbs
parentd708bf6768840e9e6d64ebdee9e6352df197816a (diff)
newverbs 1.1 (28jan11)
git-svn-id: svn://tug.org/texlive/trunk@21210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/newverbs')
-rw-r--r--Master/texmf-dist/source/latex/newverbs/newverbs.dtx76
1 files changed, 40 insertions, 36 deletions
diff --git a/Master/texmf-dist/source/latex/newverbs/newverbs.dtx b/Master/texmf-dist/source/latex/newverbs/newverbs.dtx
index e1d8ef78ff9..43c55b93057 100644
--- a/Master/texmf-dist/source/latex/newverbs/newverbs.dtx
+++ b/Master/texmf-dist/source/latex/newverbs/newverbs.dtx
@@ -1,6 +1,6 @@
% \iffalse
%<*copyright>
-%% Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
+%% Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de>
%% WWW: http://latex.scharrer-online.de/
%%
%% This work may be distributed and/or modified under the
@@ -20,18 +20,18 @@
%</copyright>
%<*!copyright>
%
-%% $Id: newverbs.dtx 1816 2010-04-05 18:03:28Z martin $
+%% $Id: newverbs.dtx 2086 2011-01-27 21:49:52Z martin $
%
%<*driver>
\ProvidesFile{newverbs.dtx}
%</driver>
%<package>\ProvidesPackage{newverbs}
%<*package|driver>
- [2010/04/05 v1.0 Define new 'verb' commands and short verb. characters]
+ [2010/04/13 v1.1 Define new 'verb' commands and short verb. characters]
%</package|driver>
%
%<*driver>
-\documentclass{ltxdoc}
+\documentclass{ydoc}
\usepackage{hyperref}
\usepackage{xcolor}
@@ -40,12 +40,9 @@
\usepackage{shortvrb}
\MakeSpecialShortVerb{\qverb}{\"}
-
%\EnableCrossrefs
%\CodelineIndex
%\RecordChanges
-\providecommand*{\pkg}{\texttt}
-\providecommand*{\optstar}{\textcolor{gray}{\texttt{*}}}
\begin{document}
\DocInput{newverbs.dtx}
%\PrintChanges
@@ -54,7 +51,7 @@
%</driver>
% \fi
%
-% \CheckSum{58}\relax
+% \CheckSum{65}\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
@@ -74,6 +71,7 @@
%
%
% \changes{v1.0}{2010/04/05}{Initial version}
+% \changes{v1.1}{2010/04/13}{Added usage of 'csquotes' macros if loaded.}
%
% \DoNotIndex{\newcommand,\newenvironment,\providecommand}
%
@@ -91,35 +89,36 @@
%
% \section{Usage}
%
-% \subsection{Defining new variants of \texorpdfstring{\cs{verb}}{'verb'}}
+% \subsection{Defining new variants of \cs{verb}}
%
-% \DescribeMacro\newverbcommand
-% \DescribeMacro\renewverbcommand
-% \DescribeMacro\provideverbcommand
+% \DescribeMacro\newverbcommand {<\textbackslash macro>}{<code before>}{<code after>}
+% \DescribeMacro\renewverbcommand {<\textbackslash macro>}{<code before>}{<code after>}
+% \DescribeMacro\provideverbcommand {<\textbackslash macro>}{<code before>}{<code after>}
% This macros allow the definition of \cs{verb} variants. The verbatim content is processed using \cs{verb}, but the
% variants can add \TeX\ code before and after it.
-% The syntax is \cs{\ldots verbcommand}\marg{macro}\marg{code before}\marg{code after}.
-% The three definition macros use |\newcommand*|, |\renewcommand*| and |\providecommand*| internal to define \meta{macro}, respectively.
+% The three definition macros use |\newcommand*|, |\renewcommand*| and |\providecommand*| internally to define \meta{macro}, respectively.
% Afterwards \meta{macro} can be used like \cs{verb}. The star version of \meta{macro} will use \cs{verb}|*|.
%
% See the implementation of \cs{qverb} in section~\ref{sec:impl} for an example.
%
%
-% \subsection{Provided \texorpdfstring{\cs{verb}}{'verb'} variants}
+% \subsection{Provided \cs{verb} variants}
%
% Two \cs{verb} variants are provided (i.e. with \cs{provideverbcommand}) by default.
%
-% \DescribeMacro\qverb
+% \DescribeMacro\qverb<char><verbatim material><char>
% 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.
+% 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
+% dependent quotation marks. See the manual of \pkg{csquotes} for more details.
%
-% Using \cs{qverb}\meta{char}\meta{verbatim material}\meta{char} is equal to \\
-% \cs{qverbbeginquote}\cs{verb}\meta{char}\meta{verbatim material}\meta{char}\cs{qverbbeginquote}, or\\
-% |`|\cs{verb}\meta{char}\meta{verbatim material}\meta{char}|'|\\
+% Using \Macro\qverb<char><verbatim material><char> is equal to \\
+% \Macro\qverbbeginquote\AlsoMacro\verb<char><verbatim material><char>\AlsoMacro\qverbendquote, or\\
+% \MacroArgs'`'\AlsoMacro\verb<char><verbatim material><char>''
% when the default definition of the quote macros is used.
%
-% \DescribeMacro\fverb
+% \DescribeMacro\fverb<char><verbatim material><char>
% This macro adds a frame (|\fbox{}|) around the verbatim text (|\fverb+$&^_%$+| $\to$ \fverb+$&^_$+).
% A \TeX\ box is used to store the content first, then the box is framed.
% The user can define similar command using the following code:\\
@@ -128,16 +127,16 @@
% \hspace*{10em}|{\end{lrbox}\mycommand{\usebox{\verbbox}}}|}\\
% The temporary box \cs{verbbox} is only provided inside a |\...verbcommand|.
%
-% \subsection{Using \texorpdfstring{\cs{verb}}{'verb'} variants with short verbatim character}
+% \subsection{Using \cs{verb} variants with short verbatim character}
%
-% \DescribeMacro\MakeSpecialShortVerb
+% \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 \cs{MakeShortVerb}\optstar|{\|\meta{char}|}| changes the meaning of \meta{char} so that
-% \meta{char}\meta{verbatim material}\meta{char} is a shorter alternative to
-% \cs{verb}\optstar\meta{char}\meta{verbatim material}\meta{char}.
+% The orignal command \Macro\MakeShortVerb*{\textbackslash\meta{char}} changes the meaning of \meta{char} so that
+% \MacroArgs<char><verbatim material><char>\ is a shorter alternative to
+% \Macro\verb*<char><verbatim material><char>.
%
-% The new macro \cs{MakeSpecialShortVerb}\optstar\marg{\cs{verb} variant}|{\|\meta{char}|}| does the same, but
-% instead of \cs{verb}\optstar\ it uses a \meta{\cs{verb} variant} which needs to be defined using \cs{newverbcommand}.
+% 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'\'<verb variant>*\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
@@ -153,7 +152,7 @@
% \section{Compatibility with other verbatim packages}
% The compatibility with other verbatim packages is not tested yet. This package relies on the normal internal definition of \cs{verb}
% and \cs{MakeShortVerb}. Any package which changes these might break this package.
-% Users which encounter incapabilities should not hesitate to contact the package author (with details!).
+% Users which encounter incompatibilities should not hesitate to contact the package author (with details!).
%
% \StopEventually{}
% \section{Implementation}
@@ -176,9 +175,7 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\new@verbcommand}
-% Depending on |#1| a macro given by |#2| is (re-)defined/provided.
-% The code given by |#3| and |#4| is placed before and after the verb command.
+% \begin{macro}{\new@verbcommand}[4]{underlying definition macro}{macro to define}{code before}{code after}
% The trailing code is inserted by patching \cs{verb@egroup} which is called by \cs{verb}
% after the verbatim content.
% \begin{macrocode}
@@ -196,7 +193,7 @@
% \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.
-% Also the temp box a is provided with a user friendly name.
+% Also the `temp box a' is provided with a user friendly name.
% \begin{macrocode}
\def\newverbcommand@settings{%
\let\verb@orig@egroup\verb@egroup
@@ -217,9 +214,16 @@
% \begin{macro}{\qverbbeginquote}
% \begin{macro}{\qverbendquote}
% This macros insert the actual quotes. They can be redefined by the user to contain the required quotes.
+% If available the quoting macros of \pkg{csquotes} are used.
+% \changes{v1.1}{2010/04/13}{Added usage of 'csquotes' macros if loaded.}
% \begin{macrocode}
-\def\qverbbeginquote{`}
-\def\qverbendquote{'}
+\@ifundefined{openinnerquote}{%
+ \def\qverbbeginquote{`}%
+ \def\qverbendquote{'}%
+}{%
+ \def\qverbbeginquote{\openinnerquote}%
+ \def\qverbendquote{\closeinnerquote}%
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -236,7 +240,7 @@
%
% \subsection{Make Special Short Verbatim Characters}
%
-% \begin{macro}{\MakeSpecialShortVerb}
+% \begin{macro}{\MakeSpecialShortVerb}[1]{verbatim macro}
% Uses the definition of \cs{MakeShortVerb} from \pkg{shortvrb} except with \cs{verb} replaced with the first argument.
% The second argument is then read by \cs{@MakeShortVerb}.
% \begin{macrocode}