diff options
author | Karl Berry <karl@freefriends.org> | 2019-02-05 21:55:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-02-05 21:55:49 +0000 |
commit | 55c5791c6ab8cf082514fe407968cf20b165639a (patch) | |
tree | 5a6f58122ab64fdcc05c947580af1935b20f5b9c /Master/texmf-dist/tex/latex/fvextra | |
parent | 11ab7fc9bf5dd125cdea55cb8e3c15b598ff1641 (diff) |
fvextra (5feb19)
git-svn-id: svn://tug.org/texlive/trunk@49947 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fvextra')
-rw-r--r-- | Master/texmf-dist/tex/latex/fvextra/fvextra.sty | 1193 |
1 files changed, 1082 insertions, 111 deletions
diff --git a/Master/texmf-dist/tex/latex/fvextra/fvextra.sty b/Master/texmf-dist/tex/latex/fvextra/fvextra.sty index 32b5e3d83e0..948c22af560 100644 --- a/Master/texmf-dist/tex/latex/fvextra/fvextra.sty +++ b/Master/texmf-dist/tex/latex/fvextra/fvextra.sty @@ -20,7 +20,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{fvextra} - [2017/07/08 v1.3.1 fvextra - extensions and patches for fancyvrb] + [2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb] \RequirePackage{ifthen} \RequirePackage{etoolbox} \RequirePackage{fancyvrb} @@ -35,8 +35,849 @@ \@ifpackageloaded{csquotes}% {\PackageWarning{fvextra}{csquotes should be loaded after fvextra, % to avoid a warning from the lineno package}}{} -\def\FV@Space@ifx{\FV@Space} -\def\FV@Tab@ifx{\FV@Tab} +\def\FV@FVSpaceToken{\FV@Space} +\def\FV@FVTabToken{\FV@Tab} +\def\FVExtraDoSpecials{% + \do\ \do\!\do\"\do\#\do\$\do\%\do\&\do\'\do\(\do\)\do\*\do\+\do\,\do\-% + \do\.\do\/\do\:\do\;\do\<\do\=\do\>\do\?\do\@\do\[\do\\\do\]\do\^\do\_% + \do\`\do\{\do\|\do\}\do\~} +\begingroup +\def\do#1{% + \expandafter\global\expandafter + \let\csname FV@Special:\expandafter\@gobble\detokenize{#1}\endcsname\relax} +\FVExtraDoSpecials +\endgroup +\begingroup +\catcode`\<=11 +\catcode`\>=11 +\gdef\FV@Sentinel{\FV@<Sentinel>} +\endgroup +\begingroup +\catcode`\^^M=\active% +\gdef\FV@OuterDefEOLEmpty{\outer\def^^M{}}% +\endgroup +\begingroup +\catcode`\^^M=\active% +\gdef\FV@DefEOLEmpty{\def^^M{}}% +\endgroup +\begingroup +\catcode`\^^B=\active +\gdef\FV@OuterDefSTXEmpty{\outer\def^^B{}} +\endgroup +\begingroup +\catcode`\^^C=\active +\gdef\FV@OuterDefETXEmpty{\outer\def^^C{}} +\endgroup +\newif\ifFV@pdfTeXinputenc +\FV@pdfTeXinputencfalse +\ifcsname pdfmatch\endcsname +\ifx\pdfmatch\relax +\else + \@ifpackageloaded{inputenc}% + {\ifcsname inputencodingname\endcsname + \ifx\inputencodingname\relax + \else + \FV@pdfTeXinputenctrue + \fi\fi} + {}% +\fi\fi +\ifFV@pdfTeXinputenc +\begingroup +\catcode`\~=13 +\catcode`\"=12 +\def\FV@UTFviii@loop{% + \uccode`\~\count@ + \uppercase\expandafter{\FV@UTFviii@Tmp}% + \advance\count@\@ne + \ifnum\count@<\@tempcnta + \expandafter\FV@UTFviii@loop + \fi} +\count@"C2 +\@tempcnta"E0 +\def\FV@UTFviii@Tmp{\expandafter\gdef\csname FV@U8:\string~\endcsname{% + \FV@UTF@two@octets}} +\FV@UTFviii@loop +\count@"E0 +\@tempcnta"F0 +\def\FV@UTFviii@Tmp{\expandafter\gdef\csname FV@U8:\string~\endcsname{% + \FV@UTF@three@octets}} +\FV@UTFviii@loop +\count@"F0 +\@tempcnta"F4 +\def\FV@UTFviii@Tmp{\expandafter\gdef\csname FV@U8:\string~\endcsname{% + \FV@UTF@four@octets}} +\FV@UTFviii@loop +\endgroup +\def\FV@UTF@two@octets#1#2{% + \ifcsname u8:\detokenize{#1#2}\endcsname + \else + #1#2% + \fi + \FV@UTF@octets@after{#1#2}} +\def\FV@UTF@three@octets#1#2#3{% + \ifcsname u8:\detokenize{#1#2#3}\endcsname + \else + #1#2#3% + \fi + \FV@UTF@octets@after{#1#2#3}} +\def\FV@UTF@four@octets#1#2#3#4{% + \ifcsname u8:\detokenize{#1#2#3#4}\endcsname + \else + #1#2#3#4% + \fi + \FV@UTF@octets@after{#1#2#3#4}} +\fi +\long\def\FVExtra@ifnextcharVArg#1#2#3{% + \begingroup + \edef\FV@TmpSpaceCat{\the\catcode` }% + \let\do\@makeother\FVExtraDoSpecials + \catcode`\ =\FV@TmpSpaceCat\relax + \catcode`\{=1 + \catcode`\}=2 + \@ifnextchar#1{\endgroup#2}{\endgroup#3}} +\begingroup +\catcode`\*=12 +\gdef\FVExtra@ifstarVArg#1{\FVExtra@ifnextcharVArg*{\@firstoftwo{#1}}} +\endgroup +\def\FV@ReadOArgContinue#1[#2]{#1{#2}} +\newcommand{\FVExtraReadOArgBeforeVArg}[2][]{% + \FVExtra@ifnextcharVArg[% + {\FV@ReadOArgContinue{#2}}% + {\FV@ReadOArgContinue{#2}[#1]}} +\newcommand{\FVExtraReadOArgBeforeVEnv}[2][]{% + \begingroup + \catcode`\^^M=\active + \@ifnextchar[% + {\endgroup\FV@ReadOArgContinue{#2}}% + {\endgroup\FV@ReadOArgContinue{#2}[#1]}} +\def\FVExtraReadVArg#1{% + \begingroup + \ifFV@pdfTeXinputenc + \ifdefstring{\inputencodingname}{utf8}% + {\let\FV@ReadVArg@Char\FV@ReadVArg@Char@UTF}% + {}% + \fi + \edef\FV@TmpSpaceCat{\the\catcode` }% + \let\do\@makeother\FVExtraDoSpecials + \catcode`\^^B=\active + \FV@OuterDefSTXEmpty + \catcode`\^^C=\active + \FV@OuterDefETXEmpty + \catcode`\^^M=\active + \FV@OuterDefEOLEmpty + \begingroup + \catcode`\ =\FV@TmpSpaceCat\relax + \catcode`\{=1 + \catcode`\}=2 + \@ifnextchar\bgroup + {\endgroup + \catcode`\{=1 + \catcode`\}=2 + \catcode`\ =\active + \catcode`\^^I=\active + \FV@ReadVArg@Group{#1}\FV@EOL}% + {\endgroup + \catcode`\ =\active + \catcode`\^^I=\active + \FV@ReadVArg@Char{#1}\FV@EOL}} +\def\FV@ReadVArg@Group#1#2#3{% + \endgroup + #1{#3}} +\def\FV@ReadVArg@Char#1#2#3{% + \expandafter\expandafter\expandafter + \if\expandafter\expandafter\expandafter\relax\expandafter\@gobble\detokenize{#3}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\PackageError{fvextra}% + {Verbatim delimiters must be single characters, not commands}% + {Try a different delimiter}}% + \def\FV@ReadVArg@Char@i##1##2##3#3{% + \endgroup + ##1{##3}}% + \FV@ReadVArg@Char@i{#1}\FV@EOL}% +\ifFV@pdfTeXinputenc +\def\FV@ReadVArg@Char@UTF#1#2#3{% + \expandafter\expandafter\expandafter + \if\expandafter\expandafter\expandafter\relax\expandafter\@gobble\detokenize{#3}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\PackageError{fvextra}% + {Verbatim delimiters must be single characters, not commands}% + {Try a different delimiter}}% + \ifcsname FV@U8:\detokenize{#3}\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\def\FV@UTF@octets@after##1{\FV@ReadVArg@Char@UTF@i{#1}{##1}}% + \csname FV@U8:\detokenize{#3}\endcsname#3}% + {\FV@ReadVArg@Char@UTF@i{#1}{#3}}} +\def\FV@ReadVArg@Char@UTF@i#1#2{% + \def\FV@ReadVArg@Char@i##1##2##3#2{% + \endgroup + ##1{##3}}% + \FV@ReadVArg@Char@i{#1}\FV@EOL}% +\fi +\def\FVExtrapdfstringdef#1#2{% + \AfterPreamble{% + \ifcsname pdfstringdef\endcsname + \ifx\pdfstringdef\relax + \else + \pdfstringdef#1{#2}% + \fi\fi}} +\def\FVExtrapdfstringdefDisableCommands#1{% + \AfterPreamble{% + \ifcsname pdfstringdefDisableCommands\endcsname + \ifx\pdfstringdefDisableCommands\relax + \else + \pdfstringdefDisableCommands{#1}% + \fi\fi}} +\long\def\FVExtraAlwaysUnexpanded#1{% + \unexpanded{\FVExtraAlwaysUnexpanded{#1}}} +\FVExtrapdfstringdefDisableCommands{% + \long\def\FVExtraAlwaysUnexpanded#1{#1}} +\newbool{FVExtraRobustCommandExpanded} +\protected\def\FVExtraRobustCommand#1#2{% + \ifx#2\FVExtraAlwaysUnexpanded + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\booltrue{FVExtraRobustCommandExpanded}\FV@RobustCommand@i{#1}}% + {\boolfalse{FVExtraRobustCommandExpanded}#1}} +\FVExtrapdfstringdefDisableCommands{% + \def\FVExtraRobustCommand{}} +\def\FV@RobustCommand@i#1#2{\expandafter#1\@gobble#2} +\def\FVExtraUnexpandedReadStarOArgMArg#1#{% + \FV@UnexpandedReadStarOArgMArg@i{#1}} +\def\FV@UnexpandedReadStarOArgMArg@i#1#2{% + \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgMArg#1{#2}}} +\FVExtrapdfstringdefDisableCommands{% + \makeatletter + \def\FV@UnexpandedReadStarOArgMArg@i#1#2{#2}% + \makeatother} +\def\FVExtraUseVerbUnexpandedReadStarOArgMArg#1#{% + \FV@UseVerbUnexpandedReadStarOArgMArg@i{#1}} +\def\FV@UseVerbUnexpandedReadStarOArgMArg@i#1#2{% + \FVExtraAlwaysUnexpanded{\FVExtraUseVerbUnexpandedReadStarOArgMArg#1{#2}}} +\FVExtrapdfstringdefDisableCommands{% + \makeatletter + \def\FV@UseVerbUnexpandedReadStarOArgMArg@i#1#2{% + \ifcsname FV@SVRaw@#2\endcsname + \expandafter\expandafter\expandafter\FVExtraPDFStringVerbatimDetokenize + \expandafter\expandafter\expandafter{\csname FV@SVRaw@#2\endcsname}% + \fi}% + \makeatother} +\def\FVExtraUnexpandedReadStarOArgBVArg#1#{% + \FV@UnexpandedReadStarOArgBVArg@i{#1}} +\def\FV@UnexpandedReadStarOArgBVArg@i#1#2{% + \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgBVArg#1{#2}}} +\FVExtrapdfstringdefDisableCommands{% + \makeatletter + \def\FV@UnexpandedReadStarOArgBVArg@i#1#2{% + \FVExtraPDFStringVerbatimDetokenize{#2}}% + \makeatother} +\def\FVExtraUnexpandedReadStarOArgBEscVArg#1#{% + \FV@UnexpandedReadStarOArgBEscVArg@i{#1}} +\def\FV@UnexpandedReadStarOArgBEscVArg@i#1#2{% + \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgBEscVArg#1{#2}}} +\FVExtrapdfstringdefDisableCommands{% + \makeatletter + \def\FV@UnexpandedReadStarOArgBEscVArg@i#1#2{% + \FVExtraPDFStringEscapedVerbatimDetokenize{#2}}% + \makeatother} +\def\FVExtraPDFStringEscapeChar#1{% + \ifcsname FV@PDFStringEscapeChar@#1\endcsname + \csname FV@PDFStringEscapeChar@#1\endcsname + \else + #1% + \fi} +\begingroup +\catcode`\&=14 +\catcode`\%=12& +\catcode`\(=12& +\catcode`\)=12& +\catcode`\^^J=12& +\catcode`\^^M=12& +\catcode`\^^I=12& +\catcode`\^^H=12& +\catcode`\^^L=12& +\catcode`\!=0\relax& +!catcode`!\=12!relax& +!expandafter!gdef!csname FV@PDFStringEscapeChar@\!endcsname{\\}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@%!endcsname{\%}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@(!endcsname{\(}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@)!endcsname{\)}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@^^J!endcsname{\n}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@^^M!endcsname{\r}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@^^I!endcsname{\t}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@^^H!endcsname{\b}& +!expandafter!gdef!csname FV@PDFStringEscapeChar@^^L!endcsname{\f}& +!catcode`!\=0!relax& +\endgroup +\def\FVExtraPDFStringEscapeChars#1{% + \FV@PDFStringEscapeChars#1\FV@Sentinel} +\def\FV@PDFStringEscapeChars#1{% + \ifx#1\FV@Sentinel + \else + \FVExtraPDFStringEscapeChar{#1}% + \expandafter\FV@PDFStringEscapeChars + \fi}% +\begingroup +\catcode`\ =10 +\catcode`\a=11 +\catcode`\<=11 +\catcode`\>=11 +\catcode`\^^C=\active +\gdef\FVExtraVerbatimDetokenize#1{% + \FV@VDetok@Scan{}#1^^C \FV@<Sentinel>} +\gdef\FV@VDetok@Scan#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@VDetok@ScanEnd#1}% + {\FV@VDetok@ScanCont{#1}{#2}}} +\gdef\FV@VDetok@ScanEnd#1^^C{% + \if\relax\detokenize{#1}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@VDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}} +\begingroup +\catcode`\ =12% +\gdef\FV@VDetok@ScanCont#1#2{% +\if\relax\detokenize{#1}\relax% +\expandafter\@gobble% +\else% +\expandafter\@firstofone% +\fi% +{\expandafter\FV@VDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}% + %<-catcode 12 space +\FV@VDetok@Scan{}#2\FV@<Sentinel>}% +\endgroup +\gdef\FV@VDetok@ScanGroup#1#{% + \FV@VDetok@ScanToken#1\FV@Sentinel + \FV@VDetok@ScanGroup@i} +\gdef\FV@VDetok@ScanGroup@i#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@VDetok@ScanEmptyGroup}% + {\FV@VDetok@ScanGroup@ii{}#1\FV@<Sentinel>^^C}} +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@VDetok@ScanEmptyGroup({}\FV@VDetok@ScanGroup) +\endgroup +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@VDetok@ScanGroup@ii#1\FV@<Sentinel>#2^^C(% + \if\relax\detokenize(#2)\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + ({\FV@VDetok@Scan#1^^C \FV@<Sentinel>}\FV@VDetok@ScanGroup)) +\endgroup +\gdef\FV@VDetok@ScanToken#1{% + \ifx\FV@Sentinel#1% + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@VDetok@ScanToken@i\detokenize{#1}^^C \FV@<Sentinel>}} +\gdef\FV@VDetok@ScanToken@i#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@VDetok@ScanTokenNoSpace#1}% + {\FV@VDetok@ScanTokenWithSpace{#1}}} +\gdef\FV@VDetok@ScanTokenNoSpace#1^^C{#1\FV@VDetok@ScanToken} +\gdef\FV@VDetok@ScanTokenWithSpace#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@VDetok@ScanTokenActiveSpace}% + {\FV@VDetok@ScanTokenWithSpace@i#1\FV@<Sentinel>}} +\begingroup +\catcode`\ =12% +\gdef\FV@VDetok@ScanTokenActiveSpace{ \FV@VDetok@ScanToken}% +\endgroup +\gdef\FV@VDetok@ScanTokenWithSpace@i#1#2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@VDetok@ScanTokenEscSpace{#1}}% + {\FV@VDetok@ScanTokenCW{#1#2}}} +\begingroup +\catcode`\ =12% +\gdef\FV@VDetok@ScanTokenEscSpace#1{#1 \FV@VDetok@ScanToken}% +\endgroup +\begingroup +\catcode`\ =12% +\gdef\FV@VDetok@ScanTokenCW#1#2{% +\ifcat\noexpand#2a% +\expandafter\@firstoftwo% +\else% +\expandafter\@secondoftwo% +\fi% +{#1 \FV@VDetok@ScanToken#2}% +{#1\FV@VDetok@ScanToken#2}}% +\endgroup +\gdef\FVExtraPDFStringVerbatimDetokenize#1{% + \FV@PDFStrVDetok@Scan{}#1^^C \FV@<Sentinel>} +\gdef\FV@PDFStrVDetok@Scan#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrVDetok@ScanEnd#1}% + {\FV@PDFStrVDetok@ScanCont{#1}{#2}}} +\gdef\FV@PDFStrVDetok@ScanEnd#1^^C{% + \if\relax\detokenize{#1}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@PDFStrVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}} +\begingroup +\catcode`\ =12% +\gdef\FV@PDFStrVDetok@ScanCont#1#2{% +\if\relax\detokenize{#1}\relax% +\expandafter\@gobble% +\else% +\expandafter\@firstofone% +\fi% +{\expandafter\FV@PDFStrVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}% + %<-catcode 12 space +\FV@PDFStrVDetok@Scan{}#2\FV@<Sentinel>}% +\endgroup +\gdef\FV@PDFStrVDetok@ScanGroup#1#{% + \FV@PDFStrVDetok@ScanToken#1\FV@Sentinel + \FV@PDFStrVDetok@ScanGroup@i} +\gdef\FV@PDFStrVDetok@ScanGroup@i#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrVDetok@ScanEmptyGroup}% + {\FV@PDFStrVDetok@ScanGroup@ii{}#1\FV@<Sentinel>^^C}} +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@PDFStrVDetok@ScanEmptyGroup({}\FV@PDFStrVDetok@ScanGroup) +\endgroup +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@PDFStrVDetok@ScanGroup@ii#1\FV@<Sentinel>#2^^C(% + \if\relax\detokenize(#2)\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + ({\FV@PDFStrVDetok@Scan#1^^C \FV@<Sentinel>}\FV@PDFStrVDetok@ScanGroup)) +\endgroup +\gdef\FV@PDFStrVDetok@ScanToken#1{% + \ifx\FV@Sentinel#1% + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@PDFStrVDetok@ScanToken@i\detokenize{#1}^^C \FV@<Sentinel>}} +\gdef\FV@PDFStrVDetok@ScanToken@i#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrVDetok@ScanTokenNoSpace#1}% + {\FV@PDFStrVDetok@ScanTokenWithSpace{#1}}} +\gdef\FV@PDFStrVDetok@ScanTokenNoSpace#1^^C{% + \FVExtraPDFStringEscapeChars{#1}\FV@PDFStrVDetok@ScanToken} +\gdef\FV@PDFStrVDetok@ScanTokenWithSpace#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrVDetok@ScanTokenActiveSpace}% + {\FV@PDFStrVDetok@ScanTokenWithSpace@i#1\FV@<Sentinel>}} +\begingroup +\catcode`\!=0\relax +\catcode`\\=12!relax +!gdef!FV@PDFStrVDetok@ScanTokenActiveSpace{\040!FV@PDFStrVDetok@ScanToken}% +!catcode`!\=0!relax +\endgroup +\gdef\FV@PDFStrVDetok@ScanTokenWithSpace@i#1#2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrVDetok@ScanTokenEscSpace{#1}}% + {\FV@PDFStrVDetok@ScanTokenCW{#1#2}}} +\begingroup +\catcode`\!=0\relax +\catcode`\\=12!relax +!gdef!FV@PDFStrVDetok@ScanTokenEscSpace#1{% + !FVExtraPDFStringEscapeChar{#1}\040!FV@PDFStrVDetok@ScanToken}% +!catcode`!\=0!relax +\endgroup +\begingroup +\catcode`\ =12% +\gdef\FV@PDFStrVDetok@ScanTokenCW#1#2{% +\ifcat\noexpand#2a% +\expandafter\@firstoftwo% +\else% +\expandafter\@secondoftwo% +\fi% +{\FVExtraPDFStringEscapeChars{#1} \FV@PDFStrVDetok@ScanToken#2}% +{\FVExtraPDFStringEscapeChars{#1}\FV@PDFStrVDetok@ScanToken#2}} +\endgroup +\gdef\FVExtraEscapedVerbatimDetokenize#1{% + \FV@EscVDetok@Scan{}#1^^C \FV@<Sentinel>} +\gdef\FV@EscVDetok@Scan#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@EscVDetok@ScanEnd#1}% + {\FV@EscVDetok@ScanCont{#1}{#2}}} +\gdef\FV@EscVDetok@ScanEnd#1^^C{% + \if\relax\detokenize{#1}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@EscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}} +\begingroup +\catcode`\ =12% +\gdef\FV@EscVDetok@ScanCont#1#2{% +\if\relax\detokenize{#1}\relax% +\expandafter\@gobble% +\else% +\expandafter\@firstofone% +\fi% +{\expandafter\FV@EscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}% + %<-catcode 12 space +\FV@EscVDetok@Scan{}#2\FV@<Sentinel>}% +\endgroup +\gdef\FV@EscVDetok@ScanGroup#1#{% + \FV@EscVDetok@ScanToken#1\FV@Sentinel + \FV@EscVDetok@ScanGroup@i} +\gdef\FV@EscVDetok@ScanGroup@i#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@EscVDetok@ScanEmptyGroup}% + {\FV@EscVDetok@ScanGroup@ii{}#1\FV@<Sentinel>^^C}} +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@EscVDetok@ScanEmptyGroup({}\FV@EscVDetok@ScanGroup) +\endgroup +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@EscVDetok@ScanGroup@ii#1\FV@<Sentinel>#2^^C(% + \if\relax\detokenize(#2)\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + ({\FV@EscVDetok@Scan#1^^C \FV@<Sentinel>}\FV@EscVDetok@ScanGroup)) +\endgroup +\gdef\FV@EscVDetok@ScanToken#1{% + \ifx\FV@Sentinel#1% + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@EscVDetok@ScanToken@i\detokenize{#1}^^C \FV@<Sentinel>}} +\gdef\FV@EscVDetok@ScanToken@i#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@EscVDetok@ScanTokenNoSpace#1}% + {\FV@EscVDetok@ScanTokenWithSpace{#1}}} +\gdef\FV@EscVDetok@ScanTokenNoSpace#1#2^^C{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {#1\FV@EscVDetok@ScanToken}% + {#2\FV@EscVDetok@ScanToken}} +\gdef\FV@REscVDetok@ScanTokenNoSpace#1#2^^C{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {#1\FV@EscVDetok@ScanToken}% + {\ifcsname FV@Special:\detokenize{#2}\endcsname#2\else\noexpand\FV@<InvalidEscape>\fi + \FV@EscVDetok@ScanToken}} +\gdef\FV@EscVDetok@ScanTokenWithSpace#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@EscVDetok@ScanTokenActiveSpace}% + {\FV@EscVDetok@ScanTokenWithSpace@i#1\FV@<Sentinel>}} +\begingroup +\catcode`\ =12% +\gdef\FV@EscVDetok@ScanTokenActiveSpace{ \FV@EscVDetok@ScanToken}% +\endgroup +\gdef\FV@EscVDetok@ScanTokenWithSpace@i#1#2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@EscVDetok@ScanTokenEscSpace{#1}}% + {\FV@EscVDetok@ScanTokenCW{#1}{#2}}} +\gdef\FV@REscVDetok@ScanTokenWithSpace@i#1#2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@EscVDetok@ScanTokenEscSpace{#1}}% + {\noexpand\FV@<InvalidEscape>\FV@EscVDetok@ScanToken}} +\begingroup +\catcode`\ =12% +\gdef\FV@EscVDetok@ScanTokenEscSpace#1{ \FV@EscVDetok@ScanToken}% +\endgroup +\begingroup +\catcode`\ =12% +\gdef\FV@EscVDetok@ScanTokenCW#1#2#3{% +\ifcat\noexpand#2a% +\expandafter\@firstoftwo% +\else% +\expandafter\@secondoftwo% +\fi% +{#2 \FV@EscVDetok@ScanToken#3}% +{#2\FV@EscVDetok@ScanToken#3}} +\endgroup +\gdef\FVExtraPDFStringEscapedVerbatimDetokenize#1{% + \FV@PDFStrEscVDetok@Scan{}#1^^C \FV@<Sentinel>} +\gdef\FV@PDFStrEscVDetok@Scan#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrEscVDetok@ScanEnd#1}% + {\FV@PDFStrEscVDetok@ScanCont{#1}{#2}}} +\gdef\FV@PDFStrEscVDetok@ScanEnd#1^^C{% + \if\relax\detokenize{#1}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@PDFStrEscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}} +\begingroup +\catcode`\!=0\relax +\catcode`\\=12!relax +!gdef!FV@PDFStrEscVDetok@ScanCont#1#2{% + !if!relax!detokenize{#1}!relax + !expandafter!@gobble + !else + !expandafter!@firstofone + !fi + {!expandafter!FV@PDFStrEscVDetok@ScanGroup!@gobble#1{!FV@<Sentinel>}}% + \040%<-space + !FV@PDFStrEscVDetok@Scan{}#2!FV@<Sentinel>}% +!catcode`!\=0!relax +\endgroup +\gdef\FV@PDFStrEscVDetok@ScanGroup#1#{% + \FV@PDFStrEscVDetok@ScanToken#1\FV@Sentinel + \FV@PDFStrEscVDetok@ScanGroup@i} +\gdef\FV@PDFStrEscVDetok@ScanGroup@i#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrEscVDetok@ScanEmptyGroup}% + {\FV@PDFStrEscVDetok@ScanGroup@ii{}#1\FV@<Sentinel>^^C}} +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@PDFStrEscVDetok@ScanEmptyGroup({}\FV@PDFStrEscVDetok@ScanGroup) +\endgroup +\begingroup +\catcode`\(=1 +\catcode`\)=2 +\catcode`\{=12 +\catcode`\}=12 +\gdef\FV@PDFStrEscVDetok@ScanGroup@ii#1\FV@<Sentinel>#2^^C(% + \if\relax\detokenize(#2)\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + ({\FV@PDFStrEscVDetok@Scan#1^^C \FV@<Sentinel>}\FV@PDFStrEscVDetok@ScanGroup)) +\endgroup +\gdef\FV@PDFStrEscVDetok@ScanToken#1{% + \ifx\FV@Sentinel#1% + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\expandafter\FV@PDFStrEscVDetok@ScanToken@i\detokenize{#1}^^C \FV@<Sentinel>}} +\gdef\FV@PDFStrEscVDetok@ScanToken@i#1 #2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrEscVDetok@ScanTokenNoSpace#1}% + {\FV@PDFStrEscVDetok@ScanTokenWithSpace{#1}}} +\gdef\FV@PDFStrEscVDetok@ScanTokenNoSpace#1#2^^C{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FVExtraPDFStringEscapeChar{#1}\FV@PDFStrEscVDetok@ScanToken}% + {\FVExtraPDFStringEscapeChar{#2}\FV@PDFStrEscVDetok@ScanToken}} +\gdef\FV@PDFStrEscVDetok@ScanTokenWithSpace#1{% + \if\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrEscVDetok@ScanTokenActiveSpace}% + {\FV@PDFStrEscVDetok@ScanTokenWithSpace@i#1\FV@<Sentinel>}} +\begingroup +\catcode`\!=0\relax +\catcode`\\=12!relax +!gdef!FV@PDFStrEscVDetok@ScanTokenActiveSpace{\040!FV@PDFStrEscVDetok@ScanToken}% +!catcode`!\=0!relax +\endgroup +\gdef\FV@PDFStrEscVDetok@ScanTokenWithSpace@i#1#2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FV@PDFStrEscVDetok@ScanTokenEscSpace{#1}}% + {\FV@PDFStrEscVDetok@ScanTokenCW{#1}{#2}}} +\begingroup +\catcode`\!=0\relax +\catcode`\\=12!relax +!gdef!FV@PDFStrEscVDetok@ScanTokenEscSpace#1{\040!FV@PDFStrEscVDetok@ScanToken} +!catcode`!\=0!relax +\endgroup +\begingroup +\catcode`\ =12% +\gdef\FV@PDFStrEscVDetok@ScanTokenCW#1#2#3{% +\ifcat\noexpand#2a% +\expandafter\@firstoftwo% +\else% +\expandafter\@secondoftwo% +\fi% +{\FVExtraPDFStringEscapeChars{#2} \FV@PDFStrEscVDetok@ScanToken#3}% +{\FVExtraPDFStringEscapeChars{#2}\FV@PDFStrEscVDetok@ScanToken#3}} +\endgroup +\gdef\FVExtraDetokenizeVArg#1#2{% + \begingroup + \catcode`\^^C=\active + \let^^C\FV@Sentinel + \edef\FV@Tmp{\FVExtraVerbatimDetokenize{#2}}% + \expandafter\FV@DetokenizeVArg@i\expandafter{\FV@Tmp}{#1}} +\gdef\FV@DetokenizeVArg@i#1#2{% + \endgroup + #2{#1}} +\gdef\FVExtraDetokenizeEscVArg#1#2{% + \begingroup + \catcode`\^^C=\active + \let^^C\FV@Sentinel + \edef\FV@Tmp{\FVExtraEscapedVerbatimDetokenize{#2}}% + \expandafter\FV@DetokenizeVArg@i\expandafter{\FV@Tmp}{#1}} +\gdef\FVExtraDetokenizeREscVArg#1#2{% + \begingroup + \catcode`\^^C=\active + \let^^C\FV@Sentinel + \let\FV@EscVDetok@ScanTokenNoSpace\FV@REscVDetok@ScanTokenNoSpace + \let\FV@EscVDetok@ScanTokenWithSpace@i\FV@REscVDetok@ScanTokenWithSpace@i + \edef\FV@Tmp{\FVExtraEscapedVerbatimDetokenize{#2}}% + \expandafter\FV@DetokenizeREscVArg@InvalidEscapeCheck\FV@Tmp\FV@<InvalidEscape>\FV@<Sentinel> + \expandafter\FV@DetokenizeVArg@i\expandafter{\FV@Tmp}{#1}} +\gdef\FV@DetokenizeREscVArg@InvalidEscapeCheck#1\FV@<InvalidEscape>#2\FV@<Sentinel>{% + \if\relax\detokenize{#2}\relax + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi + {\PackageError{fvextra}% + {Invalid backslash escape; only escape ASCII symbols and punctuation}% + {Only use \@backslashchar <char> for ASCII symbols and punctuation}}} +\endgroup +\begingroup +\catcode`\^^C=\active% +\catcode`\^^M=\active% +\gdef\FV@RetokVArg@Read#1^^C^^M{% + \endgroup% + \def\FV@TmpRetoked{#1}}% +\endgroup +\begingroup +\catcode`\^^B=\active +\catcode`\^^C=\active +\gdef\FVExtraRetokenizeVArg#1#2#3{% + \begingroup + #2% + \catcode`\^^B=\active + \catcode`\^^C=\active + \catcode`\^^M=\active + \let^^B\FV@RetokVArg@Read + \let^^C\@empty + \FV@DefEOLEmpty + \scantokens{^^B#3^^C}% + \expandafter\FV@RetokenizeVArg@i\expandafter{\FV@TmpRetoked}{#1}}% +\gdef\FV@RetokenizeVArg@i#1#2{% + #2{#1}} +\endgroup \let\FV@FormattingPrep@PreHook\@empty \let\FV@FormattingPrep@PostHook\@empty \expandafter\def\expandafter\FV@FormattingPrep\expandafter{% @@ -64,12 +905,178 @@ \let\[\FV@leftsquarebracket \let\]\FV@rightsquarebracket } %$ <- highlighting +\def\FV@InlineKeyValues{} +\def\fvinlineset#1{% + \expandafter\def\expandafter\FV@InlineKeyValues\expandafter{% + \FV@InlineKeyValues#1,}} + +\def\FV@UseInlineKeyValues{% + \expandafter\fvset\expandafter{\FV@InlineKeyValues}} +\newbool{FV@extra} +\define@booleankey{FV}{extra}% + {\booltrue{FV@extra}}% + {\boolfalse{FV@extra}} +\fvset{extra=true} +\def\Verb{% + \FVExtraRobustCommand\RobustVerb\FVExtraUnexpandedReadStarOArgBVArg} +\protected\def\RobustVerb{\FV@Command{}{Verb}} +\FVExtrapdfstringdefDisableCommands{% + \def\RobustVerb{}} +\let\FVC@Verb@FV\FVC@Verb +\def\FVC@Verb{% + \begingroup + \FV@UseInlineKeyValues\FV@UseKeyValues + \ifFV@extra + \expandafter\endgroup\expandafter\FVC@Verb@Extra + \else + \expandafter\endgroup\expandafter\FVC@Verb@FV + \fi} +\def\FVC@Verb@Extra{% + \ifbool{FVExtraRobustCommandExpanded}% + {\@ifnextchar\bgroup + {\FVC@Verb@Extra@i}% + {\PackageError{fvextra}% + {\string\Verb\space delimiters must be paired curly braces in this context}% + {Use curly braces as delimiters}}}% + {\FVC@Verb@Extra@i}} +\def\FVC@Verb@Extra@i{% + \begingroup + \FVExtraReadVArg{% + \FV@UseInlineKeyValues\FV@UseKeyValues\FV@FormattingPrep + \FVExtraDetokenizeVArg{% + \FVExtraRetokenizeVArg{\FVC@Verb@Extra@ii}{\FV@CatCodes}}}} +\def\FVC@Verb@Extra@ii#1{% + \ifFV@BreakLines + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FancyVerbBreakStart#1\FancyVerbBreakStop}% + {\mbox{#1}}% + \endgroup} +\let\FVC@SaveVerb@FV\FVC@SaveVerb +\def\FVC@SaveVerb{% + \begingroup + \FV@UseInlineKeyValues\FV@UseKeyValues + \ifFV@extra + \expandafter\endgroup\expandafter\FVC@SaveVerb@Extra + \else + \expandafter\endgroup\expandafter\FVC@SaveVerb@FV + \fi} +\def\FVC@SaveVerb@Extra#1{% + \@namedef{FV@SV@#1}{}% + \@namedef{FV@SVRaw@#1}{}% + \begingroup + \FVExtraReadVArg{% + \FVC@SaveVerb@Extra@i{#1}}} +\def\FVC@SaveVerb@Extra@i#1#2{% + \FV@UseInlineKeyValues\FV@UseKeyValues\FV@FormattingPrep + \FVExtraDetokenizeVArg{% + \FVExtraRetokenizeVArg{\FVC@SaveVerb@Extra@ii{#1}{#2}}{\FV@CatCodes}}{#2}} +\def\FVC@SaveVerb@Extra@ii#1#2#3{% + \global\let\FV@AfterSave\FancyVerbAfterSave + \endgroup + \@namedef{FV@SV@#1}{#3}% + \@namedef{FV@SVRaw@#1}{#2}% + \FV@AfterSave}% +\newbool{FV@retokenize} +\define@booleankey{FV}{retokenize}% + {\booltrue{FV@retokenize}}{\boolfalse{FV@retokenize}} +\def\UseVerb{% + \FVExtraRobustCommand\RobustUseVerb\FVExtraUseVerbUnexpandedReadStarOArgMArg} +\protected\def\RobustUseVerb{\FV@Command{}{UseVerb}} +\FVExtrapdfstringdefDisableCommands{% + \def\RobustUseVerb{}} +\let\FVC@UseVerb@FV\FVC@UseVerb +\def\FVC@UseVerb{% + \begingroup + \FV@UseInlineKeyValues\FV@UseKeyValues + \ifFV@extra + \expandafter\endgroup\expandafter\FVC@UseVerb@Extra + \else + \expandafter\endgroup\expandafter\FVC@UseVerb@FV + \fi} +\def\FVC@UseVerb@Extra#1{% + \@ifundefined{FV@SV@#1}% + {\FV@Error{Short verbatim text never saved to name `#1'}\FV@eha}% + {\begingroup + \FV@UseInlineKeyValues\FV@UseKeyValues\FV@FormattingPrep + \ifbool{FV@retokenize}% + {\expandafter\let\expandafter\FV@Tmp\csname FV@SVRaw@#1\endcsname + \expandafter\FV@UseVerb@Extra@Retok\expandafter{\FV@Tmp}}% + {\expandafter\let\expandafter\FV@Tmp\csname FV@SV@#1\endcsname + \expandafter\FV@UseVerb@Extra\expandafter{\FV@Tmp}}}} +\def\FV@UseVerb@Extra@Retok#1{% + \FVExtraDetokenizeVArg{% + \FVExtraRetokenizeVArg{\FV@UseVerb@Extra}{\FV@CatCodes}}{#1}} +\def\FV@UseVerb@Extra#1{% + \ifFV@BreakLines + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FancyVerbBreakStart#1\FancyVerbBreakStop}% + {\mbox{#1}}% + \endgroup} +\def\EscVerb{% + \FVExtraRobustCommand\RobustEscVerb\FVExtraUnexpandedReadStarOArgBEscVArg} +\protected\def\RobustEscVerb{\FV@Command{}{EscVerb}} +\FVExtrapdfstringdefDisableCommands{% + \def\RobustEscVerb{}} +\def\FVC@EscVerb{% + \@ifnextchar\bgroup + {\FVC@EscVerb@i}% + {\PackageError{fvextra}% + {Invalid argument; argument must be delimited by paired curly braces}% + {Delimit argument with curly braces}}} +\def\FVC@EscVerb@i#1{% + \begingroup + \FV@UseInlineKeyValues\FV@UseKeyValues\FV@FormattingPrep + \FVExtraDetokenizeREscVArg{% + \FVExtraRetokenizeVArg{\FVC@EscVerb@ii}{\FV@CatCodes}}{#1}} +\def\FVC@EscVerb@ii#1{% + \ifFV@BreakLines + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\FancyVerbBreakStart#1\FancyVerbBreakStop}% + {\mbox{#1}}% + \endgroup} +\def\FV@Command#1#2{% + \FVExtra@ifstarVArg + {\def\FV@KeyValues{#1,showspaces}\FV@@Command{#2}}% + {\def\FV@KeyValues{#1}\FV@@Command{#2}}} +\def\FV@@Command#1{% + \FVExtra@ifnextcharVArg[% + {\FV@GetKeyValues{\@nameuse{FVC@#1}}}% + {\@nameuse{FVC@#1}}} +\def\@CustomVerbatimCommand#1#2#3#4{% + \begingroup\fvset{#4}\endgroup + \@ifundefined{FVC@#3}% + {\FV@Error{Command `\string#3' is not a FancyVerb command.}\@eha}% + {\ifcsname Robust#3\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\expandafter\let\expandafter\@tempa\csname #3\endcsname + \def\@tempb##1##2##3{% + \expandafter\def\expandafter\@tempc\expandafter{% + \csname Robust\expandafter\@gobble\string#2\endcsname}% + \def\@tempd####1{% + #1{#2}{##1####1##3}}% + \expandafter\@tempd\@tempc + \expandafter\protected\expandafter\def\@tempc{\FV@Command{#4}{#3}}}% + \expandafter\@tempb\@tempa}% + {#1{#2}{\FV@Command{#4}{#3}}}}} \def\FancyVerbSpace{\textvisiblespace} \newcounter{FV@TrueTabGroupLevel} \def\FV@@ObeyTabs#1{% \let\FV@Space@Orig\FV@Space \let\FV@Space\FV@Space@ObeyTabs - \setcounter{FV@TrueTabGroupLevel}{\the\currentgrouplevel}% + \edef\FV@TmpCurrentGroupLevel{\the\currentgrouplevel}% + \setcounter{FV@TrueTabGroupLevel}{\FV@TmpCurrentGroupLevel}% \addtocounter{FV@TrueTabGroupLevel}{1}% \setbox\FV@TabBox=\hbox{#1}\box\FV@TabBox \let\FV@Space\FV@Space@Orig} @@ -99,7 +1106,7 @@ \newboolean{FV@ObeyTabs@Whitespace@Tab} \def\FV@TrueTab@Group{% \booltrue{FV@ObeyTabs@Whitespace@Tab}% - \gdef\FV@TmpWhitespace{\FV@Tab@ifx}% + \gdef\FV@TmpWhitespace{\FV@FVTabToken}% \FV@ObeyTabs@ScanWhitespace} \def\FV@Space@ObeyTabs{% \ifnum\value{FV@TrueTabGroupLevel}=\the\currentgrouplevel\relax @@ -110,22 +1117,22 @@ \def\FV@Space@ObeyTabs@NoGroup{\FV@Space@Orig} \def\FV@Space@ObeyTabs@Group{% \boolfalse{FV@ObeyTabs@Whitespace@Tab}% - \gdef\FV@TmpWhitespace{\FV@Space@ifx}% + \gdef\FV@TmpWhitespace{\FV@FVSpaceToken}% \FV@ObeyTabs@ScanWhitespace} \def\FV@ObeyTabs@ScanWhitespace{% - \@ifnextchar\FV@Space@ifx% + \@ifnextchar\FV@FVSpaceToken% {\FV@TrueTab@CaptureWhitespace@Space}% - {\ifx\@let@token\FV@Tab@ifx + {\ifx\@let@token\FV@FVTabToken \expandafter\FV@TrueTab@CaptureWhitespace@Tab \else \expandafter\FV@ObeyTabs@ResolveWhitespace \fi}} \def\FV@TrueTab@CaptureWhitespace@Space#1{% - \g@addto@macro\FV@TmpWhitespace{\FV@Space@ifx}% + \g@addto@macro\FV@TmpWhitespace{\FV@FVSpaceToken}% \FV@ObeyTabs@ScanWhitespace} \def\FV@TrueTab@CaptureWhitespace@Tab#1{% \booltrue{FV@ObeyTabs@Whitespace@Tab}% - \g@addto@macro\FV@TmpWhitespace{\FV@Tab@ifx}% + \g@addto@macro\FV@TmpWhitespace{\FV@FVTabToken}% \FV@ObeyTabs@ScanWhitespace} \newbox\FV@TabBox@Group \def\FV@TrueTab@Group@Expand{% @@ -273,6 +1280,15 @@ {}} \g@addto@macro\FV@FormattingPrep@PreHook{\FancyVerbCurlyQuotes} \fvset{curlyquotes=false} +\define@key{FV}{fontencoding}% + {\ifstrempty{#1}% + {\let\FV@FontEncoding\relax}% + {\ifstrequal{#1}{none}% + {\let\FV@FontEncoding\relax}% + {\def\FV@FontEncoding{\fontencoding{#1}}}}} +\expandafter\def\expandafter\FV@SetupFont\expandafter{% + \expandafter\FV@FontEncoding\FV@SetupFont} +\fvset{fontencoding=none} \def\FancyVerbFormatLine#1{#1} \def\FancyVerbFormatText#1{#1} \def\FV@ListProcessLine@NoBreak#1{% @@ -507,7 +1523,18 @@ \colorbox{\FancyVerbHighlightColor}{% \setlength{\fboxsep}{\FV@TmpLength}% \rlap{\strut#1}% - \hspace{\linewidth}}} + \hspace{\linewidth}% + \ifx\FV@RightListFrame\relax\else + \hspace{-\FV@FrameSep}% + \hspace{-\FV@FrameRule}% + \fi + \ifx\FV@LeftListFrame\relax\else + \hspace{-\FV@FrameSep}% + \hspace{-\FV@FrameRule}% + \fi + }% + \hss +} \let\FancyVerbHighlightLineMiddle\FancyVerbHighlightLineFirst \let\FancyVerbHighlightLineLast\FancyVerbHighlightLineFirst \let\FancyVerbHighlightLineSingle\FancyVerbHighlightLineFirst @@ -754,18 +1781,12 @@ } \let\FV@BreakAfterPrep@PygmentsHook\relax \g@addto@macro\FV@FormattingPrep@PreHook{% - \ifcsname pdfmatch\endcsname - \ifx\pdfmatch\relax - \else - \ifcsname inputencodingname\endcsname - \ifx\inputencodingname\relax - \else - \ifdefstring{\inputencodingname}{utf8}% - {\let\FV@BreakBeforePrep\FV@BreakBeforePrep@UTF - \let\FV@BreakAfterPrep\FV@BreakAfterPrep@UTF}% - {}% - \fi\fi - \fi\fi + \ifFV@pdfTeXinputenc + \ifdefstring{\inputencodingname}{utf8}% + {\let\FV@BreakBeforePrep\FV@BreakBeforePrep@UTF + \let\FV@BreakAfterPrep\FV@BreakAfterPrep@UTF}% + {}% + \fi \FV@BreakBeforePrep\FV@BreakAfterPrep} \define@key{FV}{breakanywheresymbolpre}{% \ifstrempty{#1}% @@ -815,12 +1836,12 @@ \ifx\FV@NextChar\FV@Undefined\relax \let\FV@Next=\relax \else - \ifx\FV@NextChar\FV@Space@ifx\relax - \g@addto@macro{\FV@LineIndentChars}{\FV@Space@ifx}% + \ifx\FV@NextChar\FV@FVSpaceToken\relax + \g@addto@macro{\FV@LineIndentChars}{\FV@FVSpaceToken}% \let\FV@Next=\FV@GetLineIndent \else - \ifx\FV@NextChar\FV@Tab@ifx\relax - \g@addto@macro{\FV@LineIndentChars}{\FV@Tab@ifx}% + \ifx\FV@NextChar\FV@FVTabToken\relax + \g@addto@macro{\FV@LineIndentChars}{\FV@FVTabToken}% \let\FV@Next=\FV@GetLineIndent \else \let\FV@Next=\FV@CleanRemainingChars @@ -836,23 +1857,17 @@ \def\FV@Break{% \def\FV@TmpLine{}% \let\FV@LastToken=\FV@Undefined - \ifcsname pdfmatch\endcsname - \ifx\pdfmatch\relax - \else - \ifcsname inputencodingname\endcsname - \ifx\inputencodingname\relax - \else - \ifdefstring{\inputencodingname}{utf8}% - {\ifx\FV@Break@Token\FV@Break@AnyToken - \let\FV@Break@Token\FV@Break@AnyToken@UTF - \else - \ifx\FV@Break@Token\FV@Break@BeforeAfterToken - \let\FV@Break@Token\FV@Break@BeforeAfterToken@UTF - \fi - \fi}% - {}% - \fi\fi - \fi\fi + \ifFV@pdfTeXinputenc + \ifdefstring{\inputencodingname}{utf8}% + {\ifx\FV@Break@Token\FV@Break@AnyToken + \let\FV@Break@Token\FV@Break@AnyToken@UTF + \else + \ifx\FV@Break@Token\FV@Break@BeforeAfterToken + \let\FV@Break@Token\FV@Break@BeforeAfterToken@UTF + \fi + \fi}% + {}% + \fi \FV@Break@Scan } \def\FV@EndBreak{\FV@TmpLine} @@ -939,7 +1954,7 @@ \expandafter\FV@Break@AfterTokenBreak\FV@RescanToken} \def\FV@Break@AfterTokenBreak#1{% \let\FV@LastToken=#1% - \@ifnextchar\FV@Space@ifx% + \@ifnextchar\FV@FVSpaceToken% {\g@addto@macro{\FV@TmpLine}{#1}\FV@Break@Scan}% {\ifthenelse{\boolean{FV@BreakAfterGroup}}% {\ifx\@let@token#1\relax @@ -969,53 +1984,7 @@ {\FV@Break@Scan}% {\g@addto@macro{\FV@TmpLine}{\FancyVerbBreakAfterBreak}% \FV@Break@Scan}} -\ifcsname pdfmatch\endcsname -\ifx\pdfmatch\relax -\else -\def\FV@UTF@two@octets#1#2{% - \ifcsname u8:\detokenize{#1#2}\endcsname - \else - #1#2% - \fi - \FV@Break@NextNext{#1#2}} -\def\FV@UTF@three@octets#1#2#3{% - \ifcsname u8:\detokenize{#1#2#3}\endcsname - \else - #1#2#3% - \fi - \FV@Break@NextNext{#1#2#3}} -\def\FV@UTF@four@octets#1#2#3#4{% - \ifcsname u8:\detokenize{#1#2#3#4}\endcsname - \else - #1#2#3#4% - \fi - \FV@Break@NextNext{#1#2#3#4}} -\begingroup -\catcode`\~=13 -\catcode`\"=12 -\def\FV@UTFviii@loop{% - \uccode`\~\count@ - \uppercase\expandafter{\FV@UTFviii@Tmp}% - \advance\count@\@ne - \ifnum\count@<\@tempcnta - \expandafter\FV@UTFviii@loop - \fi} -\count@"C2 -\@tempcnta"E0 -\def\FV@UTFviii@Tmp{\expandafter\gdef\csname FV@U8:\string~\endcsname{% - \FV@UTF@two@octets}} -\FV@UTFviii@loop -\count@"E0 -\@tempcnta"F0 -\def\FV@UTFviii@Tmp{\expandafter\gdef\csname FV@U8:\string~\endcsname{% - \FV@UTF@three@octets}} -\FV@UTFviii@loop -\count@"F0 -\@tempcnta"F4 -\def\FV@UTFviii@Tmp{\expandafter\gdef\csname FV@U8:\string~\endcsname{% - \FV@UTF@four@octets}} -\FV@UTFviii@loop -\endgroup +\ifFV@pdfTeXinputenc \def\FV@BreakBeforePrep@UTF{% \ifx\FV@BreakBefore\@empty\relax \else @@ -1024,7 +1993,7 @@ \def\FV@BreakBefore@Process##1{% \ifcsname FV@U8:\detokenize{##1}\endcsname \expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{##1}\endcsname - \let\FV@Break@NextNext\FV@BreakBefore@Process@ii + \let\FV@UTF@octets@after\FV@BreakBefore@Process@ii \else \ifx##1\FV@Undefined \let\FV@Break@Next\@gobble @@ -1056,7 +2025,7 @@ \def\FV@BreakAfter@Process##1{% \ifcsname FV@U8:\detokenize{##1}\endcsname \expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{##1}\endcsname - \let\FV@Break@NextNext\FV@BreakAfter@Process@ii + \let\FV@UTF@octets@after\FV@BreakAfter@Process@ii \else \ifx##1\FV@Undefined \let\FV@Break@Next\@gobble @@ -1096,7 +2065,7 @@ \def\FV@Break@AnyToken@UTF#1{% \ifcsname FV@U8:\detokenize{#1}\endcsname \expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{#1}\endcsname - \let\FV@Break@NextNext\FV@Break@AnyToken@UTF@i + \let\FV@UTF@octets@after\FV@Break@AnyToken@UTF@i \else \let\FV@Break@Next\FV@Break@AnyToken@UTF@i \fi @@ -1108,7 +2077,7 @@ \def\FV@Break@BeforeAfterToken@UTF#1{% \ifcsname FV@U8:\detokenize{#1}\endcsname \expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{#1}\endcsname - \let\FV@Break@NextNext\FV@Break@BeforeAfterToken@UTF@i + \let\FV@UTF@octets@after\FV@Break@BeforeAfterToken@UTF@i \else \let\FV@Break@Next\FV@Break@BeforeAfterToken@UTF@i \fi @@ -1167,7 +2136,7 @@ \expandafter\FV@Break@AfterTokenBreak@UTF\expandafter{\FV@RescanToken}} \def\FV@Break@AfterTokenBreak@UTF#1{% \def\FV@LastToken{#1}% - \@ifnextchar\FV@Space@ifx% + \@ifnextchar\FV@FVSpaceToken% {\g@addto@macro{\FV@TmpLine}{#1}\FV@Break@Scan}% {\ifthenelse{\boolean{FV@BreakAfterGroup}}% {\g@addto@macro{\FV@TmpLine}{#1}% @@ -1183,7 +2152,7 @@ \def\FV@Break@AfterTokenBreak@UTF@i#1{% \ifcsname FV@U8:\detokenize{#1}\endcsname \expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{#1}\endcsname - \let\FV@Break@NextNext\FV@Break@AfterTokenBreak@UTF@i + \let\FV@UTF@octets@after\FV@Break@AfterTokenBreak@UTF@i \else \def\FV@NextToken{#1}% \ifx\FV@LastToken\FV@NextToken @@ -1206,7 +2175,7 @@ \def\FV@Break@AfterTokenBreak@Group@UTF@ii#1{% \ifcsname FV@U8:\detokenize{#1}\endcsname \expandafter\let\expandafter\FV@Break@Next\csname FV@U8:\detokenize{#1}\endcsname - \let\FV@Break@NextNext\FV@Break@AfterTokenBreak@Group@UTF@ii + \let\FV@UTF@octets@after\FV@Break@AfterTokenBreak@Group@UTF@ii \else \def\FV@NextToken{#1}% \ifx\FV@LastToken\FV@NextToken @@ -1216,7 +2185,7 @@ \let\FV@Break@Next\FV@Break@Scan \fi \FV@Break@Next#1} -\fi\fi +\fi \def\FV@makeLineNumber{% \hss \FancyVerbBreakSymbolLeftLogic{\FancyVerbBreakSymbolLeft}% @@ -1230,24 +2199,25 @@ \def\FV@RaggedRight{% \let\\\@centercr \@rightskip\@flushglue\rightskip\@rightskip\leftskip\z@skip\parindent\z@} +\newdimen\FV@LineWidth \def\FV@SaveLineBox#1{% \savebox{\FV@LineBox}{% - \advance\linewidth by -\FV@BreakIndent + \advance\FV@LineWidth by -\FV@BreakIndent \hbox to \FV@BreakIndent{\hfill}% \ifthenelse{\boolean{FV@BreakAutoIndent}}% {\let\FV@LineIndentChars\@empty \FV@GetLineIndent#1\FV@Undefined \savebox{\FV@LineIndentBox}{\FV@LineIndentChars}% \hbox to \wd\FV@LineIndentBox{\hfill}% - \advance\linewidth by -\wd\FV@LineIndentBox + \advance\FV@LineWidth by -\wd\FV@LineIndentBox \setcounter{FV@TrueTabCounter}{0}}% {}% \ifdefempty{\FancyVerbBreakSymbolLeft}{}% {\hbox to \FV@BreakSymbolIndentLeft{\hfill}% - \advance\linewidth by -\FV@BreakSymbolIndentLeft}% + \advance\FV@LineWidth by -\FV@BreakSymbolIndentLeft}% \ifdefempty{\FancyVerbBreakSymbolRight}{}% - {\advance\linewidth by -\FV@BreakSymbolIndentRight}% - \parbox[t]{\linewidth}{% + {\advance\FV@LineWidth by -\FV@BreakSymbolIndentRight}% + \parbox[t]{\FV@LineWidth}{% \FV@RaggedRight \leftlinenumbers* \begin{internallinenumbers*}% @@ -1272,13 +2242,14 @@ \hbox to \hsize{% \kern\leftmargin \hbox to \linewidth{% + \FV@LineWidth\linewidth \ifx\FV@RightListFrame\relax\else - \advance\linewidth by -\FV@FrameSep - \advance\linewidth by -\FV@FrameRule + \advance\FV@LineWidth by -\FV@FrameSep + \advance\FV@LineWidth by -\FV@FrameRule \fi \ifx\FV@LeftListFrame\relax\else - \advance\linewidth by -\FV@FrameSep - \advance\linewidth by -\FV@FrameRule + \advance\FV@LineWidth by -\FV@FrameSep + \advance\FV@LineWidth by -\FV@FrameRule \fi \ifx\FV@Tab\FV@TrueTab \let\FV@TrueTabSaveWidth\FV@TrueTabSaveWidth@Save @@ -1291,7 +2262,7 @@ \ifx\FV@Tab\FV@TrueTab \let\FV@TrueTabSaveWidth\relax \fi - \ifdim\wd\FV@LineBox>\linewidth + \ifdim\wd\FV@LineBox>\FV@LineWidth \setcounter{FancyVerbLineBreakLast}{0}% \ifx\FV@Tab\FV@TrueTab \let\FV@Tab\FV@TrueTab@UseWidth @@ -1316,7 +2287,7 @@ \FV@LeftListFrame \FancyVerbFormatLine{% \FancyVerbHighlightLine{% - \parbox[t]{\linewidth}{% + \parbox[t]{\FV@LineWidth}{% \noindent\strut\FV@ObeyTabs{\FancyVerbFormatText{#1}}\strut}}}% \FV@RightListFrame \FV@RightListNumber |