diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-10 21:45:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-10 21:45:21 +0000 |
commit | 36b416e7adb6f58b240f2bbfa14e0000abf5913f (patch) | |
tree | d2712f8d5eabb0b8143c281e099b4aca253d2a6b /Master/texmf-dist/tex/latex/newverbs | |
parent | a2e36e6098124b767825914adc09449f74ca3e67 (diff) |
newverbs (10sep19)
git-svn-id: svn://tug.org/texlive/trunk@52074 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/newverbs')
-rw-r--r-- | Master/texmf-dist/tex/latex/newverbs/newverbs.sty | 93 |
1 files changed, 64 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/newverbs/newverbs.sty b/Master/texmf-dist/tex/latex/newverbs/newverbs.sty index d54c720b846..edb060136a6 100644 --- a/Master/texmf-dist/tex/latex/newverbs/newverbs.sty +++ b/Master/texmf-dist/tex/latex/newverbs/newverbs.sty @@ -20,7 +20,7 @@ %% original source files, as listed above, are part of the %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) -%% Copyright (C) 2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2012-2019 by Martin Scharrer <martin@scharrer-online.de> %% -------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -37,19 +37,33 @@ %% This work consists of the files newverbs.dtx and newverbs.ins %% and the derived file newverbs.sty. \ProvidesPackage{newverbs}[% - 2012/05/08 - v1.3a + 2019/09/09 + v1.4 Define new 'verb' commands and short verb. characters] \newcommand*\newverbcommand{\new@verbcommand\newcommand} \newcommand*\renewverbcommand{\new@verbcommand\renewcommand} \newcommand*\provideverbcommand{\new@verbcommand\providecommand} -\def\new@verbcommand#1#2#3#4{% +\def\new@verbcommand#1#2{% + \@ifnextchar[% + {\new@@verbcommand{#1}{#2}}% + {\new@@verbcommand{#1}{#2}[\verb]}% +} +\let\newverbs@end\@empty +\def\new@@verbcommand#1#2[#3]#4#5{% #1*#2{% - \begingroup + \bgroup \newverbcommand@settings - \def\verb@egroup{\verb@orig@egroup#4\endgroup}% - \def\newverbs@txend{#4\endgroup}% - #3\verb + \ifx\newverbs@end\@empty + \expandafter\def\expandafter\verb@egroup\expandafter{\verb@egroup\newverbs@end}% + \fi + \begingroup\def\@tempa{#5}% + \expandafter\expandafter\expandafter\endgroup + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\newverbs@end + \expandafter\expandafter\expandafter{\expandafter\@tempa\newverbs@end\egroup}% + \def\newverbs@txend{#5\egroup}% + \verbatim@font\let\verbatim@font\relax + #4#3% }% } \def\newverbs@tabularxsupport{% @@ -84,20 +98,43 @@ } \provideverbcommand{\qverb}{\qverbbeginquote}{\qverbendquote} \@ifundefined{openinnerquote}{% - \def\qverbbeginquote{`}% - \def\qverbendquote{'}% + \def\qverbbeginquote{``}% + \def\qverbendquote{''}% }{% - \def\qverbbeginquote{\openinnerquote}% - \def\qverbendquote{\closeinnerquote}% + \def\qverbbeginquote{\openautoquote}% + \def\qverbendquote{\closeautoquote}% } \newverbcommand{\fverb} {\setbox\verbbox\hbox\bgroup\color@setgroup} {\color@endgroup\egroup\fbox{\box\verbbox}} -\newcommand*\MakeSpecialShortVerb[1]{% +\RequirePackage{shortvrb} +\def\MakeShortVerb{% \@ifstar - {\def\@shortvrbdef{#1*}\@MakeShortVerb}% - {\def\@shortvrbdef{#1}\@MakeShortVerb}% + {\newverbs@MakeShortVerb*}% + {\newverbs@MakeShortVerb{}}% +} +\def\newverbs@MakeShortVerb#1{% + \@ifnextchar[% + {\newverbs@@MakeShortVerb{#1}}% + {\@MakeSpecialShortVerb{#1}{\verb}}% } +\def\newverbs@@MakeShortVerb#1[#2]{% + \@MakeSpecialShortVerb{#1}{#2}% +} +\def\@MakeSpecialShortVerb#1#2#3{% + %\expandafter\ifx\csname cc\string#3\endcsname\relax + %\else + % \DeleteShortVerb{#3}% + %\fi + \def\@shortvrbdef{#2#1}% + \@MakeShortVerb{#3}% +} +\newcommand*\MakeSpecialShortVerb{% + \@ifstar + {\@MakeSpecialShortVerb{*}}% + {\@MakeSpecialShortVerb{}}% +} +%% \subsection{Collect verbatim argument} \newcommand*\collectverb{% \begingroup \verbatim@font @@ -246,19 +283,6 @@ )% |gdef|misj(|def^^M(^^J))% |endgroup% -\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}% -} \newcommand\newverbsfont{% \verbatim@font \frenchspacing @@ -268,9 +292,20 @@ {\@Verbdef*}% {\@Verbdef{}}% } -\newcommand*\@Verbdef[2]{% +\def\@Verbdef#1#2{% \Collectverb#1{\def#2}% } +\providecommand*\verbdef{% + \@ifstar + {\newverbs@verbdef*}% + {\newverbs@verbdef{}}% +} +\def\newverbs@verbdef#1#2{% + \Collectverb#1{\newverbs@@verbdef{#2}}% +} +\def\newverbs@@verbdef#1#2{% + \DeclareRobustCommand{#1}{{\newverbsfont#2}}% +} \endinput %% %% End of file `newverbs.sty'. |