texlive[49947] Master/texmf-dist: fvextra (5feb19)

commits+karl at tug.org commits+karl at tug.org
Tue Feb 5 22:55:49 CET 2019


Revision: 49947
          http://tug.org/svn/texlive?view=revision&revision=49947
Author:   karl
Date:     2019-02-05 22:55:49 +0100 (Tue, 05 Feb 2019)
Log Message:
-----------
fvextra (5feb19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fvextra/README
    trunk/Master/texmf-dist/doc/latex/fvextra/fvextra.pdf
    trunk/Master/texmf-dist/source/latex/fvextra/fvextra.dtx
    trunk/Master/texmf-dist/tex/latex/fvextra/fvextra.sty

Modified: trunk/Master/texmf-dist/doc/latex/fvextra/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fvextra/README	2019-02-05 21:54:20 UTC (rev 49946)
+++ trunk/Master/texmf-dist/doc/latex/fvextra/README	2019-02-05 21:55:49 UTC (rev 49947)
@@ -5,5 +5,10 @@
 Development:  https://github.com/gpoore/fvextra
 
 
-fvextra provides several extensions to fancyvrb, including automatic line 
+fvextra provides several extensions to fancyvrb, including automatic line
 breaking and improved math mode.  It also patches some fancyvrb internals.
+fvextra provides a reimplemented \Verb command that works (with a few
+limitations) inside other commands, even in movable arguments and PDF
+bookmarks.  It also provides \EscVerb, which is similar to \Verb except that
+it works everywhere without limitations by allowing the backslash to serve as
+an escape character.

Modified: trunk/Master/texmf-dist/doc/latex/fvextra/fvextra.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/fvextra/fvextra.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fvextra/fvextra.dtx	2019-02-05 21:54:20 UTC (rev 49946)
+++ trunk/Master/texmf-dist/source/latex/fvextra/fvextra.dtx	2019-02-05 21:55:49 UTC (rev 49947)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2016 by Geoffrey M. Poore <gpoore at gmail.com>
+% Copyright (C) 2016-2019 by Geoffrey M. Poore <gpoore at gmail.com>
 % ---------------------------------------------------------------------------
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -26,7 +26,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{fvextra}
 %<*package>
-    [2017/07/08 v1.3.1 fvextra - extensions and patches for fancyvrb]
+    [2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb]
 %</package>
 %
 %<*driver>
@@ -41,6 +41,20 @@
 
 \usepackage[svgnames]{xcolor}
 \usepackage{upquote}
+% The typesetting for macrocode doesn't use \@noligs, which upquote modifies.
+% So apply the upquote fix to \verbatim at nolig@list as well, which is in macrocode.
+\begingroup
+\catcode`'=\active
+\catcode``=\active
+\g at addto@macro\verbatim at nolig@list{%
+  \let'\textquotesingle
+  \let`\textasciigrave
+  \ifx\encodingdefault\upquote at OTone
+  \ifx\ttdefault\upquote at cmtt
+    \def'{\char13 }%
+    \def`{\char18 }%
+  \fi\fi}
+\endgroup
 \usepackage{fvextra}
 
 \usepackage{dingbat}
@@ -60,6 +74,9 @@
 }
 \usepackage{cleveref}
 
+% A more robust \cmd
+\let\cmd\Verb
+
 % Create a short verbatim pipe that handles quotation marks properly
 \begingroup
 \catcode`\|=\active
@@ -213,7 +230,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{3003}
+% \CheckSum{4882}
 %
 % \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
@@ -232,6 +249,18 @@
 %   Right brace   \}     Tilde         \~}
 %
 %
+% \begin{changelog}{v1.4}{2019/02/04}
+% \item Reimplemented \texttt{\string\Verb}.  It now works as expected inside other commands (with a few limitations), including in movable arguments, and is compatible with \texttt{hyperref} for things like PDF bookmarks.  It now supports \texttt{breaklines} and relevant line-breaking options.
+% \item Reimplemented \texttt{\string\SaveVerb} and \texttt{\string\UseVerb} to be equivalent to the new \texttt{\string\Verb}.  The new option \texttt{retokenize} allows saved verbatim material to be retokenized under new \texttt{commandchars} and \texttt{codes} when it is inserted with \texttt{\string\UseVerb}.
+% \item New command \texttt{\string\EscVerb} works like the reimplemented \texttt{\string\Verb}, except that special characters can be escaped with a backslash.  It works inside other commands without any limitations, including in movable arguments, and is compatible with \texttt{hyperref} for things like PDF bookmarks.
+% \item Added \texttt{extra} option for switching between the reimplemented  \texttt{\string\Verb}, \texttt{\string\SaveVerb}, \texttt{\string\UseVerb} and the original \texttt{fancyvrb} definitions.  Reimplemented versions are used by default.  This option will apply to any future reimplemented commands and environments.
+% \item New command \texttt{\string\fvinlineset} only applies options to commands related to typesetting verbatim inline, like \texttt{\string\Verb}, \texttt{\string\SaveVerb}, \texttt{\string\UseVerb}.  It only works with commands that are defined or reimplemented by \texttt{fvextra}.  It overrides options from \texttt{\string\fvset}.
+% \item Patched \texttt{fancyvrb} so that \texttt{\string\Verb} (either reimplemented version or original) can use characters like \texttt{\%} for delimiters when used outside any commands.
+% \item \texttt{obeytabs} now works with the \texttt{calc} package's redefined \texttt{\string\setcounter}.  Since \texttt{minted} loads \texttt{calc}, this also fixes \texttt{minted} compatibility (\texttt{minted} \#221).
+% \item Added new option \texttt{fontencoding} (\texttt{minted} \#208).
+% \item \texttt{highlightlines} now works correctly with \texttt{frame} (\#7).
+% \end{changelog}
+%
 % \begin{changelog}{v1.3.1}{2017/07/08}
 % \item \texttt{beameroverlays} now works with \texttt{VerbatimOut}.
 % \end{changelog}
@@ -289,12 +318,21 @@
 % \maketitle
 %
 % \begin{abstract}
-% \noindent\fvextra\ provides several extensions to \fancyvrb, including automatic line breaking and improved math mode.  It also patches some \fancyvrb\ internals.
+% \noindent\fvextra\ provides several extensions to \fancyvrb, including automatic line breaking and improved math mode.  \cmd{\Verb} is reimplemented so that it works (with a few limitations) inside other commands, even in movable arguments and PDF bookmarks.  The new command \cmd{\EscVerb} is similar to \cmd{\Verb} except that it works everywhere without limitations by allowing the backslash to serve as an escape character.  \fvextra\ also patches some \fancyvrb\ internals.
 % \end{abstract}
 %
 %
 % \pagebreak
+% \begingroup
+% \makeatletter
+% ^^A https://tex.stackexchange.com/a/45165/10742
+% \patchcmd{\@dottedtocline}
+%   {\rightskip\@tocrmarg}
+%   {\rightskip\@tocrmarg plus 4em \hyphenpenalty\@M}
+%   {}{}
+% \makeatother
 % \tableofcontents
+% \endgroup
 % \pagebreak
 %
 %
@@ -304,13 +342,13 @@
 %
 % Additional verbatim features would be nice, but since \fancyvrb\ has remained almost unchanged for so long, a major upgrade could be problematic.  There are likely many existing documents that tweak or patch \fancyvrb\ internals in a way that relies on the existing implementation.  At the same time, creating a completely new verbatim package would require a major time investment and duplicate much of \fancyvrb\ that remains perfectly functional.  Perhaps someday there will be an amazing new verbatim package.  Until then, we have \fvextra.
 %
-% \fvextra\ is an add-on package that gives \fancyvrb\ several additional features, including automatic line breaking.  Because \fvextra\ patches and overwrites some of the \fancyvrb\ internals, it may not be suitable for documents that rely on the details of the original \fancyvrb\ implementation.  \fvextra\ tries to maintain the default \fancyvrb\ behavior in most cases.  All patches (\cref{sec:patch}) and modifications to \fancyvrb\ defaults (\cref{sec:modifications}) are documented.
+% \fvextra\ is an add-on package that gives \fancyvrb\ several additional features, including automatic line breaking.  Because \fvextra\ patches and overwrites some of the \fancyvrb\ internals, it may not be suitable for documents that rely on the details of the original \fancyvrb\ implementation.  \fvextra\ tries to maintain the default \fancyvrb\ behavior in most cases.  All reimplementations (\cref{sec:reimplemented-cmd-env}), patches (\cref{sec:patch}), and modifications to \fancyvrb\ defaults (\cref{sec:modifications}) are documented.  In most cases, there are options to switch back to original implementations or original default behavior.
 %
-% Some features of \fvextra\ were originally created as part of the \pkg{pythontex} and \pkg{minted} packages.  \fancyvrb-related patches and extensions that currently exist in those packages will gradually be migrated into \fvextra, and both packages will require \fvextra\ in the future.
+% Some features of \fvextra\ were originally created as part of the \pkg{pythontex} and \pkg{minted} packages.  \fancyvrb-related patches and extensions that currently exist in those packages will gradually be migrated into \fvextra.
 %
 %
-% 
 %
+%
 % \section{Usage}
 %
 % \fvextra\ may be used as a drop-in replacement for \fancyvrb.  It will load \fancyvrb\ if it has not yet been loaded, and then proceeds to patch \fancyvrb\ and define additional features.
@@ -351,6 +389,14 @@
 % \end{example}
 %
 %
+% \item[extra (boolean) (true)]
+% Use \fvextra\ reimplementations of \fancyvrb\ commands and environments when available.  For example, use \fvextra's reimplemented \cmd{\Verb} that works (with a few limitations) inside other commands, rather than the original \fancyvrb\ implementation that essentially functions as \cmd{\texttt} inside other commands.
+%
+%
+% \item[fontencoding (string) (\meta{document font encoding})]
+% Set the font encoding inside \pkg{fancyvrb} commands and environments.  Setting |fontencoding=none| resets to the default document font encoding.
+%
+%
 % \item[highlightcolor (string) (LightCyan)]
 % Set the color used for |highlightlines|, using a predefined color name from \pkg{color} or \pkg{xcolor}, or a color defined via |\definecolor|.
 %
@@ -360,7 +406,7 @@
 %
 % The highlighting color can be customized with |highlightcolor|.
 %
-% \begingroup 
+% \begingroup
 % \fvset{xleftmargin=2em}
 % \begin{longexample}
 %   \begin{Verbatim}[numbers=left, highlightlines={1, 3-4}]
@@ -433,6 +479,12 @@
 % \endgroup
 %
 %
+% \item[retokenize (boolean) (false)]
+% By default, \cmd{\UseVerb} inserts saved verbatim material with the catcodes (|commandchars|, |codes|, etc.\@) under which it was originally saved with \cmd{\SaveVerb}.  When |retokenize| is used, the saved verbatim material is retokenized under the settings in place at \cmd{\UseVerb}.
+%
+% This only applies to the reimplemented \cmd{\UseVerb}, when paired with the reimplemented \cmd{\SaveVerb}.  It may be extended to environments (\cmd{\UseVerbatim}, etc.\@) in the future, if the relevant commands and environments are reimplemented.
+%
+%
 % \item[space (macro) (\string\textvisiblespace, \textvisiblespace)]
 % Redefine the visible space character.  Note that this is only used if |showspaces=true|.  The color of the character may be set with |spacecolor|.
 %
@@ -454,7 +506,7 @@
 % \begingroup
 % \fvset{xleftmargin=2em}
 % \begin{longexample}
-%   \begin{Verbatim}[numbers=left, stepnumber=2, 
+%   \begin{Verbatim}[numbers=left, stepnumber=2,
 %                    stepnumberfromfirst]
 %   First line
 %   Second line
@@ -473,7 +525,7 @@
 % \begingroup
 % \fvset{xleftmargin=2em}
 % \begin{longexample}
-%   \begin{Verbatim}[numbers=left, stepnumber=2, 
+%   \begin{Verbatim}[numbers=left, stepnumber=2,
 %                    firstnumber=4, stepnumberoffsetvalues]
 %   First line
 %   Second line
@@ -494,13 +546,13 @@
 % \begingroup
 % \fvset{frame=single, rulecolor=DarkGreen, gobble=4}
 % \begin{VerbatimVerbatim}[breaklines, obeytabs, showtabs]
-%   \begin{Verbatim}[obeytabs, showtabs, breaklines, 
+%   \begin{Verbatim}[obeytabs, showtabs, breaklines,
 %                    tab=\rightarrowfill, tabcolor=orange]
 %   	First	Second	Third	And more text that goes on for a while until wrapping is needed
 %   	First	Second	Third	Forth
 %   \end{Verbatim}
 % \end{VerbatimVerbatim}
-%   \begin{Verbatim}[obeytabs, showtabs, breaklines, 
+%   \begin{Verbatim}[obeytabs, showtabs, breaklines,
 %                    tab=\rightarrowfill, tabcolor=orange]
 %   	First	Second	Third	And more text that goes on for a while until wrapping is needed
 %   	First	Second	Third	Forth
@@ -519,11 +571,19 @@
 %
 % \section{General commands}
 %
+% \subsection{Inline formatting with \cmd{\fvinlineset}}
+% \DescribeMacro{\fvinlineset\marg{options}}
+%
+% This is like \cmd{\fvset}, except that options only apply to commands that typeset inline verbatim, like \cmd{\Verb} and \cmd{\EscVerb}.  Settings from \cmd{\fvinlineset} override those from \cmd{\fvset}.
+%
+% Note that \cmd{\fvinlineset} only works with commands that are reimplemented, patched, or defined by \fvextra; it is not compatible with the original \fancyvrb\ definitions.  
+%
+%
 % \subsection{Line and text formatting}
 %
 % \DescribeMacro{\FancyVerbFormatLine}
 % \DescribeMacro{\FancyVerbFormatText}
-% 
+%
 % \fancyvrb\ defines |\FancyVerbFormatLine|, which can be used to apply custom formatting to each individual line of text.  By default, it takes a line as an argument and inserts it with no modification.  This is equivalent to |\newcommand{\FancyVerbFormatLine}[1]{#1}|.\footnote{The actual definition in \fancyvrb\ is |\def\FancyVerbFormatLine#1{\FV at ObeyTabs{#1}}|.  This is problematic because redefining the macro could easily eliminate |\FV at ObeyTabs|, which governs tab expansion.  \fvextra\ redefines the macro to |\def\FancyVerbFormatLine#1{#1}| and patches all parts of \fancyvrb\ that use |\FancyVerbFormatLine| so that |\FV at ObeyTabs| is explicitly inserted at the appropriate points.}
 %
 % \fvextra\ introduces line breaking, which complicates line formatting.  We might want to apply formatting to the entire line, including line breaks, line continuation symbols, and all indentation, including any extra indentation provided by line breaking.  Or we might want to apply formatting only to the actual text of the line.  \fvextra\ leaves |\FancyVerbFormatLine| as applying to the entire line, and introduces a new command |\FancyVerbFormatText| that only applies to the text part of the line.\footnote{When |breaklines=true|, each line is wrapped in a |\parbox|.  |\FancyVerbFormatLine| is outside the |\parbox|, and |\FancyVerbFormatText| is inside.}   By default, |\FancyVerbFormatText| inserts the text unmodified.  When it is customized, it should not use boxes that do not allow line breaks to avoid conflicts with line breaking code.
@@ -545,12 +605,99 @@
 %
 %
 %
+%
+% \section{Reimplemented commands and environments}
+% \label{sec:reimplemented-cmd-env}
+%
+% \fvextra\ reimplements parts of \fancyvrb.  These new implementations stay close to the original definitions while allowing for new features that otherwise would not be possible.  Reimplemented versions are used by default.  The original implementations may be used via |\fvset{extra=false}| or by using |extra=false| in the optional arguments to a command or environment.
+%
+% \subsection{\cmd{\Verb}}
+% \DescribeMacro{\Verb*\oarg{options}\meta{delim~char~or~\{}\meta{text}\meta{delim~char~or~\}}}
+%
+% The new \cmd{\Verb} works as expected (with a few limitations) inside other commands.  It even works in movable arguments (for example, in \cmd{\section}), and is compatible with \pkg{hyperref} for generating PDF strings (for example, PDF bookmarks).  The \fancyvrb\ definition did work inside some other commands, but essentially functioned as \cmd{\texttt} in that context.
+%
+% \cmd{\Verb} is compatible with |breaklines| and the relevant line-breaking options.  
+%
+% Like the original \fancyvrb\ implementation, the new \cmd{\Verb} can be starred (|*|) as a shortcut for |showspaces|, and accepts optional arguments.
+% \begin{description}
+% \item[Delimiters]  A repeated character like normal \cmd{\verb}, or a pair of curly braces |{...}|.  If curly braces are used, then \meta{text} cannot contain unpaired curly braces.  Note that curly braces should be preferred when using \cmd{\Verb} inside other commands, and curly braces are \emph{required} when \cmd{\Verb} is in a movable argument, such as in a \cmd{\section}.  Non-ASCII characters now work as delimiters under pdfTeX with \pkg{inputenc} using UTF-8.\footnote{Under pdfTeX, non-ASCII code points are processed at the byte rather than code point level, so \cmd{\Verb} must treat a sequence of multiple bytes as the delimiter.}  For example, \Verb{\Verb§verb§} now works as expected.
+% \item[Limitations inside other commands]  While the new \cmd{\Verb} does work inside arbitrary other commands, there are a few limitations.
+%     \begin{itemize}
+%     \item |#| and |%| cannot be used.  If you need them, consider \cmd{\EscVerb} or perhaps \cmd{\SaveVerb} plus \cmd{\UseVerb}.
+%     \item Curly braces are only allowed in pairs.
+%     \item Multiple adjacent spaces will be collapsed into a single space.
+%     \item Be careful with backslashes.  A backslash that is followed by one or more ASCII letters will cause a following space to be lost, if the space is not immediately followed by an ASCII letter.  For example, |\Verb{\r \n}| becomes \texttt{\Verb{\r \n}}, but |\Verb{\r n}| becomes \texttt{\Verb{\r n}}.  Basically, anything that looks like a \LaTeX\ command (control word) will gobble following spaces, unless the next character after the spaces is an ASCII letter.
+%     \item A single |^| is fine, but avoid |^^| because it will serve as an escape sequence for an ASCII command character.
+%     \end{itemize}
+% \item[Using in movable arguments]  \cmd{\Verb} works automatically in movable arguments, such as in a \cmd{\section}.  \cmd{\protect} or similar measures are not needed for \cmd{\Verb} itself, or for any of its arguments, and should not be used.  \cmd{\Verb} performs operations that amount to applying \cmd{\protect} to all of these automatically.
+% \item[\pkg{hyperref} PDF strings] \cmd{\Verb} is compatible with \pkg{hyperref} for generating PDF strings such as PDF bookmarks.  Note that the PDF strings are \emph{always} a literal rendering of the verbatim text, with all \fancyvrb\ options ignored.  For example, things like |showspaces| and |commandchars| have no effect.  If you need options to be applied to obtain desired PDF strings, consider a custom approach, perhaps using \cmd{\texorpdfstring}.
+% \item[Line breaking]  |breaklines| allows breaks at spaces.  |breakbefore|, |breakafter|, and |breakanywhere| function as expected, as do things like |breakaftersymbolpre| and |breakaftersymbolpost|.  Break options that are only applicable to block text like a |Verbatim| environment do not have any effect.  For example, |breakindent| and |breaksymbol| do nothing.
+% \end{description}
+%
+%
+% \subsection{\cmd{\SaveVerb}}
+%
+% \DescribeMacro{\SaveVerb*\oarg{options}\marg{name}\meta{delim~char~or~\{}\meta{text}\meta{delim~char~or~\}}}
+%
+% \cmd{\SaveVerb} is reimplemented so that it is equivalent to the reimplemented \cmd{\Verb}.  Like the new \cmd{\Verb}, it accepts \meta{text} delimited by a pair of curly braces |{...}|.  It supports \cmd{\fvinlineset}.  It also adds support for the new |retokenize| option for \cmd{\UseVerb}.
+%
+%
+% \subsection{\cmd{\UseVerb}}
+%
+% \DescribeMacro{\UseVerb*\oarg{options}\marg{name}}
+%
+% \cmd{\UseVerb} is reimplemented so that it is equivalent to the reimplemented \cmd{\Verb}.  It supports \cmd{\fvinlineset} and |breaklines|.
+%
+% Like \cmd{\Verb}, \cmd{\UseVerb} is compatible with \pkg{hyperref} for generating PDF strings such as PDF bookmarks.  Note that the PDF strings are \emph{always} a literal rendering of the verbatim text, with all \fancyvrb\ options ignored.  For example, things like |showspaces| and |commandchars| have no effect.  The new option |retokenize| also has no effect.  If you need options to be applied to obtain desired PDF strings, consider a custom approach, perhaps using \cmd{\texorpdfstring}
+%
+% There is a new option |retokenize| for \cmd{\UseVerb}.  By default, \cmd{\UseVerb} inserts saved verbatim material with the catcodes (|commandchars|, |codes|, etc.\@) under which it was originally saved with \cmd{\SaveVerb}.  When |retokenize| is used, the saved verbatim material is retokenized under the settings in place at \cmd{\UseVerb}.
+%
+% For example, consider |\SaveVerb{save}{\textcolor{red}{#%}}|:
+% \SaveVerb{save}{\textcolor{red}{#%}}
+% \begin{itemize}
+% \item |\UseVerb{save}| $\Rightarrow$ \UseVerb{save}
+% \item |\UseVerb[commandchars=\\\{\}]{save}| $\Rightarrow$ \UseVerb[commandchars=\\\{\}]{save}
+% \item |\UseVerb[retokenize, commandchars=\\\{\}]{save}| $\Rightarrow$ \UseVerb[retokenize, commandchars=\\\{\}]{save}
+% \end{itemize}
+%
+% 
+%
+%
+%
+% \section{New commands and environments}
+% \label{sec:new-cmd-env}
+%
+% \subsection{\cmd{\EscVerb}}
+% \DescribeMacro{\EscVerb*\oarg{options}\marg{backslash-escaped~text}}
+%
+% This is like \cmd{\Verb} but with backslash escapes to allow for characters such as |#| and |%|.  For example, |\EscVerb{\\Verb{\#\%}}| gives \EscVerb{\\Verb{\#\%}}.  It behaves exactly the same regardless of whether it is used inside another command.  Like the reimplemented \cmd{\Verb}, it works in movable arguments (for example, in \cmd{\section}), and is compatible with \pkg{hyperref} for generating PDF strings (for example, PDF bookmarks).
+%
+% \begin{description}
+% \item[Delimiters] Text must \emph{always} be delimited with a pair of curly braces |{...}|.  This ensures that \cmd{\EscVerb} is always used in the same manner regardless of whether it is inside another command.
+% \item[Escaping rules]\hfill
+%     \begin{itemize}
+%     \item Only printable, non-alphanumeric ASCII characters (symbols, punctuation) can be escaped with backslashes.\footnote{Allowing backslash escapes of letters would lead to ambiguity regarding spaces; see \cmd{\Verb}.}
+%     \item Always escape these characters:  |\|, |%|, |#|.
+%     \item Escape spaces when there are more than one in a row.
+%     \item Escape |^| if there are more than one in a row.
+%     \item Escape unpaired curly braces.
+%     \item Additional symbols or punctuation characters may require escaping if they are made \cmd{\active}, depending on their definitions.
+%     \end{itemize}
+% \item[Using in movable arguments]  \cmd{\EscVerb} works automatically in movable arguments, such as in a \cmd{\section}.  \cmd{\protect} or similar measures are not needed for \cmd{\EscVerb} itself, or for any of its arguments, and should not be used.  \cmd{\EscVerb} performs operations that amount to applying \cmd{\protect} to all of these automatically.
+% \item[\pkg{hyperref} PDF strings] \cmd{\EscVerb} is compatible with \pkg{hyperref} for generating PDF strings such as PDF bookmarks.  Note that the PDF strings are \emph{always} a literal rendering of the verbatim text after backslash escapes have been applied, with all \fancyvrb\ options ignored.  For example, things like |showspaces| and |commandchars| have no effect.  If you need options to be applied to obtain desired PDF strings, consider a custom approach, perhaps using \cmd{\texorpdfstring}.
+% \end{description}
+%
+%
+%
+%
+%
+%
 % \section{Line breaking}
 % \label{sec:breaklines}
 %
 % Automatic line breaking may be turned on with |breaklines=true|.  By default, breaks only occur at spaces.  Breaks may be allowed anywhere with |breakanywhere|, or only before or after specified characters with |breakbefore| and |breakafter|.  Many options are provided for customizing breaks.  A good place to start is the description of |breaklines|.
 %
-% 
+%
 % \subsection{Line breaking options}
 %
 % Options are provided for customizing typical line breaking features.  See \cref{sec:breaklines:advanced} for details about low-level customization of break behavior.
@@ -633,7 +780,7 @@
 % The symbol inserted post-break for breaks inserted by |breakbefore|.
 %
 %
-% \item[breakindent (dimension) (breakindentnchars)]
+% \item[breakindent (dimension) (\meta{breakindentnchars})]
 % When a line is broken, indent the continuation lines by this amount.  When |breakautoindent| and |breakindent| are used together, the indentations add.  This  indentation is combined with |breaksymbolindentleft| to give the total actual left indentation.
 %
 % \item[breakindentnchars (integer) (0)]
@@ -698,20 +845,20 @@
 % The symbol used at breaks (right) when |breaklines=true|. Does not appear at the end of the very last segment of a broken line.
 %
 %
-% \item[breaksymbolindent (dimension) (breaksymbolindentleftnchars)]
+% \item[breaksymbolindent (dimension) (\meta{breaksymbolindentleftnchars})]
 % Alias for |breaksymbolindentleft|.
 %
-% \item[breaksymbolindentnchars (integer) (breaksymbolindentleftnchars)]
+% \item[breaksymbolindentnchars (integer) (\meta{breaksymbolindentleftnchars})]
 % Alias for |breaksymbolindentleftnchars|.
 %
 %
-% \item[breaksymbolindentleft (dimension) (breaksymbolindentleftnchars)]
+% \item[breaksymbolindentleft (dimension) (\meta{breaksymbolindentleftnchars})]
 % The extra left indentation that is provided to make room for |breaksymbolleft|.  This indentation is only applied when there is a |breaksymbolleft|.
 %
 % \item[breaksymbolindentleftnchars (integer) (4)]
 % This allows |breaksymbolindentleft| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
 %
-% \item[breaksymbolindentright (dimension) (breaksymbolindentrightnchars)]
+% \item[breaksymbolindentright (dimension) (\meta{breaksymbolindentrightnchars})]
 % The extra right indentation that is provided to make room for |breaksymbolright|.  This indentation is only applied when there is a |breaksymbolright|.
 %
 % \item[breaksymbolindentrightnchars (integer) (4)]
@@ -718,20 +865,20 @@
 % This allows |breaksymbolindentright| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
 %
 %
-% \item[breaksymbolsep (dimension) (breaksymbolsepleftnchars)]
+% \item[breaksymbolsep (dimension) (\meta{breaksymbolsepleftnchars})]
 % Alias for |breaksymbolsepleft|.
 %
-% \item[breaksymbolsepnchars (integer) (breaksymbolsepleftnchars)]
+% \item[breaksymbolsepnchars (integer) (\meta{breaksymbolsepleftnchars})]
 % Alias for |breaksymbolsepleftnchars|.
 %
 %
-% \item[breaksymbolsepleft (dimension) (breaksymbolsepleftnchars)]
-% The separation between the |breaksymbolleft| and the adjacent text. 
+% \item[breaksymbolsepleft (dimension) (\meta{breaksymbolsepleftnchars})]
+% The separation between the |breaksymbolleft| and the adjacent text.
 %
 % \item[breaksymbolsepleftnchars (integer) (2)]
 % Allows |breaksymbolsepleft| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
 %
-% \item[breaksymbolsepright (dimension) (breaksymbolseprightnchars)]
+% \item[breaksymbolsepright (dimension) (\meta{breaksymbolseprightnchars})]
 % The \emph{minimum} separation between the |breaksymbolright| and the adjacent text.  This is the separation between |breaksymbolright| and the furthest extent to which adjacent text could reach.  In practice, |\linewidth| will typically not be an exact integer multiple of the character width (assuming a fixed-width font), so the actual separation between the |breaksymbolright| and adjacent text will generally be larger than |breaksymbolsepright|.  This ensures that break symbols have the same spacing from the margins on both left and right.  If the same spacing from text is desired instead, |breaksymbolsepright| may be adjusted.  (See the definition of |\FV at makeLineNumber| for implementation details.)
 %
 % \item[breaksymbolseprightnchars (integer) (2)]
@@ -818,7 +965,7 @@
 %\newcommand{\mycmd}[1]{\_before:#1:after\_}
 %\end{verbatim}
 % Then you would discover that line breaking does not occur:
-% 
+%
 % \newcommand{\mycmd}[1]{\_before:#1:after\_}
 % \begin{longexample}
 %   \begin{Verbatim}[commandchars=\\\{\}, breaklines, breakafter=a]
@@ -840,7 +987,7 @@
 %   \end{Verbatim}
 % \end{longexample}
 %
-% Instead of completely redefining macros, it may be more convenient to use |\let|.  For example, 
+% Instead of completely redefining macros, it may be more convenient to use |\let|.  For example,
 %\begin{verbatim}
 %\let\originalmycmd\mycmd
 %\renewcommand{\mycmd}[1]{%
@@ -913,6 +1060,7 @@
 %
 %
 %
+%
 % \section{Patches}
 % \label{sec:patch}
 %
@@ -931,7 +1079,7 @@
 % Various macros associated with |obeytabs=true| are also redefined so that tabs may be expanded regardless of whether they are within a group (within |{...}| with the normal \LaTeX\ meaning due to |commandchars|, etc.).  In the \fancyvrb\ implementation, using |obeytabs=true| when a tab is inside a group typically causes the entire line to vanish.  \fvextra\ patches this so that the tab is expanded and will be visible if |showtabs=true|.  Note, though, that the tab expansion in these cases is only guaranteed to be correct for leading whitespace that is inside a group.  The start of each run of whitespace that is inside a group is treated as a tab stop, whether or not it actually is, due to limitations of the tab expansion algorithm.  A more detailed discussion is provided in the implementation.
 %
 % The example below shows correct tab expansion of leading whitespace within a macro argument.  With \fancyvrb, the line of text would simply vanish in this case.
-% 
+%
 % \begingroup
 % \fvset{frame=single, rulecolor=DarkGreen, gobble=4}
 % \begin{VerbatimVerbatim}[showtabs]
@@ -971,7 +1119,7 @@
 % \label{sec:patch:math}
 %
 % \subsubsection{Spaces}
-% 
+%
 % When typeset math is included within verbatim material, \fancyvrb\ makes spaces within the math appear literally.
 %
 % \begingroup
@@ -1023,8 +1171,13 @@
 %
 %
 %
+% \subsection{Command lookahead tokenization}
+% 
+% \cmd{\FV at Command} is used internally by commands like \cmd{\Verb} to read stars (|*|) and optional arguments (|[...]|) before invoking the core of the command.  This is redefined so that lookahead tokenizes under a verbatim catcode regime.  The original definition could prevent commands like \cmd{\Verb} from using characters like |%| as delimiters, because the lookahead for a star and optional argument could read the |%| and give it its normal meaning of comment character.  The new definition fixes this, so that commands like \cmd{\Verb} behave as closely to \cmd{\verb} as possible.
 %
 %
+%
+%
 % \section{Additional modifications to \fancyvrb}
 % \label{sec:modifications}
 %
@@ -1033,7 +1186,7 @@
 %
 % \subsection{Backtick and single quotation mark}
 %
-% With \fancyvrb, the backtick \texttt{\textasciigrave} and typewriter single quotation mark \texttt{\textquotesingle} are typeset as the left and right curly single quotation marks \texttt{`'}.  \pkg{fvextra} loads the \pkg{upquote} package so that these characters will appear literally by default.  The original \fancyvrb\ behavior can be restored with the \fvextra\ option |curlyquotes| (\cref{sec:general-options}). 
+% With \fancyvrb, the backtick \texttt{\textasciigrave} and typewriter single quotation mark \texttt{\textquotesingle} are typeset as the left and right curly single quotation marks \texttt{`'}.  \pkg{fvextra} loads the \pkg{upquote} package so that these characters will appear literally by default.  The original \fancyvrb\ behavior can be restored with the \fvextra\ option |curlyquotes| (\cref{sec:general-options}).
 %
 %
 % \subsection{Line numbering}
@@ -1044,18 +1197,18 @@
 % \fvextra\ changes line numbering so that when |stepnumber| is used, the actual line numbers that appear are always multiples of |stepnumber| by default, regardless of any |firstnumber| offset.  The original \fancyvrb\ behavior may be turned on by setting |stepnumberoffsetvalues=true| (\cref{sec:general-options}).
 %
 %
-% 
+%
 % \section{Undocumented features of \fancyvrb}
 %
 % \fancyvrb\ defines some potentially useful but undocumented features.
 %
 % \subsection{Undocumented options}
-% 
+%
 % \begin{optionlist}
 %
 % \item[codes* (macro) (\meta{empty})]
 % \fancyvrb's |codes| is used to specify catcode changes.  It overwrites any existing |codes|.  |codes*| appends changes to existing settings.
-%  
+%
 % \item[defineactive* (macro) (\meta{empty})]
 % \fancyvrb's |defineactive| is used to define the effect of active characters.  It overwrites any existing |defineactive|.  |defineactive*| appends changes to existing settings.
 %
@@ -1068,7 +1221,7 @@
 % \subsection{Undocumented macros}
 %
 % \DescribeMacro{\FancyVerbTab}
-% 
+%
 % This defines the visible tab character (\FancyVerbTab) that is used when |showtabs=true|.  The default definition is
 %\begin{verbatim}
 %\def\FancyVerbTab{%
@@ -1123,24 +1276,1760 @@
 %
 % \subsection{Utility macros}
 %
-% \begin{macro}{\FV at Space@ifx}
-% Macro for testing if a |\let| token is |\FV at Space| with |\ifx|.  The space will be active and defined as |\FV at Space|.
+% \subsubsection{\fancyvrb\ space and tab tokens}
+%
+% \begin{macro}{\FV at FVSpaceToken}
+% Macro with the same definition as \fancyvrb's active space.  Useful for |\ifx| comparisons with |\@ifnextchar| lookaheads.
 %    \begin{macrocode}
-\def\FV at Space@ifx{\FV at Space}
+\def\FV at FVSpaceToken{\FV at Space}
 %    \end{macrocode}
 % \end{macro}
 %
 %
-% \begin{macro}{\FV at Tab@ifx}
-% Macro for testing if a |\let| token is |\FV at Tab| with |\ifx|.  The tab will be active and defined as |\FV at Tab|.
+% \begin{macro}{\FV at FVTabToken}
+% Macro with the same definition as \fancyvrb's active tab.  Useful for |\ifx| comparisons with |\@ifnextchar| lookaheads.
 %    \begin{macrocode}
-\def\FV at Tab@ifx{\FV at Tab}
+\def\FV at FVTabToken{\FV at Tab}
 %    \end{macrocode}
 % \end{macro}
 %
 %
+% \subsubsection{ASCII processing}
 %
+% \begin{macro}{\FVExtraDoSpecials}
+% Apply \cmd{\do} to all printable, non-alphanumeric ASCII characters (codepoints |0x20| through |0x7E| except for alphanumeric characters).
 %
+% These punctuation marks and symbols are the most likely characters to be made \cmd{\active}, so it is convenient to be able to change the catcodes for all of them, not just for those in the \cmd{\dospecials} defined in |latex.ltx|:
+% \begin{quote}
+%\begin{verbatim}
+%\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
+%  \do\#\do\^\do\_\do\%\do\~}
+%\end{verbatim}
+% \end{quote}
+% If a command takes an argument delimited by a given symbol, but that symbol has been made \cmd{\active} and defined as \cmd{\outer} (perhaps it is being used as a short \cmd{\verb}), then changing the symbol's catcode is the only way to use it as a delimiter.
+%    \begin{macrocode}
+\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\~}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV at Special:<char>}
+% Create macros for all printable, non-alphanumeric ASCII characters.  This is used in creating backslash escapes that can only be applied to ASCII symbols and punctuation; these macros serve as \cmd{\ifcsname} lookups for valid escapes.
+%    \begin{macrocode}
+\begingroup
+\def\do#1{%
+  \expandafter\global\expandafter
+  \let\csname FV at Special:\expandafter\@gobble\detokenize{#1}\endcsname\relax}
+\FVExtraDoSpecials
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsubsection{Sentinels}
+%
+% Sentinel macros are needed for scanning tokens.
+%
+% There are two contexts in which sentinels may be needed.  In delimited macro arguments, such as |\def\macro#1\sentinel{...}|, a sentinel is needed as the delimiter.  Because the delimiting macro need not be defined, special delimiting macros need not be created for this case.  The important thing is to ensure that the macro name is sufficiently unique to avoid collisions.  Typically, using \cmd{\makeatletter} to allow something like \cmd{\@sentinel} will be sufficient.  For added security, additional characters can be given catcode 11, to allow things like \cmd{\@sent!nel}.
+%
+% The other context for sentinels is in scanning through a sequence of tokens that is delimited by a sentinel, and using \cmd{\ifx} comparisons to identify the sentinel and stop scanning.  In this case, using an undefined macro is risky.  Under normal conditions, the sequence of tokens could contain an undefined macro due to mistyping.  In some \fvextra\ applications, the tokens will have been incorrectly tokenized under a normal catcode regime, and need to be retokenized as verbatim, in which case undefined macros must be expected.  Thus, a sentinel macro whose expansion is resistent to collisions is needed.
+%
+% \begin{macro}{\FV@<Sentinel>}
+% This is the standard default \fvextra\ delimited-macro sentinel.  It is used with \cmd{\makeatletter} by changing |<| and |>| to catcode 11.  The |<| and |>| add an extra level of collision resistance.  Because it is undefined, it is \emph{only} appropriate for use in delimited macro arguments.
+% \end{macro}
+%
+% \begin{macro}{\FV at Sentinel}
+% This is the standard \fvextra\ \cmd{\ifx} comparison sentinel.  It expands to the control word \cmd{\FV@<Sentinel>}, which is very unlikely to be in any other macro since it requires that |@|, |<|, and |>| all have catcode 11 and appear in the correct sequence.  Because its definition is itself undefined, this sentinel will result in an error if it escapes.
+%    \begin{macrocode}
+\begingroup
+\catcode`\<=11
+\catcode`\>=11
+\gdef\FV at Sentinel{\FV@<Sentinel>}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Active character definitions}
+%
+% \begin{macro}{\FV at OuterDefEOLEmpty}
+% Macro for defining the active end-of-line character |^^M| (|\r|), which \fancyvrb\ uses to prevent runaway command arguments.  \fancyvrb\ uses macro definitions of the form
+%\begin{verbatim}
+%\begingroup
+%\catcode`\^^M=\active%
+%\gdef\macro{%
+%  ...
+%  \outer\def^^M{}%
+%  ...
+%}%
+%\endgroup
+%\end{verbatim}
+% While this works, it is nice to avoid the |\begingroup...\endgroup| and especially the requirement that all lines now end with |%| to discard the |^^M| that would otherwise be inserted.
+%    \begin{macrocode}
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FV at OuterDefEOLEmpty{\outer\def^^M{}}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at DefEOLEmpty}
+% The same thing, without the \cmd{\outer}.  This is used to ensure that |^^M| is not \cmd{\outer} when it should be read.
+%    \begin{macrocode}
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FV at DefEOLEmpty{\def^^M{}}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV at OuterDefSTXEmpty}
+% Define start-of-text (STX) |^^B| so that it cannot be used inside other macros.  This makes it possible to guarantee that |^^B| is not part of a verbatim argument, so that it can be used later as a sentinel in retokenizing the argument.
+%    \begin{macrocode}
+\begingroup
+\catcode`\^^B=\active
+\gdef\FV at OuterDefSTXEmpty{\outer\def^^B{}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV at OuterDefETXEmpty}
+% Define end-of-text (ETX) |^^C| so that it cannot be used inside other macros.  This makes it possible to guarantee that |^^C| is not part of a verbatim argument, so that it can be used later as a sentinel in retokenizing the argument.
+%    \begin{macrocode}
+\begingroup
+\catcode`\^^C=\active
+\gdef\FV at OuterDefETXEmpty{\outer\def^^C{}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{pdfTeX with \pkg{inputenc} using UTF-8}
+%
+% Working with verbatim text often involves handling individual code points.  While these are treated as single entities under LuaTeX and XeTeX, under pdfTeX code points must be handled at the byte level instead.  This means that reading a single code point encoded in UTF-8 may involve a macro that reads up to four arguments.
+%
+% Macros are defined for working with non-ASCII code points under pdfTeX.  These are only for use with the \pkg{inputenc} package set to |utf8| encoding.
+%
+% \begin{macro}{\ifFV at pdfTeXinputenc}
+% All of the |UTF| macros are only needed with pdfTeX when \pkg{inputenc} is loaded, so they are created conditionally, inspired by the approach of the \pkg{iftex} package.  The tests deal with the possibility that a previous test using |\ifx| rather than the cleaner |\ifcsname| has already been performed.  These assume that \pkg{inputenc} will be loaded before \fvextra.  The \cmd{\inputencodingname} tests should be redundant after the \cmd{\@ifpackageloaded} test, but do provide some additional safety if another package is faking \pkg{inputenc} being loaded but not providing an equivalent encoding interface.
+%
+% Note that an encoding test of the form
+% \begin{quote}
+%\begin{verbatim}
+%\ifdefstring{\inputencodingname}{utf8}{<true>}{<false>}
+%\end{verbatim}
+% \end{quote}
+% is still required before switching to the |UTF| variants in any given situation.  A document using \pkg{inputenc} can switch encodings (for example, around an \cmd{\input}), so simply checking encoding when \fvextra\ is loaded is \emph{not} sufficient.
+%    \begin{macrocode}
+\newif\ifFV at pdfTeXinputenc
+\FV at pdfTeXinputencfalse
+\ifcsname pdfmatch\endcsname
+\ifx\pdfmatch\relax
+\else
+  \@ifpackageloaded{inputenc}%
+   {\ifcsname inputencodingname\endcsname
+    \ifx\inputencodingname\relax
+    \else
+      \FV at pdfTeXinputenctrue
+    \fi\fi}
+   {}%
+\fi\fi
+%    \end{macrocode}
+% \end{macro}
+%
+% Define |UTF| macros conditionally:
+%    \begin{macrocode}
+\ifFV at pdfTeXinputenc
+%    \end{macrocode}
+%
+%
+% \begin{macro}{\FV at U8:<byte>}
+% Define macros of the form |\FV at U8:<byte>| for each active byte.  These are used for determining whether a token is the first byte in a multi-byte sequence, and if so, invoking the necessary macro to capture the remaining bytes.  The code is adapted from the beginning of |utf8.def|.  Completely capitalized macro names are used to avoid having to worry about |\uppercase|.
+%    \begin{macrocode}
+\begingroup
+\catcode`\~=13
+\catcode`\"=12
+\def\FV at UTFviii@loop{%
+  \uccode`\~\count@
+  \uppercase\expandafter{\FV at UTFviii@Tmp}%
+  \advance\count@\@ne
+  \ifnum\count@<\@tempcnta
+  \expandafter\FV at UTFviii@loop
+  \fi}
+%    \end{macrocode}
+% Setting up 2-byte UTF-8:
+%    \begin{macrocode}
+\count@"C2
+\@tempcnta"E0
+\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
+  \FV at UTF@two at octets}}
+\FV at UTFviii@loop
+%    \end{macrocode}
+% Setting up 3-byte UTF-8:
+%    \begin{macrocode}
+\count@"E0
+\@tempcnta"F0
+\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
+  \FV at UTF@three at octets}}
+\FV at UTFviii@loop
+%    \end{macrocode}
+% Setting up 4-byte UTF-8:
+%    \begin{macrocode}
+\count@"F0
+\@tempcnta"F4
+\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
+  \FV at UTF@four at octets}}
+\FV at UTFviii@loop
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV at UTF@two at octets}%
+% \begin{macro}{\FV at UTF@three at octets}%
+% \begin{macro}{\FV at UTF@four at octets}
+% These are variants of the |utf8.def| macros that capture all bytes of a multi-byte code point and then pass them on to \cmd{\FV at UTF@octets at after} as a single argument for further processing.  The invoking macro should \cmd{\let} or \cmd{\def}'ed \cmd{\FV at UTF@octets at after} to an appropriate macro that performs further processing.
+%
+% Typical use will involve the following steps:
+% \begin{enumerate}
+% \item Read a token, say |#1|.
+% \item Use |\ifcsname FV at U8:\detokenize{#1}\endcsname| to determine that the token is the first byte of a multi-byte code point.
+% \item Ensure that |\FV at UTF@octets at after| has an appropriate value, if this has not already been done.
+% \item Use |\csname FV at U8:\detokenize{#1}\endcsname#1| at the end of the original reading macro to read the full multi-byte code point and then pass it on as a single argument to |\FV at UTF@octets at after|.
+% \end{enumerate}
+%
+% All code points are checked for validity here so as to raise errors as early as possible.  Otherwise an invalid terminal byte sequence might gobble a sentinel macro in a scanning context, potentially making debugging much more difficult.  It would be possible to use |\UTFviii at defined{|\meta{bytes}|}| to trigger an error directly, but the current approach is to attempt to typeset invalid code points, which should trigger errors without relying on the details of the |utf8.def| implementation.
+%    \begin{macrocode}
+\def\FV at UTF@two at octets#1#2{%
+  \ifcsname u8:\detokenize{#1#2}\endcsname
+  \else
+    #1#2%
+  \fi
+  \FV at UTF@octets at after{#1#2}}
+\def\FV at UTF@three at octets#1#2#3{%
+  \ifcsname u8:\detokenize{#1#2#3}\endcsname
+  \else
+    #1#2#3%
+  \fi
+  \FV at UTF@octets at after{#1#2#3}}
+\def\FV at UTF@four at octets#1#2#3#4{%
+  \ifcsname u8:\detokenize{#1#2#3#4}\endcsname
+  \else
+    #1#2#3#4%
+  \fi
+  \FV at UTF@octets at after{#1#2#3#4}}
+%    \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+%
+% End conditional creation of |UTF| macros:
+%    \begin{macrocode}
+\fi
+%    \end{macrocode}
+%
+%
+%
+%
+% \subsection{Reading and processing command arguments}
+%
+% \fvextra\ provides macros for reading and processing verbatim arguments.  These are primarily intended for creating commands that take verbatim arguments but can still be used within other commands (with some limitations).  These macros are used in reimplementing \fancyvrb\ commands like \cmd{\Verb}.  They may also be used in other packages; \pkg{minted} and \pkg{pythontex} use them for handling inline code.
+%
+% All macros meant for internal use have names of the form \cmd{\FV@<Name>}, while all macros meant for use in other packages have names of the form \cmd{\FVExtra<Name>}.  Only the latter are intended to have a stable interface.
+%
+%
+% \subsubsection{Tokenization and lookahead}
+%
+% \begin{macro}{\FVExtra at ifnextcharVArg}
+% This is a wrapper for \cmd{\@ifnextchar} from |latex.ltx| (|ltdefns.dtx|) that tokenizes lookaheads under a mostly verbatim catcode regime rather than the current catcode regime.  This is important when looking ahead for stars |*| and optional argument delimiters~|[|, because if these are not present when looking ahead for a verbatim argument, then the first thing tokenized will be the verbatim argument's delimiting character.  Ideally, the delimiter should be tokenized under a verbatim catcode regime.  This is necessary for instance if the delimiter is \cmd{\active} and \cmd{\outer}.
+%
+% The catcode of the space is preserved (in the unlikely event it is \cmd{\active}) and curly braces are given their normal catcodes for the lookahead.  This simplifies space handling in an untokenized context, and allows paired curly braces to be used as verbatim delimiters.
+%    \begin{macrocode}
+\long\def\FVExtra at ifnextcharVArg#1#2#3{%
+  \begingroup
+  \edef\FV at TmpSpaceCat{\the\catcode` }%
+  \let\do\@makeother\FVExtraDoSpecials
+  \catcode`\ =\FV at TmpSpaceCat\relax
+  \catcode`\{=1
+  \catcode`\}=2
+  \@ifnextchar#1{\endgroup#2}{\endgroup#3}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtra at ifstarVArg}
+% A starred command behaves differently depending on whether it is followed by an optional star or asterisk |*|.  \cmd{\@ifstar} from |latex.ltx| is typically used to check for the |*|.  In the process, it discards following spaces (catcode 10) and tokenizes the next non-space character under the current catcode regime.  While this is fine for normal commands, it is undesirable if the next character turns out to be not a |*| but rather a verbatim argument's delimiter.  This reimplementation prevents such issues for all printable ASCII symbols via \cmd{\FVExtra at ifnextcharVArg}.
+%    \begin{macrocode}
+\begingroup
+\catcode`\*=12
+\gdef\FVExtra at ifstarVArg#1{\FVExtra at ifnextcharVArg*{\@firstoftwo{#1}}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Reading arguments}
+%
+% \begin{macro}{\FV at ReadOArgContinue}
+% Read a macro followed by an optional argument, then pass the optional argument to the macro for processing and to continue.
+%    \begin{macrocode}
+\def\FV at ReadOArgContinue#1[#2]{#1{#2}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraReadOArgBeforeVArg}
+% Read an optional argument that comes before a verbatim argument.  The lookahead for the optional argument tokenizes with a verbatim catcode regime in case it encounters the delimiter for the verbatim argument rather than |[|.  If the lookahead doesn't find |[|, the optional argument for \cmd{\FVExtraReadOArgBeforeVArg} can be used to supply a default optional argument other than \meta{empty}.
+%    \begin{macrocode}
+\newcommand{\FVExtraReadOArgBeforeVArg}[2][]{%
+  \FVExtra at ifnextcharVArg[%
+   {\FV at ReadOArgContinue{#2}}%
+   {\FV at ReadOArgContinue{#2}[#1]}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraReadOArgBeforeVEnv}
+% Read an optional argument that comes before the contents of a verbatim environment, after the |\begin{|\meta{environment}|}| but before the start of the next line where the verbatim content begins.  Note that this is not needed when an environment takes a mandatory argument that follows the optional argument.
+%
+% The case with only an optional argument is tricky because the default behavior of \cmd{\@ifnextchar} is to read into the next line looking for the optional argument.  Setting |^^M| \cmd{\active} prevents this.  That does mean, though, that the end-of-line token will have to be read and removed later as an \cmd{\active} |^^M|.  See the definition of \cmd{\FV at BeginScanning} in \fancyvrb\ for an example of doing this:
+% \begin{quote}
+%\begin{verbatim}
+%\begingroup
+%\catcode`\^^M=\active
+%  \gdef\FV at BeginScanning#1^^M{%
+%    \def\@tempa{#1}\ifx\@tempa\@empty\else\FV at BadBeginError\fi%
+%    \FV at GetLine}%
+%\endgroup
+%\end{verbatim}
+% \end{quote}
+%
+% \cmd{\@ifnextchar} is used instead of \cmd{\FVExtra at ifnextcharVArg} because the latter is not needed since there is an explicit, required delimiter (|^^M|) before the actual start of verbatim content.  Lookahead can never tokenize verbatim content under an incorrect catcode regime.
+%    \begin{macrocode}
+\newcommand{\FVExtraReadOArgBeforeVEnv}[2][]{%
+  \begingroup
+  \catcode`\^^M=\active
+  \@ifnextchar[%
+   {\endgroup\FV at ReadOArgContinue{#2}}%
+   {\endgroup\FV at ReadOArgContinue{#2}[#1]}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraReadVArg}
+% Read a verbatim argument that is bounded by two identical characters or by paired curly braces.  This uses the \cmd{\outer} |^^M| with \cmd{\FV at EOL} trick from \fancyvrb\ to prevent runaway arguments.  An \cmd{\outer} |^^C| is used to prevent |^^C| from being part of arguments, so that it can be used later as a sentinel if retokenization is needed.  |^^B| is handled in the same manner for symmetry with later usage, though technically it is not used as a sentinel so this is not strictly necessary.  Alternate |UTF| macros, defined later, are invoked when under pdfTeX with \pkg{inputenc} using UTF-8.
+%
+% The lookahead for the type of delimiting character is done under a verbatim catcode regime, except that the space catcode is preserved and curly braces are given their normal catcodes.  This provides consistency with any \cmd{\FVExtra at ifnextcharVArg} or \cmd{\FVExtra at ifstarVArg} that may have been used previously, allows characters like |#| and |%| to be used as delimiters when the verbatim argument is read outside any other commands (untokenized), and allows paired curly braces to serve as delimiters.  Any additional command-specific catcode modifications should only be applied to the argument after it has been read, since they do not apply to the delimiters.
+%
+% Once the delimiter lookahead is complete, catcodes revert to full verbatim, and are then modified appropriately given the type of delimiter.  The space and tab must be \cmd{\active} to be preserved correctly when the verbatim argument is not inside any other commands (otherwise, they collapse into single spaces).
+%    \begin{macrocode}
+\def\FVExtraReadVArg#1{%
+  \begingroup
+  \ifFV at pdfTeXinputenc
+    \ifdefstring{\inputencodingname}{utf8}%
+     {\let\FV at ReadVArg@Char\FV at ReadVArg@Char at UTF}%
+     {}%
+  \fi
+  \edef\FV at TmpSpaceCat{\the\catcode` }%
+  \let\do\@makeother\FVExtraDoSpecials
+  \catcode`\^^B=\active
+  \FV at OuterDefSTXEmpty
+  \catcode`\^^C=\active
+  \FV at OuterDefETXEmpty
+  \catcode`\^^M=\active
+  \FV at OuterDefEOLEmpty
+  \begingroup
+  \catcode`\ =\FV at TmpSpaceCat\relax
+  \catcode`\{=1
+  \catcode`\}=2
+  \@ifnextchar\bgroup
+   {\endgroup
+    \catcode`\{=1
+    \catcode`\}=2
+    \catcode`\ =\active
+    \catcode`\^^I=\active
+    \FV at ReadVArg@Group{#1}\FV at EOL}%
+   {\endgroup
+    \catcode`\ =\active
+    \catcode`\^^I=\active
+    \FV at ReadVArg@Char{#1}\FV at EOL}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at ReadVArg@Group}
+% The argument is read under the verbatim catcode regime already in place from \cmd{\FVExtraReadVArg}.  The \cmd{\endgroup} returns to prior catcodes.  Any command-specific catcodes can be applied later via \cmd{\scantokens}.  Using them here in reading the argument would have no effect as far as later processing with \cmd{\scantokens} is concerned, unless the argument were read outside any other commands and additional characters were given catcodes 1 or 2 (like the curly braces).  That scenario is not allowed because it makes reading the argument overly dependent on the argument content.  (Technically, reading the argument is already dependent on the argument content in the sense that the argument cannot contain unescaped unpaired curly braces, given that it is delimited by curly braces.)
+%    \begin{macrocode}
+\def\FV at ReadVArg@Group#1#2#3{%
+  \endgroup
+  #1{#3}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at ReadVArg@Char}
+% The delimiting character is read under the verbatim catcode regime in place from \cmd{\FVExtraReadVArg}.  If the command is not inside a normal command, then this means the delimiting character will typically have catcode 12 and that characters like |#| and |%| can be used as delimiters; otherwise, the delimiter may have any catcode that is possible for a single character captured by a macro.  If the argument is read inside another command (already tokenized), then it is possible for the delimiter to be a control sequence rather than a singler character.  An error is raised in this case.  The \cmd{\endgroup} in \cmd{\FV at ReadVArg@Char at i} returns to prior catcodes after the argument is captured.
+%
+% It would be possible to read the argument using any command-specific catcode settings, but that would result in different behavior depending on whether the argument is already tokenized, and would make reading the argument overly dependent on the argument content.
+%    \begin{macrocode}
+\def\FV at 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 at ReadVArg@Char at i##1##2##3#3{%
+    \endgroup
+    ##1{##3}}%
+  \FV at ReadVArg@Char at i{#1}\FV at EOL}%
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Alternate implementation for pdfTeX with \pkg{inputenc} using UTF-8}\hfill\\
+%
+% Start conditional creation of macros:
+%    \begin{macrocode}
+\ifFV at pdfTeXinputenc
+%    \end{macrocode}
+%
+% \begin{macro}{\FV at ReadVArg@Char at UTF}
+% This is a variant of \cmd{\FV at ReadVArg@Char} that allows non-ASCII codepoints as delimiters under the pdfTeX engine with \pkg{inputenc} using UTF-8.  Under pdfTeX, non-ASCII codepoints must be handled as a sequence of bytes rather than as a single entity.  \cmd{\FV at ReadVArg@Char} is automatically \cmd{\let} to this version when appropriate.  This uses the \cmd{\FV at U8:<byte>} macros for working with \pkg{inputenc}'s UTF-8.
+%    \begin{macrocode}
+\def\FV at ReadVArg@Char at 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 at U8:\detokenize{#3}\endcsname
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\def\FV at UTF@octets at after##1{\FV at ReadVArg@Char at UTF@i{#1}{##1}}%
+   \csname FV at U8:\detokenize{#3}\endcsname#3}%
+  {\FV at ReadVArg@Char at UTF@i{#1}{#3}}}
+%    \end{macrocode}
+%
+% \begin{macro}{\FV at ReadVArg@Char at UTF@i}
+%    \begin{macrocode}
+\def\FV at ReadVArg@Char at UTF@i#1#2{%
+  \def\FV at ReadVArg@Char at i##1##2##3#2{%
+    \endgroup
+    ##1{##3}}%
+  \FV at ReadVArg@Char at i{#1}\FV at EOL}%
+%    \end{macrocode}
+% \end{macro}
+%
+% End conditional creation of |UTF| macros:
+%   \begin{macrocode}
+\fi
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsubsection{Reading and protecting arguments in expansion-only contexts}
+%
+% The objective here is to make possible commands that can function correctly after being in expansion-only contexts like \cmd{\edef}.  The general strategy is to allow commands to be defined like this:
+%\begin{verbatim}
+%\def\cmd{\FVExtraRobustCommand\robustcmd\reader}
+%\end{verbatim}
+% |\robustcmd| is the actual command, including argument reading and processing, and is \cmd{\protected}.  |\reader| is an expandable macro that reads all of |\robustcmd|'s arguments, then wraps them in \cmd{\FVExtraAlwaysUnexpanded}.  When |\FVExtraAlwaysUnexpanded{|\meta{args}|}| is expanded, the result is always |\FVExtraAlwaysUnexpanded{|\meta{args}|}|.  |\FVExtraRobustCommand| is \cmd{\protected} and manages everything in a context-sensitive manner.
+% \begin{itemize}
+% \item In a normal context, \cmd{\FVExtraRobustCommand} reads two arguments, which will be |\robustcmd| and |\reader|.  It detects that |\reader| has not expanded to |\FVExtraAlwaysUnexpanded{|\meta{args}|}|, so it discards |\reader| and reinserts |\robustcmd| so that it can operate normally.
+% \item In an expansion-only context, neither \cmd{\FVExtraRobustCommand} nor |\robustcmd| will expand, because both are \cmd{\protected}.  |\reader| will read |\robustcmd|'s arguments and protect them with \cmd{\FVExtraAlwaysUnexpanded}.  When this is used later in a normal context, \cmd{\FVExtraRobustCommand} reads two arguments, which will be |\robustcmd| and \cmd{\FVExtraAlwaysUnexpanded}.  It detects that |\reader| did expand, so it discards \cmd{\FVExtraAlwaysUnexpanded} and reads its argument to discard the wrapping braces.  Then it reinserts |\robustcmd|\meta{args} so that everything can proceed as if expansion had not occurred.
+% \end{itemize}
+%
+% \begin{macro}{\FVExtrapdfstringdef}
+% \begin{macro}{\FVExtrapdfstringdefDisableCommands}
+% Conditionally allow alternate definitions for PDF bookmarks when \pkg{hyperref} is in use.  This is helpful for working with \cmd{\protected} or otherwise unexpandable commands.
+%    \begin{macrocode}
+\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}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\FVExtraAlwaysUnexpanded}
+% Always expands to itself, thanks to \cmd{\unexpanded}.
+%    \begin{macrocode}
+\long\def\FVExtraAlwaysUnexpanded#1{%
+  \unexpanded{\FVExtraAlwaysUnexpanded{#1}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \long\def\FVExtraAlwaysUnexpanded#1{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{FVExtraRobustCommandExpanded}
+% Boolean to track whether expansion occurred.  Set in \cmd{\FVExtraRobustCommand}.  Useful in creating commands that behave differently depending on whether expansion occurred.
+%    \begin{macrocode}
+\newbool{FVExtraRobustCommandExpanded}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVExtraRobustCommand}
+%    \begin{macrocode}
+\protected\def\FVExtraRobustCommand#1#2{%
+  \ifx#2\FVExtraAlwaysUnexpanded
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\booltrue{FVExtraRobustCommandExpanded}\FV at RobustCommand@i{#1}}%
+  {\boolfalse{FVExtraRobustCommandExpanded}#1}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\FVExtraRobustCommand{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at RobustCommand@i}
+% |#2| will be the argument of \cmd{\FVExtraAlwaysUnexpanded}.  Reading this strips the braces.  At the beginning of |#2| will be the reader macro, which must be \cmd{\@gobble}'d.
+%    \begin{macrocode}
+\def\FV at RobustCommand@i#1#2{\expandafter#1\@gobble#2}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVExtraUnexpandedReadStarOArgMArg}
+% Read the arguments for a command that may be starred, may have an optional argument, and has a single brace-delimited mandatory argument.  Then protect them with \cmd{\FVExtraAlwaysUnexpanded}.  The reader macro is itself maintained in the protected result, so that it can be redefined to provide a simple default value for \pkg{hyperref}.
+%
+% Note the argument signature |#1#{|.  This reads everything up to, but not including, the next brace group.
+%    \begin{macrocode}
+\def\FVExtraUnexpandedReadStarOArgMArg#1#{%
+  \FV at UnexpandedReadStarOArgMArg@i{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at UnexpandedReadStarOArgMArg@i}
+%    \begin{macrocode}
+\def\FV at UnexpandedReadStarOArgMArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgMArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UnexpandedReadStarOArgMArg@i#1#2{#2}%
+  \makeatother}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraUseVerbUnexpandedReadStarOArgMArg}
+% This is a variant of \cmd{\FVExtraUnexpandedReadStarOArgMArg} customized for \cmd{\UseVerb}.  It would be tempting to use \cmd{\pdfstringdef} to define a PDF string based on the final tokenization in \cmd{\UseVerb}, rather than applying \cmd{\FVExtraPDFStringVerbatimDetokenize} to the original raw (read) tokenization.  Unfortunately, \cmd{\pdfstringdef} apparently can't handle catcode 12 |\| and |%|.  Since the final tokenization could contain arbitrary catcodes, that approach might fail even if the |\| and |%| issue were resolved.  It may be worth considering more sophisticated approaches in the future.
+%    \begin{macrocode}
+\def\FVExtraUseVerbUnexpandedReadStarOArgMArg#1#{%
+  \FV at UseVerbUnexpandedReadStarOArgMArg@i{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at UseVerbUnexpandedReadStarOArgMArg@i}
+%    \begin{macrocode}
+\def\FV at UseVerbUnexpandedReadStarOArgMArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUseVerbUnexpandedReadStarOArgMArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UseVerbUnexpandedReadStarOArgMArg@i#1#2{%
+    \ifcsname FV at SVRaw@#2\endcsname
+      \expandafter\expandafter\expandafter\FVExtraPDFStringVerbatimDetokenize
+      \expandafter\expandafter\expandafter{\csname FV at SVRaw@#2\endcsname}%
+    \fi}%
+  \makeatother}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraUnexpandedReadStarOArgBVArg}
+% Same as \cmd{\FVExtraUnexpandedReadStarOArgMArg}, except |BVArg|, brace-delimited verbatim argument.
+%    \begin{macrocode}
+\def\FVExtraUnexpandedReadStarOArgBVArg#1#{%
+  \FV at UnexpandedReadStarOArgBVArg@i{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at UnexpandedReadStarOArgBVArg@i}
+%    \begin{macrocode}
+\def\FV at UnexpandedReadStarOArgBVArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgBVArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UnexpandedReadStarOArgBVArg@i#1#2{%
+    \FVExtraPDFStringVerbatimDetokenize{#2}}%
+  \makeatother}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraUnexpandedReadStarOArgBEscVArg}
+% Same as \cmd{\FVExtraUnexpandedReadStarOArgMArg}, except |BEscVArg|, brace-delimited escaped verbatim argument.
+%    \begin{macrocode}
+\def\FVExtraUnexpandedReadStarOArgBEscVArg#1#{%
+  \FV at UnexpandedReadStarOArgBEscVArg@i{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at UnexpandedReadStarOArgBEscVArg@i}
+%    \begin{macrocode}
+\def\FV at UnexpandedReadStarOArgBEscVArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgBEscVArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UnexpandedReadStarOArgBEscVArg@i#1#2{%
+    \FVExtraPDFStringEscapedVerbatimDetokenize{#2}}%
+  \makeatother}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsubsection{Converting detokenized tokens into PDF strings}
+%
+% At times it will be convenient to convert detokenized tokens into PDF strings, such as bookmarks.  Define macros to escape such detokenized content so that it is in a suitable form.
+%
+% \begin{macro}{\FVExtraPDFStringEscapeChar}
+% Note that this does not apply any special treatment to spaces.  If there are multiple adjacent spaces, then the octal escape \cmd{\040} is needed to prevent them from being merged.  In the detokenization macros where \cmd{\FVExtraPDFStringEscapeChar} is currently used, spaces are processed separately without \cmd{\FVExtraPDFStringEscapeChar}, and literal spaces or \cmd{\040} are inserted in a context-dependent manner.
+%    \begin{macrocode}
+\def\FVExtraPDFStringEscapeChar#1{%
+  \ifcsname FV at PDFStringEscapeChar@#1\endcsname
+    \csname FV at 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 at PDFStringEscapeChar@\!endcsname{\\}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@%!endcsname{\%}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@(!endcsname{\(}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@)!endcsname{\)}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^J!endcsname{\n}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^M!endcsname{\r}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^I!endcsname{\t}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^H!endcsname{\b}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^L!endcsname{\f}&
+!catcode`!\=0!relax&
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVExtraPDFStringEscapeChars}
+%    \begin{macrocode}
+\def\FVExtraPDFStringEscapeChars#1{%
+  \FV at PDFStringEscapeChars#1\FV at Sentinel}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStringEscapeChars}
+%    \begin{macrocode}
+\def\FV at PDFStringEscapeChars#1{%
+  \ifx#1\FV at Sentinel
+  \else
+    \FVExtraPDFStringEscapeChar{#1}%
+    \expandafter\FV at PDFStringEscapeChars
+  \fi}%
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsubsection{Detokenizing verbatim arguments}
+%
+% Ensure correct catcodes for this subsection (note |<| and |>| for \cmd{\FV@<Sentinel>}):
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =10
+\catcode`\a=11
+\catcode`\<=11
+\catcode`\>=11
+\catcode`\^^C=\active
+%    \end{macrocode}
+%
+%
+% \paragraph{Detokenize as if the original source were tokenized verbatim}\hfill\\
+%
+% \begin{macro}{\FVExtraVerbatimDetokenize}
+% Detokenize tokens as if their original source was tokenized verbatim, rather than under any other catcode regime that may actually have been in place.  This recovers the original source when tokenization was verbatim.  Otherwise, it recovers the closest approximation of the source that is possible given information loss during tokenization (for example, adjacent space characters may be merged into a single space token).  This is useful in constructing nearly verbatim commands that can be used inside other commands.  It functions in an expansion-only context (``fully expandable,'' works in \cmd{\edef}).
+%
+% This yields spaces with catcode 12, \emph{not} spaces with catcode 10 like \cmd{\detokenize}.  Spaces with catcode 10 require special handling when being read by macros, so detokenizing them to catcode 10 makes further processing difficult.  Spaces with catcode 12 may be used just like any other catcode 12 token.
+%
+% This requires that the \cmd{\active} end-of-text (ETX) |^^C| (U+0003) not be defined as \cmd{\outer}, since |^^C| is used as a sentinel.  Usually, it should not be defined at all, or defined to an error sequence.  When in doubt, it may be worth explicitly defining |^^C| before using \cmd{\FVExtraVerbatimDetokenize}:
+% \begin{quote}
+%\begin{verbatim}
+%\begingroup
+%\catcode`\^^C=\active
+%\def^^C{}
+%...
+%\FVExtraVerbatimDetokenize{...}
+%...
+%\endgroup
+%\end{verbatim}
+% \end{quote}
+%
+% \cmd{\detokenize} inserts a space after each control word (control sequence with a name composed of catcode 11 tokens, ASCII letters |[a-zA-Z]|).  For example,
+% \begin{quote}
+% \Verb{\detokenize{\macroA\macroB{}\csname name\endcsname123}}
+% \end{quote}
+% yields
+% \begin{quote}
+% \expandafter\Verb\expandafter{\detokenize{\macroA\macroB{}\csname name\endcsname123}}
+% \end{quote}
+% That is the correct behavior when detokenizing text that will later be retokenized for normal use.  The space prevents the control word from accidentally merging with any letters that follow it immediately, and will be gobbled by the macro when retokenized.  However, the inserted spaces are unwanted in the current context, because
+% \begin{quote}
+% \Verb{\FVExtraVerbatimDetokenize{\macroA\macroB{}\csname name\endcsname123}}
+% \end{quote}
+% should yield
+% \begin{quote}
+% \ttfamily
+% \FVExtraVerbatimDetokenize{\macroA\macroB{}\csname name\endcsname123}
+% \end{quote}
+% Note that the space is visible since it is catcode 12.
+%
+% Thus, \cmd{\FVExtraVerbatimDetokenize} is essentially a context-sensitive wrapper around \cmd{\detokenize} that removes extraneous space introduced by \cmd{\detokenize}.  It iterates through the tokens, detokenizing them individually and then removing any trailing space inserted by \cmd{\detokenize}.
+%    \begin{macrocode}
+\gdef\FVExtraVerbatimDetokenize#1{%
+  \FV at VDetok@Scan{}#1^^C \FV@<Sentinel>}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@Scan}
+% This scans through a token sequence while performing two tasks:
+% \begin{enumerate}
+% \item Replace all catcode 10 spaces with catcode 12 spaces.
+% \item Insert macros that will process groups, after which they will insert yet other macros to process individual tokens.
+% \end{enumerate}
+% Usage must \emph{always} have the form
+% \begin{quote}
+% |\FV at VDetok@Scan{}|\meta{tokens}\Verb*|^^C \FV@<Sentinel>|
+% \end{quote}
+% where |^^C| is \cmd{\active}, the catcode 10 space after |^^C| is mandatory, and \cmd{\FV@<Sentinel>} is a \emph{single}, undefined control word (this is accomplished via catcodes).
+% \begin{itemize}
+% \item \cmd{\FV at VDetok@Scan} searches for spaces to replace.  After any spaces in \meta{tokens} have been handled, the space in \Verb*|^^C \FV@<Sentinel>| triggers space processing.  When \cmd{\FV at VDetok@Scan} detects the sentinel macro \cmd{\FV@<Sentinel>}, scanning stops.
+% \item The |{}| protects the beginning of \meta{tokens}, so that if \meta{tokens} is a group, its braces won't be gobbled.  Later, the inserted |{}| must be stripped so that it does not become part the processed \meta{tokens}.
+% \item |^^C| is a convenient separator between \meta{tokens} and the rest of the sentinel sequence.  
+%     \begin{itemize}
+%     \item Since \cmd{\FV at VDetok@Scan} has delimited arguments, a leading catcode 10 space in \meta{tokens} will be preserved automatically.  Preserving a trailing catcode 10 space is much easier if it is immediately adjacent to a non-space character in the sentinel sequence; two adjacent catcode 10 spaces would be difficult to handle with macro pattern matching.  However, the sentinel sequence must contain a catcode 10 space, so the sentinel sequence must contain at least 3 tokens.
+%     \item Since |^^C| is not a control word, it does not gobble following spaces.  That makes it much easier to assemble macro arguments that contain a catcode 10 space.  This is useful because the sentinel sequence \Verb*|^^C \FV@<Sentinel>| may have to be inserted into processing multiple times (for example, in recursive handling of groups).
+%     \item \cmd{\FVExtraReadVArg} defines |^^C| as \cmd{\outer}, so any verbatim argument read by it is guaranteed not to contain |^^C|.  This is in contrast to \cmd{\active} ASCII symbols and to two-character sequences |<backslash><symbol>| that should be expected in arbitrary verbatim content.  It is a safe sentinel from that perspective.
+%     \item A search of a complete TeX Live 2018 installation revealed no other uses of |^^C| that would clash (thanks, |ripgrep|!).  As a control character, it should not be in common use except as a sentinel or for similar special purposes.
+%     \end{itemize}
+% \end{itemize}
+%
+% If \meta{tokens} is empty or contains no spaces, then |#1| will contain |{}|\meta{tokens}|^^C| and |#2| will be empty.  Otherwise, |#1| will contain |{}|\meta{tokens\_to\_space} and |#2| will contain \meta{tokens\_after\_space}\Verb*|^^C |.
+%
+% This uses the |\if\relax\detokenize{|\meta{argument}|}\relax| approach to check for an empty argument.  If |#2| is empty, then the space that was just removed by \cmd{\FV at VDetok@Scan} reading its arguments was the space in the sentinel sequence, in which case scanning should end.  |#1| is passed on raw so that \cmd{\FV at VDetok@ScanEnd} can strip the |^^C| from the end, which is the only remaining token from the sentinel sequence \Verb*|^^C \FV@<Sentinel>|.  Otherwise, if |#2| is not empty, continue.  In that case, the braces in |{#1}{#2}| ensure arguments remain intact.
+%
+% Note that \cmd{\FV@<Sentinel>} is removed during each space search, and thus must be reinserted in \cmd{\FV at VDetok@ScanCont}.  It would be possible to use the macro signature |#1 #2| instead of |#1 #2\FV@<Sentinel>|, and then do an \cmd{\ifx} test on |#2| for \cmd{\FV@<Sentinel>}.  However, that is problematic, because |#2| may contain an arbitrary sequence of arbitrary tokens, so it cannot be used safely without \cmd{\detokenize}.
+%    \begin{macrocode}
+\gdef\FV at VDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanEnd#1}%
+  {\FV at VDetok@ScanCont{#1}{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanEnd}
+% This removes the |^^C| from the sentinel sequence \Verb*|^^C \FV@<Sentinel>|, so the sentinel sequence is now completely gone.  If |#1| is empty, there is nothing to do (|#1| being empty means that |#1| consumed the |{}| that was inserted to protect anything following, because there was nothing after it).  Otherwise, \cmd{\@gobble} the inserted |{}| before starting a different scan to deal with groups.  The group scanner \cmd{\FV at VDetok@ScanGroup} has its own sentinel sequence |{\FV@<Sentinel>}|.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at VDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanCont}
+% Continue scanning after removing a space in \cmd{\FV at VDetok@Scan}.
+%
+% |#1| is everything before the space.  If |#1| is empty, there is nothing to do related to it; |#1| simply consumed an inserted |{}| that preceded nothing (that would be a leading space).  Otherwise, start a different scan on |#1| to deal with groups.  A non-empty |#1| will start with the |{}| that was inserted to protect groups, hence the \cmd{\@gobble} before group scanning.
+%
+% Then insert a literal catcode 12 space to account for the space removed in \cmd{\FV at VDetok@Scan}.  Note the catcode, and thus the lack of indentation and the |%| to avoid unwanted catcode 12 spaces.
+%
+% |#2| is everything after the space, ending with \Verb*|^^C | from the sentinel sequence \Verb*|^^C \FV@<Sentinel>|.  This needs continued scanning to deal with spaces, with |{}| inserted in front to protect a leading group and \cmd{\FV@<Sentinel>} after to complete the sentinel sequence.
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanCont#1#2{%
+\if\relax\detokenize{#1}\relax%
+\expandafter\@gobble%
+\else%
+\expandafter\@firstofone%
+\fi%
+{\expandafter\FV at VDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}%
+ %<-catcode 12 space
+\FV at VDetok@Scan{}#2\FV@<Sentinel>}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanGroup}
+% The macro argument |#1#| reads up to the next group.  When this macro is invoked, the sentinel sequence |{\FV@<Sentinel>}| is inserted, so there is guaranteed to be at least one group.
+%
+% Everything in |#1| contains no spaces and no groups, and thus is ready for token scanning, with the sentinel \cmd{\FV at Sentinel}.  Note that \cmd{\FV at Sentinel}, which is defined as |\def\FV at Sentinel{\FV@<Sentinel>}|, is used here, \emph{not} \cmd{\FV@<Sentinel>}.  \cmd{\FV@<Sentinel>} is not defined and is thus unsuitable for \cmd{\ifx} comparisons with tokens that may have been tokenized under an incorrect catcode regime and thus are undefined.  \cmd{\FV at Sentinel} \emph{is} defined, and its definition is resistant against accidental collisions.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanGroup#1#{%
+  \FV at VDetok@ScanToken#1\FV at Sentinel
+  \FV at VDetok@ScanGroup at i}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanGroup at i}
+% The braces from the group are stripped during reading |#1|.  Proceed based on whether the group is empty.  If the group is not empty, |{}| must be inserted to protect |#1| in case it is a group, and the new sentinel sequence |\FV@<Sentinel>^^C| is added for the group contents.  \cmd{\FV@<Sentinel>} cannot be used as a sentinel for the group contents, because if this is the sentinel group |{\FV@<Sentinel>}|, then |#1| is \cmd{\FV@<Sentinel>}.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanEmptyGroup}%
+  {\FV at VDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanEmptyGroup}
+% Insert |{}| to handle the empty group, then continue group scanning.
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at VDetok@ScanEmptyGroup({}\FV at VDetok@ScanGroup)
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanGroup at ii}
+% The group is not empty, so determine whether it contains \cmd{\FV@<Sentinel>} and thus is the sentinel group.  The group contents are followed by the sentinel sequence |\FV@<Sentinel>^^C| inserted in \cmd{\FV at VDetok@ScanGroup at i}.  This means that if |#2| is empty, the group did not contain \cmd{\FV@<Sentinel>} and thus is not the sentinel group.  Otherwise, |#2| will be \cmd{\FV@<Sentinel>}.
+%
+% If this is not the sentinel group, then the group contents must be scanned, with surrounding literal braces inserted.  |#1| already contains an inserted leading |{}| to protect groups; see \cmd{\FV at VDetok@ScanGroup at i}.  A sentinel sequence \Verb*|^^C \FV@<Sentinel>| is needed, though.  Then group scanning must continue.
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at VDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at VDetok@Scan#1^^C \FV@<Sentinel>}\FV at VDetok@ScanGroup))
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanToken}
+% Scan individual tokens.  At this point, all spaces and groups have been handled, so this will only ever encounter individual tokens that can be iterated with a |#1| argument.  The sentinel for token scanning is \cmd{\FV at Sentinel}.  This is the appropriate sentinel because \cmd{\ifx} comparisons are now safe (individual tokens) and \cmd{\FV at Sentinel} is defined.  Processing individual detokenized tokens requires the same sentinel sequence as handling spaces, since it can produce them.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at VDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\FV at VDetok@ScanToken at i}
+% If |#2| is empty, then there are no spaces in the detokenized token, so it is either an \cmd{\active} character other than the space, or a two-character sequence of the form |<backslash><symbol>| where the second character is not a space.  Thus, |#1| contains \meta{detokenized}|^^C|.  Otherwise, |#1| contains \meta{detokenized\_without\_space}, and |#2| may be discarded since it contains \Verb*|^^C \FV@<Sentinel>|.  (If the detokenized token contains a space, it is always at the end.)
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanTokenNoSpace#1}%
+  {\FV at VDetok@ScanTokenWithSpace{#1}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanTokenNoSpace}
+% Strip |^^C| sentinel in reading, then insert character(s) and continue scanning.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanTokenNoSpace#1^^C{#1\FV at VDetok@ScanToken}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanTokenWithSpace}
+% Handle a token that when detokenized produces a space.  If there is nothing left once the space is removed, this is the \cmd{\active} space.  Otherwise, process further.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanTokenActiveSpace}%
+  {\FV at VDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanTokenActiveSpace}
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanTokenActiveSpace{ \FV at VDetok@ScanToken}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanTokenWithSpace at i}
+% If there is only one character left once the space is removed, this is the escaped space \Verb*|\ |.  Otherwise, this is a command word that needs further processing.
+%    \begin{macrocode}
+\gdef\FV at VDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanTokenEscSpace{#1}}%
+  {\FV at VDetok@ScanTokenCW{#1#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanTokenEscSpace}
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanTokenEscSpace#1{#1 \FV at VDetok@ScanToken}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at VDetok@ScanTokenCW}
+% Process control words in a context-sensitive manner by looking ahead to the next token (|#2|).  The lookahead must be reinserted into processing, hence the |\FV at VDetok@ScanToken#2|.
+%
+% A control word will detokenize to a sequence of characters followed by a space.  If the following token has catcode 11, then this space represents one or more space characters that must have been present in the original source, because otherwise the catcode 11 token would have become part of the control word's name.  If the following token has another catcode, then it is impossible to determine whether a space was present, so assume that one was not.
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanTokenCW#1#2{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{#1 \FV at VDetok@ScanToken#2}%
+{#1\FV at VDetok@ScanToken#2}}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Detokenize as if the original source were tokenized verbatim, then convert to PDF string}\hfill\\
+%
+% \begin{macro}{\FVExtraPDFStringVerbatimDetokenize}
+% This is identical to \cmd{\FVExtraVerbatimDetokenize}, except that the output is converted to a valid PDF string.  Some spaces are represented with the octal escape \cmd{\040} to prevent adjacent spaces from being merged.
+%    \begin{macrocode}
+\gdef\FVExtraPDFStringVerbatimDetokenize#1{%
+  \FV at PDFStrVDetok@Scan{}#1^^C \FV@<Sentinel>}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@Scan}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanEnd#1}%
+  {\FV at PDFStrVDetok@ScanCont{#1}{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanEnd}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanCont}
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at PDFStrVDetok@ScanCont#1#2{%
+\if\relax\detokenize{#1}\relax%
+\expandafter\@gobble%
+\else%
+\expandafter\@firstofone%
+\fi%
+{\expandafter\FV at PDFStrVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}%
+ %<-catcode 12 space
+\FV at PDFStrVDetok@Scan{}#2\FV@<Sentinel>}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanGroup}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanGroup#1#{%
+  \FV at PDFStrVDetok@ScanToken#1\FV at Sentinel
+  \FV at PDFStrVDetok@ScanGroup at i}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanGroup at i}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanEmptyGroup}%
+  {\FV at PDFStrVDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanEmptyGroup}
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrVDetok@ScanEmptyGroup({}\FV at PDFStrVDetok@ScanGroup)
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanGroup at ii}
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrVDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at PDFStrVDetok@Scan#1^^C \FV@<Sentinel>}\FV at PDFStrVDetok@ScanGroup))
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanToken}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrVDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\FV at PDFStrVDetok@ScanToken at i}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanTokenNoSpace#1}%
+  {\FV at PDFStrVDetok@ScanTokenWithSpace{#1}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanTokenNoSpace}
+% This is modified to use \cmd{\FVExtraPDFStringEscapeChars}.
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanTokenNoSpace#1^^C{%
+  \FVExtraPDFStringEscapeChars{#1}\FV at PDFStrVDetok@ScanToken}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanTokenWithSpace}
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanTokenActiveSpace}%
+  {\FV at PDFStrVDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanTokenActiveSpace}
+% This is modified to use \cmd{\040} rather than a catcode 12 space.
+%    \begin{macrocode}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrVDetok@ScanTokenActiveSpace{\040!FV at PDFStrVDetok@ScanToken}%
+!catcode`!\=0!relax
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanTokenWithSpace at i}
+% If there is only one character left once the space is removed, this is the escaped space \Verb*|\ |.  Otherwise, this is a command word that needs further processing.
+%    \begin{macrocode}
+\gdef\FV at PDFStrVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanTokenEscSpace{#1}}%
+  {\FV at PDFStrVDetok@ScanTokenCW{#1#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanTokenEscSpace}
+% This is modified to add \cmd{\FVExtraPDFStringEscapeChar} and use |\040| for the space, since a space could follow.
+%    \begin{macrocode}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrVDetok@ScanTokenEscSpace#1{%
+  !FVExtraPDFStringEscapeChar{#1}\040!FV at PDFStrVDetok@ScanToken}%
+!catcode`!\=0!relax
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrVDetok@ScanTokenCW}
+% This is modified to add \cmd{\FVExtraPDFStringEscapeChars}.
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at PDFStrVDetok@ScanTokenCW#1#2{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{\FVExtraPDFStringEscapeChars{#1} \FV at PDFStrVDetok@ScanToken#2}%
+{\FVExtraPDFStringEscapeChars{#1}\FV at PDFStrVDetok@ScanToken#2}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Detokenize as if the original source were tokenized verbatim, except for backslash escapes of non-catcode 11 characters}
+%
+% \begin{macro}{\FVExtraEscapedVerbatimDetokenize}
+% This is a variant of \cmd{\FVExtraVerbatimDetokenize} that treats character sequences of the form |\<char>| as escapes for |<char>|.  It is primarily intended for making |\<symbol>| escapes for |<symbol>|, but allowing arbitrary escapes simplifies the default behavior and implementation.  This is useful in constructing nearly verbatim commands that can be used inside other commands, because the backslash escapes allow for characters like |#| and |%|, as well as making possible multiple adjacent spaces via \Verb*|\ |.  It should be applied to arguments that are read verbatim insofar as is possible, except that the backslash |\| should have its normal meaning (catcode 0).  Most of the implementation is identical to that for \cmd{\FVExtraVerbatimDetokenize}.  Only the token processing requires modification to handle backslash escapes.
+%
+% It is possible to restrict escapes to ASCII symbols and punctuation.  See \cmd{\FVExtraDetokenizeREscVArg}.  The disadvantage of restricting escapes is that it prevents functioning in an expansion-only context (unless you want to use undefined macros as a means of raising errors).  The advantage is that it eliminates ambiguity introduced by allowing arbitrary escapes. Backslash escapes of characters with catcode 11 (ASCII letters, |[A-Za-z]|) are typically not necessary, and introduce ambiguity because something like |\x| will gobble following spaces since it will be tokenized originally as a control word.  
+%    \begin{macrocode}
+\gdef\FVExtraEscapedVerbatimDetokenize#1{%
+  \FV at EscVDetok@Scan{}#1^^C \FV@<Sentinel>}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@Scan}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanEnd#1}%
+  {\FV at EscVDetok@ScanCont{#1}{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanEnd}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at EscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanCont}
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanCont#1#2{%
+\if\relax\detokenize{#1}\relax%
+\expandafter\@gobble%
+\else%
+\expandafter\@firstofone%
+\fi%
+{\expandafter\FV at EscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}%
+ %<-catcode 12 space
+\FV at EscVDetok@Scan{}#2\FV@<Sentinel>}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanGroup}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanGroup#1#{%
+  \FV at EscVDetok@ScanToken#1\FV at Sentinel
+  \FV at EscVDetok@ScanGroup at i}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanGroup at i}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanEmptyGroup}%
+  {\FV at EscVDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanEmptyGroup}
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at EscVDetok@ScanEmptyGroup({}\FV at EscVDetok@ScanGroup)
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanGroup at ii}
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at EscVDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at EscVDetok@Scan#1^^C \FV@<Sentinel>}\FV at EscVDetok@ScanGroup))
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanToken}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at EscVDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\FV at EscVDetok@ScanToken at i}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenNoSpace#1}%
+  {\FV at EscVDetok@ScanTokenWithSpace{#1}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \subparagraph{Parallel implementations, with a restricted option}
+% Starting here, there are alternate macros for restricting escapes to ASCII punctuation and symbols.  These alternates have names of the form \cmd{\FV at REscVDetok@<name>}.  They are used in \cmd{\FVExtraDetokenizeREscVArg}.  The alternate \cmd{\FV at REscVDetok@<name>} macros replace invalid escape sequences with the undefined \cmd{\FV@<InvalidEscape>}, which is later scanned for with a delimited macro.
+%
+% \begin{macro}{\FV at EscVDetok@ScanTokenNoSpace}
+% This was modified from \cmd{\FV at VDetok@ScanTokenNoSpace} to discard the first character of multi-character sequences (that would be the backslash |\|).
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanTokenNoSpace#1#2^^C{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {#1\FV at EscVDetok@ScanToken}%
+  {#2\FV at EscVDetok@ScanToken}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at REscVDetok@ScanTokenNoSpace}
+%    \begin{macrocode}
+\gdef\FV at REscVDetok@ScanTokenNoSpace#1#2^^C{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {#1\FV at EscVDetok@ScanToken}%
+  {\ifcsname FV at Special:\detokenize{#2}\endcsname#2\else\noexpand\FV@<InvalidEscape>\fi
+   \FV at EscVDetok@ScanToken}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV at EscVDetok@ScanTokenWithSpace}
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenActiveSpace}%
+  {\FV at EscVDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanTokenActiveSpace}
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanTokenActiveSpace{ \FV at EscVDetok@ScanToken}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanTokenWithSpace at i}
+% If there is only one character left once the space is removed, this is the escaped space \Verb*|\ |.  Otherwise, this is a command word.  A command word is passed on so as to keep the backslash and letters separate.
+%    \begin{macrocode}
+\gdef\FV at EscVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenEscSpace{#1}}%
+  {\FV at EscVDetok@ScanTokenCW{#1}{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at REscVDetok@ScanTokenWithSpace at i}
+%    \begin{macrocode}
+\gdef\FV at REscVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenEscSpace{#1}}%
+  {\noexpand\FV@<InvalidEscape>\FV at EscVDetok@ScanToken}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanTokenEscSpace}
+% This is modified to drop |#1|, which will be the backslash.
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanTokenEscSpace#1{ \FV at EscVDetok@ScanToken}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at EscVDetok@ScanTokenCW}
+% This is modified to accept an additional argument, since the control word is now split into backslash plus letters.
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanTokenCW#1#2#3{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{#2 \FV at EscVDetok@ScanToken#3}%
+{#2\FV at EscVDetok@ScanToken#3}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Detokenize as if the original source were tokenized verbatim, except for backslash escapes of non-catcode 11 characters, then convert to PDF string}
+%
+% \begin{macro}{\FVExtraPDFStringEscapedVerbatimDetokenize}
+% This is identical to \cmd{\FVExtraEscapedVerbatimDetokenize}, except that the output is converted to a valid PDF string.  All spaces are represented with the octal escape \cmd{\040} to prevent adjacent spaces from being merged.  There is no alternate implementation for restricting escapes to ASCII symbols and punctuation.  Typically, this would be used in an expansion-only context to create something like bookmarks, while \cmd{\FVExtraEscapedVerbatimDetokenize} (potentially with escape restrictions) would be used in parallel to generate whatever is actually typeset.  Escape errors can be handled in generating what is typeset.
+%    \begin{macrocode}
+\gdef\FVExtraPDFStringEscapedVerbatimDetokenize#1{%
+  \FV at PDFStrEscVDetok@Scan{}#1^^C \FV@<Sentinel>}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@Scan}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanEnd#1}%
+  {\FV at PDFStrEscVDetok@ScanCont{#1}{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanEnd}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrEscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanCont}
+% This is modified to use |\040| for the space.  In the unescaped case, using a normal space here is fine, but in the escaped case, the preceeding or following token could be an escaped space.
+%    \begin{macrocode}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrEscVDetok@ScanCont#1#2{%
+  !if!relax!detokenize{#1}!relax
+    !expandafter!@gobble
+  !else
+    !expandafter!@firstofone
+  !fi
+  {!expandafter!FV at PDFStrEscVDetok@ScanGroup!@gobble#1{!FV@<Sentinel>}}%
+  \040%<-space
+  !FV at PDFStrEscVDetok@Scan{}#2!FV@<Sentinel>}%
+!catcode`!\=0!relax
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanGroup}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanGroup#1#{%
+  \FV at PDFStrEscVDetok@ScanToken#1\FV at Sentinel
+  \FV at PDFStrEscVDetok@ScanGroup at i}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanGroup at i}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanEmptyGroup}%
+  {\FV at PDFStrEscVDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanEmptyGroup}
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrEscVDetok@ScanEmptyGroup({}\FV at PDFStrEscVDetok@ScanGroup)
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanGroup at ii}
+%    \begin{macrocode}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrEscVDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at PDFStrEscVDetok@Scan#1^^C \FV@<Sentinel>}\FV at PDFStrEscVDetok@ScanGroup))
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanToken}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrEscVDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanToken at i}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanTokenNoSpace#1}%
+  {\FV at PDFStrEscVDetok@ScanTokenWithSpace{#1}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanTokenNoSpace}
+% This was modifed to add \cmd{\FVExtraPDFStringEscapeChar}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanTokenNoSpace#1#2^^C{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FVExtraPDFStringEscapeChar{#1}\FV at PDFStrEscVDetok@ScanToken}%
+  {\FVExtraPDFStringEscapeChar{#2}\FV at PDFStrEscVDetok@ScanToken}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanTokenWithSpace}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanTokenActiveSpace}%
+  {\FV at PDFStrEscVDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanTokenActiveSpace}
+% This is modified to use |\040| for the space.
+%    \begin{macrocode}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrEscVDetok@ScanTokenActiveSpace{\040!FV at PDFStrEscVDetok@ScanToken}%
+!catcode`!\=0!relax
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanTokenWithSpace at i}
+%    \begin{macrocode}
+\gdef\FV at PDFStrEscVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanTokenEscSpace{#1}}%
+  {\FV at PDFStrEscVDetok@ScanTokenCW{#1}{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanTokenEscSpace}
+% This is modified to drop |#1|, which will be the backslash, and use |\040| for the space.
+%    \begin{macrocode}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrEscVDetok@ScanTokenEscSpace#1{\040!FV at PDFStrEscVDetok@ScanToken}
+!catcode`!\=0!relax
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at PDFStrEscVDetok@ScanTokenCW}
+% This is modified to use \cmd{\FVExtraPDFStringEscapeChars}.
+%    \begin{macrocode}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at PDFStrEscVDetok@ScanTokenCW#1#2#3{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{\FVExtraPDFStringEscapeChars{#2} \FV at PDFStrEscVDetok@ScanToken#3}%
+{\FVExtraPDFStringEscapeChars{#2}\FV at PDFStrEscVDetok@ScanToken#3}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \paragraph{Detokenization wrappers}\hfill\\
+%
+% \begin{macro}{\FVExtraDetokenizeVArg}
+% Detokenize a verbatim argument read by \cmd{\FVExtraReadVArg}.  This is a wrapper around \cmd{\FVExtraVerbatimDetokenize} that adds some additional safety by ensuring |^^C| is \cmd{\active} with an appropriate definition, at the cost of not working in an expansion-only context.  This tradeoff isn't an issue when working with \cmd{\FVExtraReadVArg}, because it has the same expansion limitations.
+%    \begin{macrocode}
+\gdef\FVExtraDetokenizeVArg#1#2{%
+  \begingroup
+  \catcode`\^^C=\active
+  \let^^C\FV at Sentinel
+  \edef\FV at Tmp{\FVExtraVerbatimDetokenize{#2}}%
+  \expandafter\FV at DetokenizeVArg@i\expandafter{\FV at Tmp}{#1}}
+\gdef\FV at DetokenizeVArg@i#1#2{%
+  \endgroup
+  #2{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVExtraDetokenizeEscVArg}
+% This is the same as \cmd{\FVExtraDetokenizeVArg}, except it is intended to work with \cmd{\FVExtraReadEscVArg} by using \cmd{\FVExtraEscapedVerbatimDetokenize}.
+%    \begin{macrocode}
+\gdef\FVExtraDetokenizeEscVArg#1#2{%
+  \begingroup
+  \catcode`\^^C=\active
+  \let^^C\FV at Sentinel
+  \edef\FV at Tmp{\FVExtraEscapedVerbatimDetokenize{#2}}%
+  \expandafter\FV at DetokenizeVArg@i\expandafter{\FV at Tmp}{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVExtraDetokenizeREscVArg}
+%    \begin{macrocode}
+\gdef\FVExtraDetokenizeREscVArg#1#2{%
+  \begingroup
+  \catcode`\^^C=\active
+  \let^^C\FV at Sentinel
+  \let\FV at EscVDetok@ScanTokenNoSpace\FV at REscVDetok@ScanTokenNoSpace
+  \let\FV at EscVDetok@ScanTokenWithSpace at i\FV at REscVDetok@ScanTokenWithSpace at i
+  \edef\FV at Tmp{\FVExtraEscapedVerbatimDetokenize{#2}}%
+  \expandafter\FV at DetokenizeREscVArg@InvalidEscapeCheck\FV at Tmp\FV@<InvalidEscape>\FV@<Sentinel>
+  \expandafter\FV at DetokenizeVArg@i\expandafter{\FV at Tmp}{#1}}
+\gdef\FV at 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}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% End catcodes for this subsection:
+%    \begin{macrocode}
+\endgroup
+%    \end{macrocode}
+%
+%
+%
+%
+% \subsubsection{Retokenizing detokenized arguments}
+%
+% \begin{macro}{\FV at RetokVArg@Read}
+% Read all tokens up to \cmd{\active} |^^C^^M|, then save them in a macro for further use.  This is used to read tokens inside \cmd{\scantokens} during retokenization.  The \cmd{\endgroup} disables catcode modifications that will have been put in place for the reading process, including making |^^C| and |^^M| \cmd{\active}.
+%    \begin{macrocode}
+\begingroup
+\catcode`\^^C=\active%
+\catcode`\^^M=\active%
+\gdef\FV at RetokVArg@Read#1^^C^^M{%
+  \endgroup%
+  \def\FV at TmpRetoked{#1}}%
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVExtraRetokenizeVArg}
+% This retokenizes the detokenized output of something like \cmd{\FVExtraVerbatimDetokenize} or \cmd{\FVExtraDetokenizeVArg}.  |#1| is a macro that receives the output, |#2| sets catcodes but includes no \cmd{\begingroup} or \cmd{\endgroup}, and |#3| is the detokenized characters.  \cmd{\FV at RetokVArg@Read} contains an \cmd{\endgroup} that returns catcodes to their prior state.
+%
+% This is a somewhat atypical use of \cmd{\scantokens}.  There is no |\everyeof{\noexpand}| to handle the end-of-file marker, and no |\endlinechar=-1|  to ignore the end-of-line token so that it does not become a space.  Rather, the end-of-line |^^M| is made \cmd{\active} and used as a delimiter by \cmd{\FV at RetokVArg@Read}, which reads characters under the new catcode regime, then stores them unexpanded in \cmd{\FV at TmpRetoked}.
+%
+% Inside \cmd{\scantokens} is |^^B#3^^C|.  This becomes |^^B#3^^C^^M| once \cmd{\scantokens} inserts the end-of-line token.  |^^B| is \cmd{\let} to \cmd{\FV at RetokVArg@Read}, rather than using \cmd{\FV at RetokVArg@Read} directly, because \cmd{\scantokens} acts as a \cmd{\write} followed by \cmd{\input}.  That means that a command word like \cmd{\FV at RetokVArg@Read} will have a space inserted after it, while an \cmd{\active} character like |^^B| will not.  Using |^^B| is a way to avoid needing to remove this space; it is simpler not to handle the scenario where \cmd{\FV at RetokVArg@Read} introduces a space and the detokenized characters also start with a space.  The |^^C| is needed because trailing spaces on a line are automatically stripped, so a non-space character must be part of the delimiting token sequence.
+%    \begin{macrocode}
+\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 at RetokVArg@Read
+  \let^^C\@empty
+  \FV at DefEOLEmpty
+  \scantokens{^^B#3^^C}%
+  \expandafter\FV at RetokenizeVArg@i\expandafter{\FV at TmpRetoked}{#1}}%
+\gdef\FV at RetokenizeVArg@i#1#2{%
+  #2{#1}}
+\endgroup
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
 % \subsection{Hooks}
 %
 %
@@ -1196,9 +3085,426 @@
 %
 %
 %
+% \subsection{Inline-only options}
+%
+% Create \cmd{\fvinlineset} for inline-only options.  Note that this only applies to new or reimplemented inline commands that use \cmd{\FV at UseInlineKeyValues}.
+% \begin{macro}{\FV at InlineKeyValues}
+%    \begin{macrocode}
+\def\FV at InlineKeyValues{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fvinlineset}
+%    \begin{macrocode}
+\def\fvinlineset#1{%
+  \expandafter\def\expandafter\FV at InlineKeyValues\expandafter{%
+    \FV at InlineKeyValues#1,}}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\FV at UseInlineKeyValues}
+%    \begin{macrocode}
+\def\FV at UseInlineKeyValues{%
+  \expandafter\fvset\expandafter{\FV at InlineKeyValues}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{Reimplementations}
+% \label{sec:impl:reimplementations}
+%
+% \fvextra\ reimplements some \fancyvrb\ internals.  The patches in \cref{sec:impl:patches} fix bugs, handle edge cases, and extend existing functionality in logical ways, while leaving default \fancyvrb\ behavior largely unchanged.  In contrast, reimplementations add features by changing existing behavior in significant ways.  As a result, there is a boolean option |extra| that allows them to be disabled.
+%
+%
+% \subsubsection{\texttt{extra} option}
+% Boolean option that governs whether reimplemented commands and environments should be used, rather than the original definitions.
+% \begin{macro}{FV at extra}
+%    \begin{macrocode}
+\newbool{FV at extra}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{extra}
+%    \begin{macrocode}
+\define at booleankey{FV}{extra}%
+ {\booltrue{FV at extra}}%
+ {\boolfalse{FV at extra}}
+\fvset{extra=true}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{\texttt{\textbackslash Verb}}
+%
+% \cmd{\Verb} is reimplemented so that it functions as well as possible when used within other commands.
+%
+% \cmd{\verb} cannot be used inside other commands.  The original \fancyvrb\ implementation of \cmd{\Verb} does work inside other commands, but being inside other commands reduces its functionality since there is no attempt at retokenization.  When used inside other commands, it essentially reduces to \cmd{\texttt}.  \cmd{\Verb} also fails when the delimiting characters are active, since it assumes that the closing delimiting character will have catcode 12.
+%
+% \fvextra's re-implemented \cmd{\Verb} uses \cmd{\scantokens} and careful consideration of catcodes to (mostly) remedy this.  It also adds support for paired curly braces |{...}| as the delimiters for the verbatim argument, since this is often convenient when \cmd{\Verb} is used within another command.  The original \cmd{\Verb} implementation is completely incompatible with curly braces being used as delimiters, so this doesn't affect backward compatibility.
+%
+% The re-implemented \cmd{\Verb} is constructed with \cmd{\FVExtraRobustCommand} so that it will function correctly after being in an expansion-only context, so long as the argument is delimited with curly braces.
+%
+% \begin{macro}{\Verb}
+%    \begin{macrocode}
+\def\Verb{%
+  \FVExtraRobustCommand\RobustVerb\FVExtraUnexpandedReadStarOArgBVArg}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RobustVerb}
+%    \begin{macrocode}
+\protected\def\RobustVerb{\FV at Command{}{Verb}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\RobustVerb{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at Verb@FV}
+% Save the original \fancyvrb\ definition of \cmd{\FVC at Verb}, so that the |extra| option can switch back to it.
+%    \begin{macrocode}
+\let\FVC at Verb@FV\FVC at Verb
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at Verb}
+% Redefine \cmd{\FVC at Verb} so that it will adjust based on |extra|.
+%    \begin{macrocode}
+\def\FVC at Verb{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues
+  \ifFV at extra
+    \expandafter\endgroup\expandafter\FVC at Verb@Extra
+  \else
+    \expandafter\endgroup\expandafter\FVC at Verb@FV
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at Verb@Extra}
+% \fvextra\ reimplementation of \cmd{\FVC at Verb}.
+%
+% When used after expansion, there is a check for valid delimiters, curly braces.  If incorrect delimiters are used, and there are no following curly braces, then the reader macro \cmd{\FVExtraUnexpandedReadStarOArgBVArg} will give an error about unmatched braces.  However, if incorrect delimiters are used, and there \emph{are} following braces in a subsequent command, then this error will be triggered, preventing interference with the following command by the reader macro.
+%    \begin{macrocode}
+\def\FVC at Verb@Extra{%
+  \ifbool{FVExtraRobustCommandExpanded}%
+   {\@ifnextchar\bgroup
+     {\FVC at Verb@Extra at i}%
+     {\PackageError{fvextra}%
+       {\string\Verb\space delimiters must be paired curly braces in this context}%
+       {Use curly braces as delimiters}}}%
+   {\FVC at Verb@Extra at i}}
+%    \end{macrocode}
+% \end{macro}
+%  
+% \begin{macro}{\FVC at Verb@Extra at i}
+%    \begin{macrocode}
+\def\FVC at Verb@Extra at i{%
+  \begingroup
+  \FVExtraReadVArg{%
+    \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+    \FVExtraDetokenizeVArg{%
+      \FVExtraRetokenizeVArg{\FVC at Verb@Extra at ii}{\FV at CatCodes}}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at Verb@Extra at ii}
+%    \begin{macrocode}
+\def\FVC at Verb@Extra at ii#1{%
+  \ifFV at BreakLines
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+  {\mbox{#1}}%
+  \endgroup}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{\cmd{\SaveVerb}}
+%
+% This is reimplemented, following \cmd{\Verb} as a template, so that both \cmd{\Verb} and \cmd{\SaveVerb} are using the same reading and tokenization macros.  This also adds support for \cmd{\fvinlineset}.  Since the definition in \fancyvrb\ is
+%\begin{verbatim}
+%\def\SaveVerb{\FV at Command{}{SaveVerb}}
+%\end{verbatim}
+% only the internal macros need to be reimplemented.
+%
+% \begin{macro}{\FVC at SaveVerb@FV}
+%    \begin{macrocode}
+\let\FVC at SaveVerb@FV\FVC at SaveVerb
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at SaveVerb}
+%    \begin{macrocode}
+\def\FVC at SaveVerb{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues
+  \ifFV at extra
+    \expandafter\endgroup\expandafter\FVC at SaveVerb@Extra
+  \else
+    \expandafter\endgroup\expandafter\FVC at SaveVerb@FV
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at SaveVerb@Extra}
+% In addition to following the \cmd{\Verb} implementation, this saves a raw version of the text to allow |retokenize| with \cmd{\UseVerb}.  The raw version is also used for conversion to a PDF string if that is needed.
+%    \begin{macrocode}
+\def\FVC at SaveVerb@Extra#1{%
+  \@namedef{FV at SV@#1}{}%
+  \@namedef{FV at SVRaw@#1}{}%
+  \begingroup
+  \FVExtraReadVArg{%
+    \FVC at SaveVerb@Extra at i{#1}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at SaveVerb@Extra at i}
+%    \begin{macrocode}
+\def\FVC at SaveVerb@Extra at i#1#2{%
+  \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+  \FVExtraDetokenizeVArg{%
+    \FVExtraRetokenizeVArg{\FVC at SaveVerb@Extra at ii{#1}{#2}}{\FV at CatCodes}}{#2}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at SaveVerb@Extra at ii}
+%    \begin{macrocode}
+\def\FVC at SaveVerb@Extra at ii#1#2#3{%
+  \global\let\FV at AfterSave\FancyVerbAfterSave
+  \endgroup
+  \@namedef{FV at SV@#1}{#3}%
+  \@namedef{FV at SVRaw@#1}{#2}%
+  \FV at AfterSave}%
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{\cmd{\UseVerb}}
+%
+% This adds support for \cmd{\fvinlineset} and line breaking.  It also adds movable argument and PDF string support.  A new option |retokenize| is defined that determines whether the typeset output is based on the |commandchars| and |codes| in place when \cmd{\SaveVerb} was used (default), or is retokenized under current |commandchars| and |codes|.
+%
+% \begin{macro}{FV at retokenize}
+% \begin{macro}{retokenize}
+% Whether \cmd{\UseVerb} uses saved verbatim with its original tokenization, or retokenizes under current |commandchars| and |codes|.
+%    \begin{macrocode}
+\newbool{FV at retokenize}
+\define at booleankey{FV}{retokenize}%
+ {\booltrue{FV at retokenize}}{\boolfalse{FV at retokenize}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\UseVerb}
+%    \begin{macrocode}
+\def\UseVerb{%
+  \FVExtraRobustCommand\RobustUseVerb\FVExtraUseVerbUnexpandedReadStarOArgMArg}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RobustUseVerb}
+%    \begin{macrocode}
+\protected\def\RobustUseVerb{\FV at Command{}{UseVerb}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\RobustUseVerb{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at UseVerb@FV}
+%    \begin{macrocode}
+\let\FVC at UseVerb@FV\FVC at UseVerb
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\FVC at UseVerb}
+%    \begin{macrocode}
+\def\FVC at UseVerb{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues
+  \ifFV at extra
+    \expandafter\endgroup\expandafter\FVC at UseVerb@Extra
+  \else
+    \expandafter\endgroup\expandafter\FVC at UseVerb@FV
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%             
+%
+% \begin{macro}{\FVC at UseVerb@Extra}
+%    \begin{macrocode}
+\def\FVC at UseVerb@Extra#1{%
+  \@ifundefined{FV at SV@#1}%
+   {\FV at Error{Short verbatim text never saved to name `#1'}\FV at eha}%
+   {\begingroup
+    \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+    \ifbool{FV at retokenize}%
+     {\expandafter\let\expandafter\FV at Tmp\csname FV at SVRaw@#1\endcsname
+      \expandafter\FV at UseVerb@Extra at Retok\expandafter{\FV at Tmp}}%
+     {\expandafter\let\expandafter\FV at Tmp\csname FV at SV@#1\endcsname
+      \expandafter\FV at UseVerb@Extra\expandafter{\FV at Tmp}}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at UseVerb@Extra at Retok}
+%    \begin{macrocode}
+\def\FV at UseVerb@Extra at Retok#1{%
+  \FVExtraDetokenizeVArg{%
+    \FVExtraRetokenizeVArg{\FV at UseVerb@Extra}{\FV at CatCodes}}{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV at UseVerb@Extra}
+%    \begin{macrocode}
+\def\FV at UseVerb@Extra#1{%
+  \ifFV at BreakLines
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+  {\mbox{#1}}%
+  \endgroup}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{New commands and environments}
+% \label{sec:impl:new-commands-environments}
+%
+% \subsubsection{\cmd{\EscVerb}}
+% This is a variant of \cmd{\Verb} in which backslash escapes of the form |\<char>| are used for |<char>|.  Backslash escapes are \emph{only} permitted for printable, non-alphanumeric ASCII characters.  The argument is read under a normal catcode regime, so any characters that cannot be read under normal catcodes must always be escaped, and the argument must always be delimited by curly braces.  This ensures that \cmd{\EscVerb} behaves identically whether or not it is used inside another command.
+%
+% \cmd{\EscVerb} is constructed with \cmd{\FVExtraRobustCommand} so that it will function correctly after being in an expansion-only context.
+%
+% \begin{macro}{\EscVerb}
+% Note that while the typeset mandatory argument will be read under normal catcodes, the reader macro for expansion is \cmd{\FVExtraUnexpandedReadStarOArgBEscVArg}.  This reflects how the argument will be typeset.
+%    \begin{macrocode}
+\def\EscVerb{%
+  \FVExtraRobustCommand\RobustEscVerb\FVExtraUnexpandedReadStarOArgBEscVArg}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RobustEscVerb}
+%    \begin{macrocode}
+\protected\def\RobustEscVerb{\FV at Command{}{EscVerb}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\RobustEscVerb{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at EscVerb}
+% Delimiting with curly braces is required, so that the command will always behave the same whether or not it has been through expansion.
+%    \begin{macrocode}
+\def\FVC at EscVerb{%
+  \@ifnextchar\bgroup
+   {\FVC at EscVerb@i}%
+   {\PackageError{fvextra}%
+    {Invalid argument; argument must be delimited by paired curly braces}%
+    {Delimit argument with curly braces}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at EscVerb@i}
+%    \begin{macrocode}  
+\def\FVC at EscVerb@i#1{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+  \FVExtraDetokenizeREscVArg{%
+    \FVExtraRetokenizeVArg{\FVC at EscVerb@ii}{\FV at CatCodes}}{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FVC at EscVerb@ii}
+%    \begin{macrocode}
+\def\FVC at EscVerb@ii#1{%
+  \ifFV at BreakLines
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+  {\mbox{#1}}%
+  \endgroup}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
 % \subsection{Patches}
+% \label{sec:impl:patches}
 %
 %
+% \subsubsection{Delimiting characters for verbatim commands}
+% \label{sec:impl:patches:delimiting-verbatim-commands}
+%
+% Unlike \cmd{\verb}, \fancyvrb's commands like \cmd{\Verb} cannot take arguments delimited by characters like |#| and |%| due to the way that starred commands and optional arguments are implemented.  The relevant macros are redefined to make this possible.
+%
+% \fancyvrb's \cmd{\Verb} is actually implemented in \cmd{\FVC at Verb}.  This is invoked by a helper macro \cmd{\FV at Command} which allows versions of commands with customized options:
+% \begin{quote}
+% \cmd{\FV at Command}\marg{customized\_options}\marg{base\_command\_name}
+% \end{quote}
+% \cmd{\Verb} is then defined as |\def\Verb{\FV at Command{}{Verb}}|.  The definition of \cmd{\FV at Command} (and \cmd{\FV@@Command} which it uses internally) involves looking ahead for a star |*| (\cmd{\@ifstar}) and for a left square bracket |[| that delimits an optional argument (\cmd{\@ifnextchar}).  As a result, the next character is tokenized under the current, normal catcode regime.  This prevents \cmd{\Verb} from being able to use delimiting characters like |#| and |%| that work with \cmd{\verb}.
+%
+% \cmd{\FV at Command} and \cmd{\FV@@Command} are redefined so that this lookahead tokenizes under a typical verbatim catcode regime (with one exception that is explained below).  This enables \cmd{\verb}-style delimiters.  This does not account for any custom catcode changes introduced by \cmd{\fvset}, customized commands, or optional arguments.  However, delimiting characters should never need custom catcodes, and both the \fancyvrb\ definition of \cmd{\Verb} (when not used inside another macro) as well as the \fvextra\ reimplementation (in all cases) handle the possibility of delimiters with valid but non-typical catcodes.  Other, non-verbatim commands that use \cmd{\FV at Command}, such as \cmd{\UseVerb}, are not affected by the patch.
+%
+% The catcode regime for lookahead has one exception to a typical verbatim catcode regime:  The curly braces |{}| retain their normal codes.  This allows the \fvextra\ reimplementation of \cmd{\Verb} to use a pair of curly braces as delimiters, which can be convenient when \cmd{\Verb} is used within another command.  Since the original \fancyvrb\ implementation of \cmd{\Verb} with unpatched \cmd{\FV at Command} is incompatible with curly braces being used as delimiters in any form, this does not affect any pre-existing \fancyvrb\ functionality.
+%
+% \begin{macro}{\FV at Command}
+%    \begin{macrocode}
+\def\FV at Command#1#2{%
+  \FVExtra at ifstarVArg
+   {\def\FV at KeyValues{#1,showspaces}\FV@@Command{#2}}%
+   {\def\FV at KeyValues{#1}\FV@@Command{#2}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FV@@Command}
+%    \begin{macrocode}
+\def\FV@@Command#1{%
+  \FVExtra at ifnextcharVArg[%
+    {\FV at GetKeyValues{\@nameuse{FVC@#1}}}%
+    {\@nameuse{FVC@#1}}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{\cmd{\CustomVerbatimCommand} compatibility with \cmd{\FVExtraRobustCommand}}
+%
+% \begin{macro}{\@CustomVerbatimCommand}
+% |#1| is \cmd{\newcommand} or \cmd{\renewcommand}, |#2| is the (re)new command, |#3| is the base \fancyvrb\ command, |#4| is options.
+%    \begin{macrocode}
+\def\@CustomVerbatimCommand#1#2#3#4{%
+  \begingroup\fvset{#4}\endgroup
+  \@ifundefined{FVC@#3}%
+   {\FV at 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 at Command{#4}{#3}}}%
+     \expandafter\@tempb\@tempa}%
+    {#1{#2}{\FV at Command{#4}{#3}}}}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \subsubsection{Visible spaces}
 %
 % \begin{macro}{\FancyVerbSpace}
@@ -1232,12 +3538,13 @@
 %
 %
 % \begin{macro}{\FV@@ObeyTabs}
-% The \fancyvrb\ macro responsible for tab expansion is modified so that it can handle tabs inside groups, even if imperfectly.  We need to use a special version of the space, |\FV at Space@ObeyTabs|, that within a group will capture all following spaces or tabs and then insert them with tab expansion based on the beginning of the run of whitespace.  We need to record the current group level, but then increment it by $1$ because all comparisons will be performed within the |\hbox{...}|.
+% The \fancyvrb\ macro responsible for tab expansion is modified so that it can handle tabs inside groups, even if imperfectly.  We need to use a special version of the space, |\FV at Space@ObeyTabs|, that within a group will capture all following spaces or tabs and then insert them with tab expansion based on the beginning of the run of whitespace.  We need to record the current group level, but then increment it by $1$ because all comparisons will be performed within the |\hbox{...}|.  The |\FV at TmpCurrentGroupLevel| is needed for compatibility with the \pkg{calc} package, which redefines |\setcounter|.
 %    \begin{macrocode}
 \def\FV@@ObeyTabs#1{%
   \let\FV at Space@Orig\FV at Space
   \let\FV at Space\FV at Space@ObeyTabs
-  \setcounter{FV at TrueTabGroupLevel}{\the\currentgrouplevel}%
+  \edef\FV at TmpCurrentGroupLevel{\the\currentgrouplevel}%
+  \setcounter{FV at TrueTabGroupLevel}{\FV at TmpCurrentGroupLevel}%
   \addtocounter{FV at TrueTabGroupLevel}{1}%
   \setbox\FV at TabBox=\hbox{#1}\box\FV at TabBox
   \let\FV at Space\FV at Space@Orig}
@@ -1306,11 +3613,11 @@
 % \end{macro}
 %
 % \begin{macro}{\FV at TrueTab@Group}
-% If in a group, a tab should start collecting whitespace characters for later tab expansion, beginning with itself.  The collected whitespace will use |\FV at Tab@ifx| and |\FV at Space@ifx| so that any |\ifx| comparisons performed later will behave as expected.  This shouldn't be strictly necessary, because |\FancyVerbBreakStart| operates with saved tab widths rather than using the tab expansion code directly.  But it is safer in case any other unanticipated scanning is going on.
+% If in a group, a tab should start collecting whitespace characters for later tab expansion, beginning with itself.  The collected whitespace will use |\FV at FVTabToken| and |\FV at FVSpaceToken| so that any |\ifx| comparisons performed later will behave as expected.  This shouldn't be strictly necessary, because |\FancyVerbBreakStart| operates with saved tab widths rather than using the tab expansion code directly.  But it is safer in case any other unanticipated scanning is going on.
 %    \begin{macrocode}
 \def\FV at TrueTab@Group{%
   \booltrue{FV at ObeyTabs@Whitespace at Tab}%
-  \gdef\FV at TmpWhitespace{\FV at Tab@ifx}%
+  \gdef\FV at TmpWhitespace{\FV at FVTabToken}%
   \FV at ObeyTabs@ScanWhitespace}
 %    \end{macrocode}
 % \end{macro}
@@ -1340,7 +3647,7 @@
 %    \begin{macrocode}
 \def\FV at Space@ObeyTabs at Group{%
   \boolfalse{FV at ObeyTabs@Whitespace at Tab}%
-  \gdef\FV at TmpWhitespace{\FV at Space@ifx}%
+  \gdef\FV at TmpWhitespace{\FV at FVSpaceToken}%
   \FV at ObeyTabs@ScanWhitespace}
 %    \end{macrocode}
 % \end{macro}
@@ -1347,22 +3654,22 @@
 %
 %
 % \begin{macro}{\FV at ObeyTabs@ScanWhitespace}
-% Collect whitespace until the end of the run, then process it.  Proper lookahead comparison requires |\FV at Space@ifx| and |\FV at Tab@ifx|.
+% Collect whitespace until the end of the run, then process it.  Proper lookahead comparison requires |\FV at FVSpaceToken| and |\FV at FVTabToken|.
 %    \begin{macrocode}
 \def\FV at ObeyTabs@ScanWhitespace{%
-  \@ifnextchar\FV at Space@ifx%
+  \@ifnextchar\FV at FVSpaceToken%
    {\FV at TrueTab@CaptureWhitespace at Space}%
-   {\ifx\@let at token\FV at Tab@ifx
+   {\ifx\@let at token\FV at FVTabToken
       \expandafter\FV at TrueTab@CaptureWhitespace at Tab
     \else
       \expandafter\FV at ObeyTabs@ResolveWhitespace
     \fi}}
 \def\FV at TrueTab@CaptureWhitespace at Space#1{%
-  \g at addto@macro\FV at TmpWhitespace{\FV at Space@ifx}%
+  \g at addto@macro\FV at TmpWhitespace{\FV at FVSpaceToken}%
   \FV at ObeyTabs@ScanWhitespace}
 \def\FV at TrueTab@CaptureWhitespace at Tab#1{%
   \booltrue{FV at ObeyTabs@Whitespace at Tab}%
-  \g at addto@macro\FV at TmpWhitespace{\FV at Tab@ifx}%
+  \g at addto@macro\FV at TmpWhitespace{\FV at FVTabToken}%
   \FV at ObeyTabs@ScanWhitespace}
 %    \end{macrocode}
 % \end{macro}
@@ -1504,7 +3811,7 @@
 % \subsubsection{\texttt{rulecolor} and \texttt{fillcolor}}
 %
 % The |rulecolor| and |fillcolor| options are redefined so that they accept color names directly, rather than requiring |\color{|\meta{color\_name}|}|.  The definitions still allow the old usage.
-% 
+%
 % \begin{macro}{rulecolor}
 %    \begin{macrocode}
 \define at key{FV}{rulecolor}{%
@@ -1658,11 +3965,28 @@
 \fvset{curlyquotes=false}
 %    \end{macrocode}
 % \end{macro}
-% 
 %
 %
+% \begin{macro}{fontencoding}
+% Add option for font encoding.
+%    \begin{macrocode}
+\define at key{FV}{fontencoding}%
+ {\ifstrempty{#1}%
+   {\let\FV at FontEncoding\relax}%
+   {\ifstrequal{#1}{none}%
+     {\let\FV at FontEncoding\relax}%
+     {\def\FV at FontEncoding{\fontencoding{#1}}}}}
+\expandafter\def\expandafter\FV at SetupFont\expandafter{%
+  \expandafter\FV at FontEncoding\FV at SetupFont}
+\fvset{fontencoding=none}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
 % \subsubsection{Formatting with \texttt{\textbackslash FancyVerbFormatLine}, \texttt{\textbackslash FancyVerbFormatText}, and \texttt{\textbackslash FancyVerbHighlightLine}}
-% 
+%
 % \fancyvrb\ defines |\FancyVerbFormatLine|, which defines the formatting for each line. The introduction of line breaks introduces an issue for |\FancyVerbFormatLine|.  Does it format the entire line, including any whitespace in the margins or behind line break symbols (that is, is it outside the |\parbox| in which the entire line is wrapped when breaking is active)?  Or does it only format the text part of the line, only affecting the actual characters (inside the |\parbox|)?  Since both might be desirable, |\FancyVerbFormatLine| is assigned to the entire line, and a new macro |\FancyVerbFormatText| is assigned to the text, within the |\parbox|.
 %
 % An additional complication is that the \fancyvrb\ documentation says that the default value is |\def\FancyVerbFormatLine#1{#1}|.  But the actual default is |\def\FancyVerbFormatLine#1{\FV at ObeyTabs{#1}}|.  That is, |\FV at ObeyTabs| needs to operate directly on the line to handle tabs.  As a result, \emph{all} \fancyvrb\ commands that involve |\FancyVerbFormatLine| are patched, so that |\def\FancyVerbFormatLine#1{#1}|.
@@ -1687,7 +4011,7 @@
 %
 % \begin{macro}{\FV at ListProcessLine@NoBreak}
 % Redefined |\FV at ListProcessLine| in which |\FancyVerbFormatText| is added and tab handling is explicit.  The |@NoBreak| suffix is added because |\FV at ListProcessLine| will be |\let| to either this macro or to |\FV at ListProcessLine@Break| depending on whether line breaking is enabled.
-%    \begin{macrocode} 
+%    \begin{macrocode}
 \def\FV at ListProcessLine@NoBreak#1{%
   \hbox to \hsize{%
     \kern\leftmargin
@@ -2037,7 +4361,18 @@
   \colorbox{\FancyVerbHighlightColor}{%
     \setlength{\fboxsep}{\FV at TmpLength}%
     \rlap{\strut#1}%
-    \hspace{\linewidth}}}
+    \hspace{\linewidth}%
+    \ifx\FV at RightListFrame\relax\else
+      \hspace{-\FV at FrameSep}%
+      \hspace{-\FV at FrameRule}%
+    \fi
+    \ifx\FV at LeftListFrame\relax\else
+      \hspace{-\FV at FrameSep}%
+      \hspace{-\FV at FrameRule}%
+    \fi
+  }%
+  \hss
+}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2163,7 +4498,7 @@
 %
 % \begin{macro}{\FV at BreakIndent}
 % \begin{macro}{\FV at BreakIndentNChars}
-% Indentation of continuation lines. 
+% Indentation of continuation lines.
 %    \begin{macrocode}
 \newdimen\FV at BreakIndent
 \newcount\FV at BreakIndentNChars
@@ -2208,7 +4543,7 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% 
+%
 % \begin{macro}{\FV at BreakSymbolSepLeft}
 % \begin{macro}{\FV at BreakSymbolSepLeftNChars}
 % Separation of left break symbol from the text.
@@ -2504,18 +4839,12 @@
 % Now that |\FV at BreakBeforePrep| and |\FV at BreakAfterPrep| are defined, add them to |\FV at FormattingPrep@PreHook|, which is the \fvextra\ extension to |\FV at FormattingPrep|.  The ordering here is important, since |\FV at BreakAfterPrep| contains compatibility checks with |\FV at BreakBeforePrep|, and thus must be used after it.  Also, we have to check for the pdfTeX engine with \pkg{inputenc} using UTF-8, and use the |UTF| macros instead when that is the case.
 %    \begin{macrocode}
 \g at addto@macro\FV at FormattingPrep@PreHook{%
-  \ifcsname pdfmatch\endcsname
-  \ifx\pdfmatch\relax
-  \else
-    \ifcsname inputencodingname\endcsname
-    \ifx\inputencodingname\relax
-    \else
-      \ifdefstring{\inputencodingname}{utf8}%
-       {\let\FV at BreakBeforePrep\FV at BreakBeforePrep@UTF
-        \let\FV at BreakAfterPrep\FV at BreakAfterPrep@UTF}%
-       {}%
-    \fi\fi
-  \fi\fi
+  \ifFV at pdfTeXinputenc
+    \ifdefstring{\inputencodingname}{utf8}%
+     {\let\FV at BreakBeforePrep\FV at BreakBeforePrep@UTF
+      \let\FV at BreakAfterPrep\FV at BreakAfterPrep@UTF}%
+     {}%
+  \fi
   \FV at BreakBeforePrep\FV at BreakAfterPrep}
 %    \end{macrocode}
 %
@@ -2649,12 +4978,12 @@
   \ifx\FV at NextChar\FV at Undefined\relax
     \let\FV at Next=\relax
   \else
-    \ifx\FV at NextChar\FV at Space@ifx\relax
-      \g at addto@macro{\FV at LineIndentChars}{\FV at Space@ifx}%
+    \ifx\FV at NextChar\FV at FVSpaceToken\relax
+      \g at addto@macro{\FV at LineIndentChars}{\FV at FVSpaceToken}%
       \let\FV at Next=\FV at GetLineIndent
     \else
-      \ifx\FV at NextChar\FV at Tab@ifx\relax
-        \g at addto@macro{\FV at LineIndentChars}{\FV at Tab@ifx}%
+      \ifx\FV at NextChar\FV at FVTabToken\relax
+        \g at addto@macro{\FV at LineIndentChars}{\FV at FVTabToken}%
         \let\FV at Next=\FV at GetLineIndent
       \else
         \let\FV at Next=\FV at CleanRemainingChars
@@ -2695,28 +5024,22 @@
 % \begin{macro}{\FV at Break}
 % The entry macro for breaking lines, either anywhere or before/after specified characters.  The current line (or argument) will be scanned token by token/group by group, and accumulated (with added potential breaks) in |\FV at TmpLine|.  After scanning is complete, |\FV at TmpLine| will be inserted.  It would be possible to insert each token/group into the document immediately after it is scanned, instead of accumulating them in a ``buffer.''  But that would interfere with macros.  Even in the current approach, macros that take optional arguments are problematic.\footnote{Through a suitable definition that tracks the current state and looks for square brackets, this might be circumvented.  Then again, in verbatim contexts, macro use should be minimal, so the restriction to macros without optional arguments should generally not be an issue.}  The last token is tracked with |\FV at LastToken|, to allow lookbehind when breaking by groups of identical characters.  |\FV at LastToken| is |\let| to |\FV at Undefined| any time the last token was something that shouldn't be compared against (for example, a non-empty group), and it is not reset whenever the last token may be ignored (for example, |{}|).  When setting |\FV at LastToken|, it is vital always to use |\let\FV at LastToken=...| so that |\let\FV at LastToken==| will work (so that the equals sign |=| won't break things).
 %
-% The current definition of |\FV at Break@Token| is swapped for a UTF-8 compatible one under pdfTeX when necessary.  The standard macros are defined next, since they make the algorithms simpler to understand.  The more complex |UTF| variants are defined later.  When swapping for the |UTF| macros, it is important to make sure that pdfTeX is indeed in use, that \pkg{inputenc} is indeed in use, and that the current encoding is UTF-8.  The checks take into account the possibility of an errant |\ifx| test creating a previously non-existent macro and then |\let|ting it to |\relax|.
+% The current definition of |\FV at Break@Token| is swapped for a UTF-8 compatible one under pdfTeX when necessary.  The standard macros are defined next, since they make the algorithms simpler to understand.  The more complex |UTF| variants are defined later.
 %    \begin{macrocode}
 \def\FV at Break{%
   \def\FV at TmpLine{}%
   \let\FV at LastToken=\FV at Undefined
-  \ifcsname pdfmatch\endcsname
-  \ifx\pdfmatch\relax
-  \else
-    \ifcsname inputencodingname\endcsname
-    \ifx\inputencodingname\relax
-    \else
-      \ifdefstring{\inputencodingname}{utf8}%
-       {\ifx\FV at Break@Token\FV at Break@AnyToken
-          \let\FV at Break@Token\FV at Break@AnyToken at UTF
-        \else
-          \ifx\FV at Break@Token\FV at Break@BeforeAfterToken
-            \let\FV at Break@Token\FV at Break@BeforeAfterToken at UTF
-          \fi
-        \fi}%
-       {}%
-    \fi\fi
-  \fi\fi
+  \ifFV at pdfTeXinputenc
+    \ifdefstring{\inputencodingname}{utf8}%
+     {\ifx\FV at Break@Token\FV at Break@AnyToken
+        \let\FV at Break@Token\FV at Break@AnyToken at UTF
+      \else
+         \ifx\FV at Break@Token\FV at Break@BeforeAfterToken
+           \let\FV at Break@Token\FV at Break@BeforeAfterToken at UTF
+         \fi
+      \fi}%
+     {}%
+  \fi
   \FV at Break@Scan
 }
 %    \end{macrocode}
@@ -2861,7 +5184,7 @@
   \expandafter\FV at Break@AfterTokenBreak\FV at RescanToken}
 \def\FV at Break@AfterTokenBreak#1{%
   \let\FV at LastToken=#1%
-  \@ifnextchar\FV at Space@ifx%
+  \@ifnextchar\FV at FVSpaceToken%
    {\g at addto@macro{\FV at TmpLine}{#1}\FV at Break@Scan}%
    {\ifthenelse{\boolean{FV at BreakAfterGroup}}%
      {\ifx\@let at token#1\relax
@@ -2898,83 +5221,11 @@
 % \paragraph{Line scanning and break insertion macros for pdfTeX with UTF-8}\hfill\\
 % The macros above work with the XeTeX and LuaTeX engines and are also fine for pdfTeX with 8-bit character encodings.  Unfortunately, pdfTeX works with multi-byte UTF-8 code points at the byte level, making things significantly trickier.  The code below re-implements the macros in a manner compatible with the \pkg{inputenc} package with option |utf8|.  Note that there is no attempt for compatibility with |utf8x|; |utf8| has been significantly improved in recent years and should be sufficient in the vast majority of cases.  And implementing variants for |utf8| was already sufficiently painful.
 %
-% All of the |UTF| macros are only needed with pdfTeX, so they are created conditionally, inspired by the approach of the \pkg{iftex} package.  The pdfTeX test deals with the possibility that a previous test using |\ifx| rather than the cleaner |\ifcsname| has already been performed.
+% Create macros conditionally:
 %    \begin{macrocode}
-\ifcsname pdfmatch\endcsname
-\ifx\pdfmatch\relax
-\else
+\ifFV at pdfTeXinputenc
 %    \end{macrocode}
 %
-%
-% \begin{macro}{\FV at UTF@two at octets}%
-% \begin{macro}{\FV at UTF@three at octets}%
-% \begin{macro}{\FV at UTF@four at octets}
-% These are variants of the |utf8.def| macros that capture all bytes of a multi-byte code point and then pass them on as a single argument for further processing.  The current |\FV at Break| (or other invoking macro) will have |\let| |\FV at Break@NextNext| to an appropriate macro that performs further processing.  All code points are checked for validity here so as to raise errors as early as possible.  Otherwise an invalid terminal byte sequence might gobble |\FV at EndBreak|, |\FV at Undefined|, or another delimiting macro, potentially making debugging much more difficult.  It would be possible to use |\UTFviii at defined{|\meta{bytes}|}| to trigger an error directly, but the current approach is to attempt to typeset invalid code points, which should trigger errors without relying on the details of the |utf8.def| implementation.
-%    \begin{macrocode}
-\def\FV at UTF@two at octets#1#2{%
-  \ifcsname u8:\detokenize{#1#2}\endcsname
-  \else
-    #1#2%
-  \fi
-  \FV at Break@NextNext{#1#2}}
-\def\FV at UTF@three at octets#1#2#3{%
-  \ifcsname u8:\detokenize{#1#2#3}\endcsname
-  \else
-    #1#2#3%
-  \fi
-  \FV at Break@NextNext{#1#2#3}}
-\def\FV at UTF@four at octets#1#2#3#4{%
-  \ifcsname u8:\detokenize{#1#2#3#4}\endcsname
-  \else
-    #1#2#3#4%
-  \fi
-  \FV at Break@NextNext{#1#2#3#4}}
-%    \end{macrocode}
-% \end{macro}\end{macro}\end{macro}
-%
-% \begin{macro}{\FV at U8:<byte>}
-% Define macros for each active byte.  These are used for determining whether the current token is the first byte in a multi-byte sequence, and if so, invoking the necessary macro to capture the remaining bytes.  The code is adapted from the beginning of |utf8.def|.  Completely capitalized macro names are used to avoid having to worry about |\uppercase|.
-%    \begin{macrocode}
-\begingroup
-\catcode`\~=13
-\catcode`\"=12
-\def\FV at UTFviii@loop{%
-  \uccode`\~\count@
-  \uppercase\expandafter{\FV at UTFviii@Tmp}%
-  \advance\count@\@ne
-  \ifnum\count@<\@tempcnta
-  \expandafter\FV at UTFviii@loop
-  \fi}
-%    \end{macrocode}
-% Setting up 2-byte UTF-8:
-%    \begin{macrocode}
-\count@"C2
-\@tempcnta"E0
-\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
-  \FV at UTF@two at octets}}
-\FV at UTFviii@loop
-%    \end{macrocode}
-% Setting up 3-byte UTF-8:
-%    \begin{macrocode}
-\count@"E0
-\@tempcnta"F0
-\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
-  \FV at UTF@three at octets}}
-\FV at UTFviii@loop
-%    \end{macrocode}
-% Setting up 4-byte UTF-8:
-%    \begin{macrocode}
-\count@"F0
-\@tempcnta"F4
-\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
-  \FV at UTF@four at octets}}
-\FV at UTFviii@loop
-\endgroup
-%    \end{macrocode}
-% \end{macro}
-%
-%
-%
 % \begin{macro}{\FV at BreakBeforePrep@UTF}
 % We need |UTF| variants of the |breakbefore| and |breakafter| prep macros.  These are only ever used with \pkg{inputenc} with UTF-8.  There is no need for encoding checks here; checks are performed in |\FV at FormattingPrep@PreHook| (checks are inserted into it after the non-|UTF| macro definitions).
 %    \begin{macrocode}
@@ -2986,7 +5237,7 @@
     \def\FV at BreakBefore@Process##1{%
       \ifcsname FV at U8:\detokenize{##1}\endcsname
         \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{##1}\endcsname
-        \let\FV at Break@NextNext\FV at BreakBefore@Process at ii
+        \let\FV at UTF@octets at after\FV at BreakBefore@Process at ii
       \else
         \ifx##1\FV at Undefined
           \let\FV at Break@Next\@gobble
@@ -3024,7 +5275,7 @@
     \def\FV at BreakAfter@Process##1{%
       \ifcsname FV at U8:\detokenize{##1}\endcsname
         \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{##1}\endcsname
-        \let\FV at Break@NextNext\FV at BreakAfter@Process at ii
+        \let\FV at UTF@octets at after\FV at BreakAfter@Process at ii
       \else
         \ifx##1\FV at Undefined
           \let\FV at Break@Next\@gobble
@@ -3072,7 +5323,7 @@
 \def\FV at Break@AnyToken at UTF#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@AnyToken at UTF@i
+    \let\FV at UTF@octets at after\FV at Break@AnyToken at UTF@i
   \else
     \let\FV at Break@Next\FV at Break@AnyToken at UTF@i
   \fi
@@ -3092,7 +5343,7 @@
 \def\FV at Break@BeforeAfterToken at UTF#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@BeforeAfterToken at UTF@i
+    \let\FV at UTF@octets at after\FV at Break@BeforeAfterToken at UTF@i
   \else
     \let\FV at Break@Next\FV at Break@BeforeAfterToken at UTF@i
   \fi
@@ -3151,11 +5402,11 @@
   \expandafter\FV at Break@AfterTokenBreak at UTF\expandafter{\FV at RescanToken}}
 \def\FV at Break@AfterTokenBreak at UTF#1{%
   \def\FV at LastToken{#1}%
-  \@ifnextchar\FV at Space@ifx%
+  \@ifnextchar\FV at FVSpaceToken%
    {\g at addto@macro{\FV at TmpLine}{#1}\FV at Break@Scan}%
    {\ifthenelse{\boolean{FV at BreakAfterGroup}}%
      {\g at addto@macro{\FV at TmpLine}{#1}%
-      \ifx\@let at token\bgroup\relax        
+      \ifx\@let at token\bgroup\relax
         \let\FV at Break@Next\FV at Break@AfterTokenBreak at Group@UTF
       \else
         \let\FV at Break@Next\FV at Break@AfterTokenBreak at UTF@i
@@ -3167,7 +5418,7 @@
 \def\FV at Break@AfterTokenBreak at UTF@i#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@AfterTokenBreak at UTF@i
+    \let\FV at UTF@octets at after\FV at Break@AfterTokenBreak at UTF@i
   \else
     \def\FV at NextToken{#1}%
     \ifx\FV at LastToken\FV at NextToken
@@ -3190,7 +5441,7 @@
 \def\FV at Break@AfterTokenBreak at Group@UTF at ii#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@AfterTokenBreak at Group@UTF at ii
+    \let\FV at UTF@octets at after\FV at Break@AfterTokenBreak at Group@UTF at ii
   \else
     \def\FV at NextToken{#1}%
     \ifx\FV at LastToken\FV at NextToken
@@ -3206,7 +5457,7 @@
 %
 % End the conditional creation of the pdfTeX |UTF| macros:
 %    \begin{macrocode}
-\fi\fi
+\fi
 %    \end{macrocode}
 %
 %
@@ -3240,14 +5491,22 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\FV at LineWidth}
+% This is the effective line width within a broken line.
+%    \begin{macrocode}
+\newdimen\FV at LineWidth
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}{\FV at SaveLineBox}
 % This is the macro that does most of the work.  It was inspired by Marco Daniel's code at \url{http://tex.stackexchange.com/a/112573/10742}.
 %
-% This macro is invoked when a line is too long.  We modify the |\linewidth| to take into account |breakindent| and |breakautoindent|, and insert |\hbox|es to fill the empty space.  We also account for |breaksymbolindentleft| and |breaksymbolindentright|, but \emph{only} when there are actually break symbols.  The code is placed in a |\parbox|.  Break symbols are inserted via \pkg{lineno}'s |internallinenumbers*|, which does internal line numbers without continuity between environments (the |linenumber| counter is automatically reset).  The beginning of the line has negative |\hspace| inserted to pull it out to the correct starting position.  |\strut|s are used to maintain correct line heights.  The |\parbox| is followed by an empty |\hbox| that takes up the space needed for a right-hand break symbol (if any).  |\FV at BreakByTokenAnywhereHook| is a hook for using  |breakbytokenanywhere| when working with Pygments.  Since it is within |internallinenumbers*|, its effects do not escape.
+% This macro is invoked when a line is too long.  We modify |\FV at LineWidth| to take into account |breakindent| and |breakautoindent|, and insert |\hbox|es to fill the empty space.  We also account for |breaksymbolindentleft| and |breaksymbolindentright|, but \emph{only} when there are actually break symbols.  The code is placed in a |\parbox|.  Break symbols are inserted via \pkg{lineno}'s |internallinenumbers*|, which does internal line numbers without continuity between environments (the |linenumber| counter is automatically reset).  The beginning of the line has negative |\hspace| inserted to pull it out to the correct starting position.  |\strut|s are used to maintain correct line heights.  The |\parbox| is followed by an empty |\hbox| that takes up the space needed for a right-hand break symbol (if any).  |\FV at BreakByTokenAnywhereHook| is a hook for using  |breakbytokenanywhere| when working with Pygments.  Since it is within |internallinenumbers*|, its effects do not escape.
 %    \begin{macrocode}
 \def\FV at SaveLineBox#1{%
   \savebox{\FV at LineBox}{%
-    \advance\linewidth by -\FV at BreakIndent
+    \advance\FV at LineWidth by -\FV at BreakIndent
     \hbox to \FV at BreakIndent{\hfill}%
     \ifthenelse{\boolean{FV at BreakAutoIndent}}%
      {\let\FV at LineIndentChars\@empty
@@ -3254,15 +5513,15 @@
       \FV at GetLineIndent#1\FV at Undefined
       \savebox{\FV at LineIndentBox}{\FV at LineIndentChars}%
       \hbox to \wd\FV at LineIndentBox{\hfill}%
-      \advance\linewidth by -\wd\FV at LineIndentBox
+      \advance\FV at LineWidth by -\wd\FV at LineIndentBox
       \setcounter{FV at TrueTabCounter}{0}}%
      {}%
     \ifdefempty{\FancyVerbBreakSymbolLeft}{}%
      {\hbox to \FV at BreakSymbolIndentLeft{\hfill}%
-      \advance\linewidth by -\FV at BreakSymbolIndentLeft}%
+      \advance\FV at LineWidth by -\FV at BreakSymbolIndentLeft}%
     \ifdefempty{\FancyVerbBreakSymbolRight}{}%
-     {\advance\linewidth by -\FV at BreakSymbolIndentRight}%
-    \parbox[t]{\linewidth}{%
+     {\advance\FV at LineWidth by -\FV at BreakSymbolIndentRight}%
+    \parbox[t]{\FV at LineWidth}{%
       \FV at RaggedRight
       \leftlinenumbers*
       \begin{internallinenumbers*}%
@@ -3288,7 +5547,7 @@
 %
 %
 % \begin{macro}{\FV at ListProcessLine@Break}
-% This macro is based on the original |\FV at ListProcessLine| and follows it as closely as possible.  The |\linewidth| is reduced by |\FV at FrameSep| and |\FV at FrameRule| so that text will not overrun frames.  This is done conditionally based on which frames are in use.  We save the current line in a box, and only do special things if the box is too wide.  For uniformity, all text is placed in a |\parbox|, even if it doesn't need to be wrapped.
+% This macro is based on the original |\FV at ListProcessLine| and follows it as closely as possible.  |\FV at LineWidth| is reduced by |\FV at FrameSep| and |\FV at FrameRule| so that text will not overrun frames.  This is done conditionally based on which frames are in use.  We save the current line in a box, and only do special things if the box is too wide.  For uniformity, all text is placed in a |\parbox|, even if it doesn't need to be wrapped.
 %
 % If a line is too wide, then it is passed to |\FV at SaveLineBox|.  If there is no right-hand break symbol, then the saved result in |\FV at LineBox| may be used immediately.  If there is a right-hand break symbol, then the line must be processed a second time, so that the right-hand break symbol may be removed from the final segment of the broken line (since it does not continue).  During the first use of |\FV at SaveLineBox|, the counter |FancyVerbLineBreakLast| is set to the internal line number of the last segment of the broken line.  During the second use of |\FV at SaveLineBox|, we disable this (|\let\FV at SetLineBreakLast\relax|) so that the value of |FancyVerbLineBreakLast| remains fixed and thus may be used to determine when a right-hand break symbol should be inserted.
 %    \begin{macrocode}
@@ -3296,13 +5555,14 @@
   \hbox to \hsize{%
   \kern\leftmargin
   \hbox to \linewidth{%
+  \FV at LineWidth\linewidth
   \ifx\FV at RightListFrame\relax\else
-    \advance\linewidth by -\FV at FrameSep
-    \advance\linewidth by -\FV at FrameRule
+    \advance\FV at LineWidth by -\FV at FrameSep
+    \advance\FV at LineWidth by -\FV at FrameRule
   \fi
   \ifx\FV at LeftListFrame\relax\else
-    \advance\linewidth by -\FV at FrameSep
-    \advance\linewidth by -\FV at FrameRule
+    \advance\FV at LineWidth by -\FV at FrameSep
+    \advance\FV at LineWidth by -\FV at FrameRule
   \fi
   \ifx\FV at Tab\FV at TrueTab
     \let\FV at TrueTabSaveWidth\FV at TrueTabSaveWidth@Save
@@ -3315,7 +5575,7 @@
   \ifx\FV at Tab\FV at TrueTab
     \let\FV at TrueTabSaveWidth\relax
   \fi
-  \ifdim\wd\FV at LineBox>\linewidth
+  \ifdim\wd\FV at LineBox>\FV at LineWidth
     \setcounter{FancyVerbLineBreakLast}{0}%
     \ifx\FV at Tab\FV at TrueTab
       \let\FV at Tab\FV at TrueTab@UseWidth
@@ -3340,7 +5600,7 @@
     \FV at LeftListFrame
     \FancyVerbFormatLine{%
       \FancyVerbHighlightLine{%
-        \parbox[t]{\linewidth}{%
+        \parbox[t]{\FV at LineWidth}{%
           \noindent\strut\FV at ObeyTabs{\FancyVerbFormatText{#1}}\strut}}}%
     \FV at RightListFrame
     \FV at RightListNumber

Modified: trunk/Master/texmf-dist/tex/latex/fvextra/fvextra.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fvextra/fvextra.sty	2019-02-05 21:54:20 UTC (rev 49946)
+++ trunk/Master/texmf-dist/tex/latex/fvextra/fvextra.sty	2019-02-05 21:55:49 UTC (rev 49947)
@@ -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 at Space@ifx{\FV at Space}
-\def\FV at Tab@ifx{\FV at Tab}
+\def\FV at FVSpaceToken{\FV at Space}
+\def\FV at FVTabToken{\FV at 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 at Special:\expandafter\@gobble\detokenize{#1}\endcsname\relax}
+\FVExtraDoSpecials
+\endgroup
+\begingroup
+\catcode`\<=11
+\catcode`\>=11
+\gdef\FV at Sentinel{\FV@<Sentinel>}
+\endgroup
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FV at OuterDefEOLEmpty{\outer\def^^M{}}%
+\endgroup
+\begingroup
+\catcode`\^^M=\active%
+\gdef\FV at DefEOLEmpty{\def^^M{}}%
+\endgroup
+\begingroup
+\catcode`\^^B=\active
+\gdef\FV at OuterDefSTXEmpty{\outer\def^^B{}}
+\endgroup
+\begingroup
+\catcode`\^^C=\active
+\gdef\FV at OuterDefETXEmpty{\outer\def^^C{}}
+\endgroup
+\newif\ifFV at pdfTeXinputenc
+\FV at pdfTeXinputencfalse
+\ifcsname pdfmatch\endcsname
+\ifx\pdfmatch\relax
+\else
+  \@ifpackageloaded{inputenc}%
+   {\ifcsname inputencodingname\endcsname
+    \ifx\inputencodingname\relax
+    \else
+      \FV at pdfTeXinputenctrue
+    \fi\fi}
+   {}%
+\fi\fi
+\ifFV at pdfTeXinputenc
+\begingroup
+\catcode`\~=13
+\catcode`\"=12
+\def\FV at UTFviii@loop{%
+  \uccode`\~\count@
+  \uppercase\expandafter{\FV at UTFviii@Tmp}%
+  \advance\count@\@ne
+  \ifnum\count@<\@tempcnta
+  \expandafter\FV at UTFviii@loop
+  \fi}
+\count@"C2
+\@tempcnta"E0
+\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
+  \FV at UTF@two at octets}}
+\FV at UTFviii@loop
+\count@"E0
+\@tempcnta"F0
+\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
+  \FV at UTF@three at octets}}
+\FV at UTFviii@loop
+\count@"F0
+\@tempcnta"F4
+\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
+  \FV at UTF@four at octets}}
+\FV at UTFviii@loop
+\endgroup
+\def\FV at UTF@two at octets#1#2{%
+  \ifcsname u8:\detokenize{#1#2}\endcsname
+  \else
+    #1#2%
+  \fi
+  \FV at UTF@octets at after{#1#2}}
+\def\FV at UTF@three at octets#1#2#3{%
+  \ifcsname u8:\detokenize{#1#2#3}\endcsname
+  \else
+    #1#2#3%
+  \fi
+  \FV at UTF@octets at after{#1#2#3}}
+\def\FV at UTF@four at octets#1#2#3#4{%
+  \ifcsname u8:\detokenize{#1#2#3#4}\endcsname
+  \else
+    #1#2#3#4%
+  \fi
+  \FV at UTF@octets at after{#1#2#3#4}}
+\fi
+\long\def\FVExtra at ifnextcharVArg#1#2#3{%
+  \begingroup
+  \edef\FV at TmpSpaceCat{\the\catcode` }%
+  \let\do\@makeother\FVExtraDoSpecials
+  \catcode`\ =\FV at TmpSpaceCat\relax
+  \catcode`\{=1
+  \catcode`\}=2
+  \@ifnextchar#1{\endgroup#2}{\endgroup#3}}
+\begingroup
+\catcode`\*=12
+\gdef\FVExtra at ifstarVArg#1{\FVExtra at ifnextcharVArg*{\@firstoftwo{#1}}}
+\endgroup
+\def\FV at ReadOArgContinue#1[#2]{#1{#2}}
+\newcommand{\FVExtraReadOArgBeforeVArg}[2][]{%
+  \FVExtra at ifnextcharVArg[%
+   {\FV at ReadOArgContinue{#2}}%
+   {\FV at ReadOArgContinue{#2}[#1]}}
+\newcommand{\FVExtraReadOArgBeforeVEnv}[2][]{%
+  \begingroup
+  \catcode`\^^M=\active
+  \@ifnextchar[%
+   {\endgroup\FV at ReadOArgContinue{#2}}%
+   {\endgroup\FV at ReadOArgContinue{#2}[#1]}}
+\def\FVExtraReadVArg#1{%
+  \begingroup
+  \ifFV at pdfTeXinputenc
+    \ifdefstring{\inputencodingname}{utf8}%
+     {\let\FV at ReadVArg@Char\FV at ReadVArg@Char at UTF}%
+     {}%
+  \fi
+  \edef\FV at TmpSpaceCat{\the\catcode` }%
+  \let\do\@makeother\FVExtraDoSpecials
+  \catcode`\^^B=\active
+  \FV at OuterDefSTXEmpty
+  \catcode`\^^C=\active
+  \FV at OuterDefETXEmpty
+  \catcode`\^^M=\active
+  \FV at OuterDefEOLEmpty
+  \begingroup
+  \catcode`\ =\FV at TmpSpaceCat\relax
+  \catcode`\{=1
+  \catcode`\}=2
+  \@ifnextchar\bgroup
+   {\endgroup
+    \catcode`\{=1
+    \catcode`\}=2
+    \catcode`\ =\active
+    \catcode`\^^I=\active
+    \FV at ReadVArg@Group{#1}\FV at EOL}%
+   {\endgroup
+    \catcode`\ =\active
+    \catcode`\^^I=\active
+    \FV at ReadVArg@Char{#1}\FV at EOL}}
+\def\FV at ReadVArg@Group#1#2#3{%
+  \endgroup
+  #1{#3}}
+\def\FV at 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 at ReadVArg@Char at i##1##2##3#3{%
+    \endgroup
+    ##1{##3}}%
+  \FV at ReadVArg@Char at i{#1}\FV at EOL}%
+\ifFV at pdfTeXinputenc
+\def\FV at ReadVArg@Char at 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 at U8:\detokenize{#3}\endcsname
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\def\FV at UTF@octets at after##1{\FV at ReadVArg@Char at UTF@i{#1}{##1}}%
+   \csname FV at U8:\detokenize{#3}\endcsname#3}%
+  {\FV at ReadVArg@Char at UTF@i{#1}{#3}}}
+\def\FV at ReadVArg@Char at UTF@i#1#2{%
+  \def\FV at ReadVArg@Char at i##1##2##3#2{%
+    \endgroup
+    ##1{##3}}%
+  \FV at ReadVArg@Char at i{#1}\FV at 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 at RobustCommand@i{#1}}%
+  {\boolfalse{FVExtraRobustCommandExpanded}#1}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\FVExtraRobustCommand{}}
+\def\FV at RobustCommand@i#1#2{\expandafter#1\@gobble#2}
+\def\FVExtraUnexpandedReadStarOArgMArg#1#{%
+  \FV at UnexpandedReadStarOArgMArg@i{#1}}
+\def\FV at UnexpandedReadStarOArgMArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgMArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UnexpandedReadStarOArgMArg@i#1#2{#2}%
+  \makeatother}
+\def\FVExtraUseVerbUnexpandedReadStarOArgMArg#1#{%
+  \FV at UseVerbUnexpandedReadStarOArgMArg@i{#1}}
+\def\FV at UseVerbUnexpandedReadStarOArgMArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUseVerbUnexpandedReadStarOArgMArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UseVerbUnexpandedReadStarOArgMArg@i#1#2{%
+    \ifcsname FV at SVRaw@#2\endcsname
+      \expandafter\expandafter\expandafter\FVExtraPDFStringVerbatimDetokenize
+      \expandafter\expandafter\expandafter{\csname FV at SVRaw@#2\endcsname}%
+    \fi}%
+  \makeatother}
+\def\FVExtraUnexpandedReadStarOArgBVArg#1#{%
+  \FV at UnexpandedReadStarOArgBVArg@i{#1}}
+\def\FV at UnexpandedReadStarOArgBVArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgBVArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UnexpandedReadStarOArgBVArg@i#1#2{%
+    \FVExtraPDFStringVerbatimDetokenize{#2}}%
+  \makeatother}
+\def\FVExtraUnexpandedReadStarOArgBEscVArg#1#{%
+  \FV at UnexpandedReadStarOArgBEscVArg@i{#1}}
+\def\FV at UnexpandedReadStarOArgBEscVArg@i#1#2{%
+  \FVExtraAlwaysUnexpanded{\FVExtraUnexpandedReadStarOArgBEscVArg#1{#2}}}
+\FVExtrapdfstringdefDisableCommands{%
+  \makeatletter
+  \def\FV at UnexpandedReadStarOArgBEscVArg@i#1#2{%
+    \FVExtraPDFStringEscapedVerbatimDetokenize{#2}}%
+  \makeatother}
+\def\FVExtraPDFStringEscapeChar#1{%
+  \ifcsname FV at PDFStringEscapeChar@#1\endcsname
+    \csname FV at 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 at PDFStringEscapeChar@\!endcsname{\\}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@%!endcsname{\%}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@(!endcsname{\(}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@)!endcsname{\)}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^J!endcsname{\n}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^M!endcsname{\r}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^I!endcsname{\t}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^H!endcsname{\b}&
+!expandafter!gdef!csname FV at PDFStringEscapeChar@^^L!endcsname{\f}&
+!catcode`!\=0!relax&
+\endgroup
+\def\FVExtraPDFStringEscapeChars#1{%
+  \FV at PDFStringEscapeChars#1\FV at Sentinel}
+\def\FV at PDFStringEscapeChars#1{%
+  \ifx#1\FV at Sentinel
+  \else
+    \FVExtraPDFStringEscapeChar{#1}%
+    \expandafter\FV at PDFStringEscapeChars
+  \fi}%
+\begingroup
+\catcode`\ =10
+\catcode`\a=11
+\catcode`\<=11
+\catcode`\>=11
+\catcode`\^^C=\active
+\gdef\FVExtraVerbatimDetokenize#1{%
+  \FV at VDetok@Scan{}#1^^C \FV@<Sentinel>}
+\gdef\FV at VDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanEnd#1}%
+  {\FV at VDetok@ScanCont{#1}{#2}}}
+\gdef\FV at VDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at VDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanCont#1#2{%
+\if\relax\detokenize{#1}\relax%
+\expandafter\@gobble%
+\else%
+\expandafter\@firstofone%
+\fi%
+{\expandafter\FV at VDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}%
+ %<-catcode 12 space
+\FV at VDetok@Scan{}#2\FV@<Sentinel>}%
+\endgroup
+\gdef\FV at VDetok@ScanGroup#1#{%
+  \FV at VDetok@ScanToken#1\FV at Sentinel
+  \FV at VDetok@ScanGroup at i}
+\gdef\FV at VDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanEmptyGroup}%
+  {\FV at VDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at VDetok@ScanEmptyGroup({}\FV at VDetok@ScanGroup)
+\endgroup
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at VDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at VDetok@Scan#1^^C \FV@<Sentinel>}\FV at VDetok@ScanGroup))
+\endgroup
+\gdef\FV at VDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at VDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+\gdef\FV at VDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanTokenNoSpace#1}%
+  {\FV at VDetok@ScanTokenWithSpace{#1}}}
+\gdef\FV at VDetok@ScanTokenNoSpace#1^^C{#1\FV at VDetok@ScanToken}
+\gdef\FV at VDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanTokenActiveSpace}%
+  {\FV at VDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanTokenActiveSpace{ \FV at VDetok@ScanToken}%
+\endgroup
+\gdef\FV at VDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at VDetok@ScanTokenEscSpace{#1}}%
+  {\FV at VDetok@ScanTokenCW{#1#2}}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanTokenEscSpace#1{#1 \FV at VDetok@ScanToken}%
+\endgroup
+\begingroup
+\catcode`\ =12%
+\gdef\FV at VDetok@ScanTokenCW#1#2{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{#1 \FV at VDetok@ScanToken#2}%
+{#1\FV at VDetok@ScanToken#2}}%
+\endgroup
+\gdef\FVExtraPDFStringVerbatimDetokenize#1{%
+  \FV at PDFStrVDetok@Scan{}#1^^C \FV@<Sentinel>}
+\gdef\FV at PDFStrVDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanEnd#1}%
+  {\FV at PDFStrVDetok@ScanCont{#1}{#2}}}
+\gdef\FV at PDFStrVDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at PDFStrVDetok@ScanCont#1#2{%
+\if\relax\detokenize{#1}\relax%
+\expandafter\@gobble%
+\else%
+\expandafter\@firstofone%
+\fi%
+{\expandafter\FV at PDFStrVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}%
+ %<-catcode 12 space
+\FV at PDFStrVDetok@Scan{}#2\FV@<Sentinel>}%
+\endgroup
+\gdef\FV at PDFStrVDetok@ScanGroup#1#{%
+  \FV at PDFStrVDetok@ScanToken#1\FV at Sentinel
+  \FV at PDFStrVDetok@ScanGroup at i}
+\gdef\FV at PDFStrVDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanEmptyGroup}%
+  {\FV at PDFStrVDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrVDetok@ScanEmptyGroup({}\FV at PDFStrVDetok@ScanGroup)
+\endgroup
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrVDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at PDFStrVDetok@Scan#1^^C \FV@<Sentinel>}\FV at PDFStrVDetok@ScanGroup))
+\endgroup
+\gdef\FV at PDFStrVDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrVDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+\gdef\FV at PDFStrVDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanTokenNoSpace#1}%
+  {\FV at PDFStrVDetok@ScanTokenWithSpace{#1}}}
+\gdef\FV at PDFStrVDetok@ScanTokenNoSpace#1^^C{%
+  \FVExtraPDFStringEscapeChars{#1}\FV at PDFStrVDetok@ScanToken}
+\gdef\FV at PDFStrVDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanTokenActiveSpace}%
+  {\FV at PDFStrVDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrVDetok@ScanTokenActiveSpace{\040!FV at PDFStrVDetok@ScanToken}%
+!catcode`!\=0!relax
+\endgroup
+\gdef\FV at PDFStrVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrVDetok@ScanTokenEscSpace{#1}}%
+  {\FV at PDFStrVDetok@ScanTokenCW{#1#2}}}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrVDetok@ScanTokenEscSpace#1{%
+  !FVExtraPDFStringEscapeChar{#1}\040!FV at PDFStrVDetok@ScanToken}%
+!catcode`!\=0!relax
+\endgroup
+\begingroup
+\catcode`\ =12%
+\gdef\FV at PDFStrVDetok@ScanTokenCW#1#2{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{\FVExtraPDFStringEscapeChars{#1} \FV at PDFStrVDetok@ScanToken#2}%
+{\FVExtraPDFStringEscapeChars{#1}\FV at PDFStrVDetok@ScanToken#2}}
+\endgroup
+\gdef\FVExtraEscapedVerbatimDetokenize#1{%
+  \FV at EscVDetok@Scan{}#1^^C \FV@<Sentinel>}
+\gdef\FV at EscVDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanEnd#1}%
+  {\FV at EscVDetok@ScanCont{#1}{#2}}}
+\gdef\FV at EscVDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at EscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanCont#1#2{%
+\if\relax\detokenize{#1}\relax%
+\expandafter\@gobble%
+\else%
+\expandafter\@firstofone%
+\fi%
+{\expandafter\FV at EscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}%
+ %<-catcode 12 space
+\FV at EscVDetok@Scan{}#2\FV@<Sentinel>}%
+\endgroup
+\gdef\FV at EscVDetok@ScanGroup#1#{%
+  \FV at EscVDetok@ScanToken#1\FV at Sentinel
+  \FV at EscVDetok@ScanGroup at i}
+\gdef\FV at EscVDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanEmptyGroup}%
+  {\FV at EscVDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at EscVDetok@ScanEmptyGroup({}\FV at EscVDetok@ScanGroup)
+\endgroup
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at EscVDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at EscVDetok@Scan#1^^C \FV@<Sentinel>}\FV at EscVDetok@ScanGroup))
+\endgroup
+\gdef\FV at EscVDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at EscVDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+\gdef\FV at EscVDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenNoSpace#1}%
+  {\FV at EscVDetok@ScanTokenWithSpace{#1}}}
+\gdef\FV at EscVDetok@ScanTokenNoSpace#1#2^^C{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {#1\FV at EscVDetok@ScanToken}%
+  {#2\FV at EscVDetok@ScanToken}}
+\gdef\FV at REscVDetok@ScanTokenNoSpace#1#2^^C{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {#1\FV at EscVDetok@ScanToken}%
+  {\ifcsname FV at Special:\detokenize{#2}\endcsname#2\else\noexpand\FV@<InvalidEscape>\fi
+   \FV at EscVDetok@ScanToken}}
+\gdef\FV at EscVDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenActiveSpace}%
+  {\FV at EscVDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanTokenActiveSpace{ \FV at EscVDetok@ScanToken}%
+\endgroup
+\gdef\FV at EscVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenEscSpace{#1}}%
+  {\FV at EscVDetok@ScanTokenCW{#1}{#2}}}
+\gdef\FV at REscVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at EscVDetok@ScanTokenEscSpace{#1}}%
+  {\noexpand\FV@<InvalidEscape>\FV at EscVDetok@ScanToken}}
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanTokenEscSpace#1{ \FV at EscVDetok@ScanToken}%
+\endgroup
+\begingroup
+\catcode`\ =12%
+\gdef\FV at EscVDetok@ScanTokenCW#1#2#3{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{#2 \FV at EscVDetok@ScanToken#3}%
+{#2\FV at EscVDetok@ScanToken#3}}
+\endgroup
+\gdef\FVExtraPDFStringEscapedVerbatimDetokenize#1{%
+  \FV at PDFStrEscVDetok@Scan{}#1^^C \FV@<Sentinel>}
+\gdef\FV at PDFStrEscVDetok@Scan#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanEnd#1}%
+  {\FV at PDFStrEscVDetok@ScanCont{#1}{#2}}}
+\gdef\FV at PDFStrEscVDetok@ScanEnd#1^^C{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrEscVDetok@ScanGroup\@gobble#1{\FV@<Sentinel>}}}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrEscVDetok@ScanCont#1#2{%
+  !if!relax!detokenize{#1}!relax
+    !expandafter!@gobble
+  !else
+    !expandafter!@firstofone
+  !fi
+  {!expandafter!FV at PDFStrEscVDetok@ScanGroup!@gobble#1{!FV@<Sentinel>}}%
+  \040%<-space
+  !FV at PDFStrEscVDetok@Scan{}#2!FV@<Sentinel>}%
+!catcode`!\=0!relax
+\endgroup
+\gdef\FV at PDFStrEscVDetok@ScanGroup#1#{%
+  \FV at PDFStrEscVDetok@ScanToken#1\FV at Sentinel
+  \FV at PDFStrEscVDetok@ScanGroup at i}
+\gdef\FV at PDFStrEscVDetok@ScanGroup at i#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanEmptyGroup}%
+  {\FV at PDFStrEscVDetok@ScanGroup at ii{}#1\FV@<Sentinel>^^C}}
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrEscVDetok@ScanEmptyGroup({}\FV at PDFStrEscVDetok@ScanGroup)
+\endgroup
+\begingroup
+\catcode`\(=1
+\catcode`\)=2
+\catcode`\{=12
+\catcode`\}=12
+\gdef\FV at PDFStrEscVDetok@ScanGroup at ii#1\FV@<Sentinel>#2^^C(%
+  \if\relax\detokenize(#2)\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+  ({\FV at PDFStrEscVDetok@Scan#1^^C \FV@<Sentinel>}\FV at PDFStrEscVDetok@ScanGroup))
+\endgroup
+\gdef\FV at PDFStrEscVDetok@ScanToken#1{%
+  \ifx\FV at Sentinel#1%
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+  {\expandafter\FV at PDFStrEscVDetok@ScanToken at i\detokenize{#1}^^C \FV@<Sentinel>}}
+\gdef\FV at PDFStrEscVDetok@ScanToken at i#1 #2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanTokenNoSpace#1}%
+  {\FV at PDFStrEscVDetok@ScanTokenWithSpace{#1}}}
+\gdef\FV at PDFStrEscVDetok@ScanTokenNoSpace#1#2^^C{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FVExtraPDFStringEscapeChar{#1}\FV at PDFStrEscVDetok@ScanToken}%
+  {\FVExtraPDFStringEscapeChar{#2}\FV at PDFStrEscVDetok@ScanToken}}
+\gdef\FV at PDFStrEscVDetok@ScanTokenWithSpace#1{%
+  \if\relax\detokenize{#1}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanTokenActiveSpace}%
+  {\FV at PDFStrEscVDetok@ScanTokenWithSpace at i#1\FV@<Sentinel>}}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrEscVDetok@ScanTokenActiveSpace{\040!FV at PDFStrEscVDetok@ScanToken}%
+!catcode`!\=0!relax
+\endgroup
+\gdef\FV at PDFStrEscVDetok@ScanTokenWithSpace at i#1#2\FV@<Sentinel>{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FV at PDFStrEscVDetok@ScanTokenEscSpace{#1}}%
+  {\FV at PDFStrEscVDetok@ScanTokenCW{#1}{#2}}}
+\begingroup
+\catcode`\!=0\relax
+\catcode`\\=12!relax
+!gdef!FV at PDFStrEscVDetok@ScanTokenEscSpace#1{\040!FV at PDFStrEscVDetok@ScanToken}
+!catcode`!\=0!relax
+\endgroup
+\begingroup
+\catcode`\ =12%
+\gdef\FV at PDFStrEscVDetok@ScanTokenCW#1#2#3{%
+\ifcat\noexpand#2a%
+\expandafter\@firstoftwo%
+\else%
+\expandafter\@secondoftwo%
+\fi%
+{\FVExtraPDFStringEscapeChars{#2} \FV at PDFStrEscVDetok@ScanToken#3}%
+{\FVExtraPDFStringEscapeChars{#2}\FV at PDFStrEscVDetok@ScanToken#3}}
+\endgroup
+\gdef\FVExtraDetokenizeVArg#1#2{%
+  \begingroup
+  \catcode`\^^C=\active
+  \let^^C\FV at Sentinel
+  \edef\FV at Tmp{\FVExtraVerbatimDetokenize{#2}}%
+  \expandafter\FV at DetokenizeVArg@i\expandafter{\FV at Tmp}{#1}}
+\gdef\FV at DetokenizeVArg@i#1#2{%
+  \endgroup
+  #2{#1}}
+\gdef\FVExtraDetokenizeEscVArg#1#2{%
+  \begingroup
+  \catcode`\^^C=\active
+  \let^^C\FV at Sentinel
+  \edef\FV at Tmp{\FVExtraEscapedVerbatimDetokenize{#2}}%
+  \expandafter\FV at DetokenizeVArg@i\expandafter{\FV at Tmp}{#1}}
+\gdef\FVExtraDetokenizeREscVArg#1#2{%
+  \begingroup
+  \catcode`\^^C=\active
+  \let^^C\FV at Sentinel
+  \let\FV at EscVDetok@ScanTokenNoSpace\FV at REscVDetok@ScanTokenNoSpace
+  \let\FV at EscVDetok@ScanTokenWithSpace at i\FV at REscVDetok@ScanTokenWithSpace at i
+  \edef\FV at Tmp{\FVExtraEscapedVerbatimDetokenize{#2}}%
+  \expandafter\FV at DetokenizeREscVArg@InvalidEscapeCheck\FV at Tmp\FV@<InvalidEscape>\FV@<Sentinel>
+  \expandafter\FV at DetokenizeVArg@i\expandafter{\FV at Tmp}{#1}}
+\gdef\FV at 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 at RetokVArg@Read#1^^C^^M{%
+  \endgroup%
+  \def\FV at 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 at RetokVArg@Read
+  \let^^C\@empty
+  \FV at DefEOLEmpty
+  \scantokens{^^B#3^^C}%
+  \expandafter\FV at RetokenizeVArg@i\expandafter{\FV at TmpRetoked}{#1}}%
+\gdef\FV at RetokenizeVArg@i#1#2{%
+  #2{#1}}
+\endgroup
 \let\FV at FormattingPrep@PreHook\@empty
 \let\FV at FormattingPrep@PostHook\@empty
 \expandafter\def\expandafter\FV at FormattingPrep\expandafter{%
@@ -64,12 +905,178 @@
   \let\[\FV at leftsquarebracket
   \let\]\FV at rightsquarebracket
 } %$ <- highlighting
+\def\FV at InlineKeyValues{}
+\def\fvinlineset#1{%
+  \expandafter\def\expandafter\FV at InlineKeyValues\expandafter{%
+    \FV at InlineKeyValues#1,}}
+
+\def\FV at UseInlineKeyValues{%
+  \expandafter\fvset\expandafter{\FV at InlineKeyValues}}
+\newbool{FV at extra}
+\define at booleankey{FV}{extra}%
+ {\booltrue{FV at extra}}%
+ {\boolfalse{FV at extra}}
+\fvset{extra=true}
+\def\Verb{%
+  \FVExtraRobustCommand\RobustVerb\FVExtraUnexpandedReadStarOArgBVArg}
+\protected\def\RobustVerb{\FV at Command{}{Verb}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\RobustVerb{}}
+\let\FVC at Verb@FV\FVC at Verb
+\def\FVC at Verb{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues
+  \ifFV at extra
+    \expandafter\endgroup\expandafter\FVC at Verb@Extra
+  \else
+    \expandafter\endgroup\expandafter\FVC at Verb@FV
+  \fi}
+\def\FVC at Verb@Extra{%
+  \ifbool{FVExtraRobustCommandExpanded}%
+   {\@ifnextchar\bgroup
+     {\FVC at Verb@Extra at i}%
+     {\PackageError{fvextra}%
+       {\string\Verb\space delimiters must be paired curly braces in this context}%
+       {Use curly braces as delimiters}}}%
+   {\FVC at Verb@Extra at i}}
+\def\FVC at Verb@Extra at i{%
+  \begingroup
+  \FVExtraReadVArg{%
+    \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+    \FVExtraDetokenizeVArg{%
+      \FVExtraRetokenizeVArg{\FVC at Verb@Extra at ii}{\FV at CatCodes}}}}
+\def\FVC at Verb@Extra at ii#1{%
+  \ifFV at BreakLines
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+  {\mbox{#1}}%
+  \endgroup}
+\let\FVC at SaveVerb@FV\FVC at SaveVerb
+\def\FVC at SaveVerb{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues
+  \ifFV at extra
+    \expandafter\endgroup\expandafter\FVC at SaveVerb@Extra
+  \else
+    \expandafter\endgroup\expandafter\FVC at SaveVerb@FV
+  \fi}
+\def\FVC at SaveVerb@Extra#1{%
+  \@namedef{FV at SV@#1}{}%
+  \@namedef{FV at SVRaw@#1}{}%
+  \begingroup
+  \FVExtraReadVArg{%
+    \FVC at SaveVerb@Extra at i{#1}}}
+\def\FVC at SaveVerb@Extra at i#1#2{%
+  \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+  \FVExtraDetokenizeVArg{%
+    \FVExtraRetokenizeVArg{\FVC at SaveVerb@Extra at ii{#1}{#2}}{\FV at CatCodes}}{#2}}
+\def\FVC at SaveVerb@Extra at ii#1#2#3{%
+  \global\let\FV at AfterSave\FancyVerbAfterSave
+  \endgroup
+  \@namedef{FV at SV@#1}{#3}%
+  \@namedef{FV at SVRaw@#1}{#2}%
+  \FV at AfterSave}%
+\newbool{FV at retokenize}
+\define at booleankey{FV}{retokenize}%
+ {\booltrue{FV at retokenize}}{\boolfalse{FV at retokenize}}
+\def\UseVerb{%
+  \FVExtraRobustCommand\RobustUseVerb\FVExtraUseVerbUnexpandedReadStarOArgMArg}
+\protected\def\RobustUseVerb{\FV at Command{}{UseVerb}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\RobustUseVerb{}}
+\let\FVC at UseVerb@FV\FVC at UseVerb
+\def\FVC at UseVerb{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues
+  \ifFV at extra
+    \expandafter\endgroup\expandafter\FVC at UseVerb@Extra
+  \else
+    \expandafter\endgroup\expandafter\FVC at UseVerb@FV
+  \fi}
+\def\FVC at UseVerb@Extra#1{%
+  \@ifundefined{FV at SV@#1}%
+   {\FV at Error{Short verbatim text never saved to name `#1'}\FV at eha}%
+   {\begingroup
+    \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+    \ifbool{FV at retokenize}%
+     {\expandafter\let\expandafter\FV at Tmp\csname FV at SVRaw@#1\endcsname
+      \expandafter\FV at UseVerb@Extra at Retok\expandafter{\FV at Tmp}}%
+     {\expandafter\let\expandafter\FV at Tmp\csname FV at SV@#1\endcsname
+      \expandafter\FV at UseVerb@Extra\expandafter{\FV at Tmp}}}}
+\def\FV at UseVerb@Extra at Retok#1{%
+  \FVExtraDetokenizeVArg{%
+    \FVExtraRetokenizeVArg{\FV at UseVerb@Extra}{\FV at CatCodes}}{#1}}
+\def\FV at UseVerb@Extra#1{%
+  \ifFV at BreakLines
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+  {\mbox{#1}}%
+  \endgroup}
+\def\EscVerb{%
+  \FVExtraRobustCommand\RobustEscVerb\FVExtraUnexpandedReadStarOArgBEscVArg}
+\protected\def\RobustEscVerb{\FV at Command{}{EscVerb}}
+\FVExtrapdfstringdefDisableCommands{%
+  \def\RobustEscVerb{}}
+\def\FVC at EscVerb{%
+  \@ifnextchar\bgroup
+   {\FVC at EscVerb@i}%
+   {\PackageError{fvextra}%
+    {Invalid argument; argument must be delimited by paired curly braces}%
+    {Delimit argument with curly braces}}}
+\def\FVC at EscVerb@i#1{%
+  \begingroup
+  \FV at UseInlineKeyValues\FV at UseKeyValues\FV at FormattingPrep
+  \FVExtraDetokenizeREscVArg{%
+    \FVExtraRetokenizeVArg{\FVC at EscVerb@ii}{\FV at CatCodes}}{#1}}
+\def\FVC at EscVerb@ii#1{%
+  \ifFV at BreakLines
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+  {\FancyVerbBreakStart#1\FancyVerbBreakStop}%
+  {\mbox{#1}}%
+  \endgroup}
+\def\FV at Command#1#2{%
+  \FVExtra at ifstarVArg
+   {\def\FV at KeyValues{#1,showspaces}\FV@@Command{#2}}%
+   {\def\FV at KeyValues{#1}\FV@@Command{#2}}}
+\def\FV@@Command#1{%
+  \FVExtra at ifnextcharVArg[%
+    {\FV at GetKeyValues{\@nameuse{FVC@#1}}}%
+    {\@nameuse{FVC@#1}}}
+\def\@CustomVerbatimCommand#1#2#3#4{%
+  \begingroup\fvset{#4}\endgroup
+  \@ifundefined{FVC@#3}%
+   {\FV at 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 at Command{#4}{#3}}}%
+     \expandafter\@tempb\@tempa}%
+    {#1{#2}{\FV at Command{#4}{#3}}}}}
 \def\FancyVerbSpace{\textvisiblespace}
 \newcounter{FV at TrueTabGroupLevel}
 \def\FV@@ObeyTabs#1{%
   \let\FV at Space@Orig\FV at Space
   \let\FV at Space\FV at Space@ObeyTabs
-  \setcounter{FV at TrueTabGroupLevel}{\the\currentgrouplevel}%
+  \edef\FV at TmpCurrentGroupLevel{\the\currentgrouplevel}%
+  \setcounter{FV at TrueTabGroupLevel}{\FV at TmpCurrentGroupLevel}%
   \addtocounter{FV at TrueTabGroupLevel}{1}%
   \setbox\FV at TabBox=\hbox{#1}\box\FV at TabBox
   \let\FV at Space\FV at Space@Orig}
@@ -99,7 +1106,7 @@
 \newboolean{FV at ObeyTabs@Whitespace at Tab}
 \def\FV at TrueTab@Group{%
   \booltrue{FV at ObeyTabs@Whitespace at Tab}%
-  \gdef\FV at TmpWhitespace{\FV at Tab@ifx}%
+  \gdef\FV at TmpWhitespace{\FV at FVTabToken}%
   \FV at ObeyTabs@ScanWhitespace}
 \def\FV at Space@ObeyTabs{%
   \ifnum\value{FV at TrueTabGroupLevel}=\the\currentgrouplevel\relax
@@ -110,22 +1117,22 @@
 \def\FV at Space@ObeyTabs at NoGroup{\FV at Space@Orig}
 \def\FV at Space@ObeyTabs at Group{%
   \boolfalse{FV at ObeyTabs@Whitespace at Tab}%
-  \gdef\FV at TmpWhitespace{\FV at Space@ifx}%
+  \gdef\FV at TmpWhitespace{\FV at FVSpaceToken}%
   \FV at ObeyTabs@ScanWhitespace}
 \def\FV at ObeyTabs@ScanWhitespace{%
-  \@ifnextchar\FV at Space@ifx%
+  \@ifnextchar\FV at FVSpaceToken%
    {\FV at TrueTab@CaptureWhitespace at Space}%
-   {\ifx\@let at token\FV at Tab@ifx
+   {\ifx\@let at token\FV at FVTabToken
       \expandafter\FV at TrueTab@CaptureWhitespace at Tab
     \else
       \expandafter\FV at ObeyTabs@ResolveWhitespace
     \fi}}
 \def\FV at TrueTab@CaptureWhitespace at Space#1{%
-  \g at addto@macro\FV at TmpWhitespace{\FV at Space@ifx}%
+  \g at addto@macro\FV at TmpWhitespace{\FV at FVSpaceToken}%
   \FV at ObeyTabs@ScanWhitespace}
 \def\FV at TrueTab@CaptureWhitespace at Tab#1{%
   \booltrue{FV at ObeyTabs@Whitespace at Tab}%
-  \g at addto@macro\FV at TmpWhitespace{\FV at Tab@ifx}%
+  \g at addto@macro\FV at TmpWhitespace{\FV at FVTabToken}%
   \FV at ObeyTabs@ScanWhitespace}
 \newbox\FV at TabBox@Group
 \def\FV at TrueTab@Group at Expand{%
@@ -273,6 +1280,15 @@
    {}}
 \g at addto@macro\FV at FormattingPrep@PreHook{\FancyVerbCurlyQuotes}
 \fvset{curlyquotes=false}
+\define at key{FV}{fontencoding}%
+ {\ifstrempty{#1}%
+   {\let\FV at FontEncoding\relax}%
+   {\ifstrequal{#1}{none}%
+     {\let\FV at FontEncoding\relax}%
+     {\def\FV at FontEncoding{\fontencoding{#1}}}}}
+\expandafter\def\expandafter\FV at SetupFont\expandafter{%
+  \expandafter\FV at FontEncoding\FV at SetupFont}
+\fvset{fontencoding=none}
 \def\FancyVerbFormatLine#1{#1}
 \def\FancyVerbFormatText#1{#1}
 \def\FV at ListProcessLine@NoBreak#1{%
@@ -507,7 +1523,18 @@
   \colorbox{\FancyVerbHighlightColor}{%
     \setlength{\fboxsep}{\FV at TmpLength}%
     \rlap{\strut#1}%
-    \hspace{\linewidth}}}
+    \hspace{\linewidth}%
+    \ifx\FV at RightListFrame\relax\else
+      \hspace{-\FV at FrameSep}%
+      \hspace{-\FV at FrameRule}%
+    \fi
+    \ifx\FV at LeftListFrame\relax\else
+      \hspace{-\FV at FrameSep}%
+      \hspace{-\FV at FrameRule}%
+    \fi
+  }%
+  \hss
+}
 \let\FancyVerbHighlightLineMiddle\FancyVerbHighlightLineFirst
 \let\FancyVerbHighlightLineLast\FancyVerbHighlightLineFirst
 \let\FancyVerbHighlightLineSingle\FancyVerbHighlightLineFirst
@@ -754,18 +1781,12 @@
 }
 \let\FV at BreakAfterPrep@PygmentsHook\relax
 \g at addto@macro\FV at FormattingPrep@PreHook{%
-  \ifcsname pdfmatch\endcsname
-  \ifx\pdfmatch\relax
-  \else
-    \ifcsname inputencodingname\endcsname
-    \ifx\inputencodingname\relax
-    \else
-      \ifdefstring{\inputencodingname}{utf8}%
-       {\let\FV at BreakBeforePrep\FV at BreakBeforePrep@UTF
-        \let\FV at BreakAfterPrep\FV at BreakAfterPrep@UTF}%
-       {}%
-    \fi\fi
-  \fi\fi
+  \ifFV at pdfTeXinputenc
+    \ifdefstring{\inputencodingname}{utf8}%
+     {\let\FV at BreakBeforePrep\FV at BreakBeforePrep@UTF
+      \let\FV at BreakAfterPrep\FV at BreakAfterPrep@UTF}%
+     {}%
+  \fi
   \FV at BreakBeforePrep\FV at BreakAfterPrep}
 \define at key{FV}{breakanywheresymbolpre}{%
   \ifstrempty{#1}%
@@ -815,12 +1836,12 @@
   \ifx\FV at NextChar\FV at Undefined\relax
     \let\FV at Next=\relax
   \else
-    \ifx\FV at NextChar\FV at Space@ifx\relax
-      \g at addto@macro{\FV at LineIndentChars}{\FV at Space@ifx}%
+    \ifx\FV at NextChar\FV at FVSpaceToken\relax
+      \g at addto@macro{\FV at LineIndentChars}{\FV at FVSpaceToken}%
       \let\FV at Next=\FV at GetLineIndent
     \else
-      \ifx\FV at NextChar\FV at Tab@ifx\relax
-        \g at addto@macro{\FV at LineIndentChars}{\FV at Tab@ifx}%
+      \ifx\FV at NextChar\FV at FVTabToken\relax
+        \g at addto@macro{\FV at LineIndentChars}{\FV at FVTabToken}%
         \let\FV at Next=\FV at GetLineIndent
       \else
         \let\FV at Next=\FV at CleanRemainingChars
@@ -836,23 +1857,17 @@
 \def\FV at Break{%
   \def\FV at TmpLine{}%
   \let\FV at LastToken=\FV at Undefined
-  \ifcsname pdfmatch\endcsname
-  \ifx\pdfmatch\relax
-  \else
-    \ifcsname inputencodingname\endcsname
-    \ifx\inputencodingname\relax
-    \else
-      \ifdefstring{\inputencodingname}{utf8}%
-       {\ifx\FV at Break@Token\FV at Break@AnyToken
-          \let\FV at Break@Token\FV at Break@AnyToken at UTF
-        \else
-          \ifx\FV at Break@Token\FV at Break@BeforeAfterToken
-            \let\FV at Break@Token\FV at Break@BeforeAfterToken at UTF
-          \fi
-        \fi}%
-       {}%
-    \fi\fi
-  \fi\fi
+  \ifFV at pdfTeXinputenc
+    \ifdefstring{\inputencodingname}{utf8}%
+     {\ifx\FV at Break@Token\FV at Break@AnyToken
+        \let\FV at Break@Token\FV at Break@AnyToken at UTF
+      \else
+         \ifx\FV at Break@Token\FV at Break@BeforeAfterToken
+           \let\FV at Break@Token\FV at Break@BeforeAfterToken at UTF
+         \fi
+      \fi}%
+     {}%
+  \fi
   \FV at Break@Scan
 }
 \def\FV at EndBreak{\FV at TmpLine}
@@ -939,7 +1954,7 @@
   \expandafter\FV at Break@AfterTokenBreak\FV at RescanToken}
 \def\FV at Break@AfterTokenBreak#1{%
   \let\FV at LastToken=#1%
-  \@ifnextchar\FV at Space@ifx%
+  \@ifnextchar\FV at FVSpaceToken%
    {\g at addto@macro{\FV at TmpLine}{#1}\FV at Break@Scan}%
    {\ifthenelse{\boolean{FV at BreakAfterGroup}}%
      {\ifx\@let at token#1\relax
@@ -969,53 +1984,7 @@
    {\FV at Break@Scan}%
    {\g at addto@macro{\FV at TmpLine}{\FancyVerbBreakAfterBreak}%
     \FV at Break@Scan}}
-\ifcsname pdfmatch\endcsname
-\ifx\pdfmatch\relax
-\else
-\def\FV at UTF@two at octets#1#2{%
-  \ifcsname u8:\detokenize{#1#2}\endcsname
-  \else
-    #1#2%
-  \fi
-  \FV at Break@NextNext{#1#2}}
-\def\FV at UTF@three at octets#1#2#3{%
-  \ifcsname u8:\detokenize{#1#2#3}\endcsname
-  \else
-    #1#2#3%
-  \fi
-  \FV at Break@NextNext{#1#2#3}}
-\def\FV at UTF@four at octets#1#2#3#4{%
-  \ifcsname u8:\detokenize{#1#2#3#4}\endcsname
-  \else
-    #1#2#3#4%
-  \fi
-  \FV at Break@NextNext{#1#2#3#4}}
-\begingroup
-\catcode`\~=13
-\catcode`\"=12
-\def\FV at UTFviii@loop{%
-  \uccode`\~\count@
-  \uppercase\expandafter{\FV at UTFviii@Tmp}%
-  \advance\count@\@ne
-  \ifnum\count@<\@tempcnta
-  \expandafter\FV at UTFviii@loop
-  \fi}
-\count@"C2
-\@tempcnta"E0
-\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
-  \FV at UTF@two at octets}}
-\FV at UTFviii@loop
-\count@"E0
-\@tempcnta"F0
-\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
-  \FV at UTF@three at octets}}
-\FV at UTFviii@loop
-\count@"F0
-\@tempcnta"F4
-\def\FV at UTFviii@Tmp{\expandafter\gdef\csname FV at U8:\string~\endcsname{%
-  \FV at UTF@four at octets}}
-\FV at UTFviii@loop
-\endgroup
+\ifFV at pdfTeXinputenc
 \def\FV at BreakBeforePrep@UTF{%
   \ifx\FV at BreakBefore\@empty\relax
   \else
@@ -1024,7 +1993,7 @@
     \def\FV at BreakBefore@Process##1{%
       \ifcsname FV at U8:\detokenize{##1}\endcsname
         \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{##1}\endcsname
-        \let\FV at Break@NextNext\FV at BreakBefore@Process at ii
+        \let\FV at UTF@octets at after\FV at BreakBefore@Process at ii
       \else
         \ifx##1\FV at Undefined
           \let\FV at Break@Next\@gobble
@@ -1056,7 +2025,7 @@
     \def\FV at BreakAfter@Process##1{%
       \ifcsname FV at U8:\detokenize{##1}\endcsname
         \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{##1}\endcsname
-        \let\FV at Break@NextNext\FV at BreakAfter@Process at ii
+        \let\FV at UTF@octets at after\FV at BreakAfter@Process at ii
       \else
         \ifx##1\FV at Undefined
           \let\FV at Break@Next\@gobble
@@ -1096,7 +2065,7 @@
 \def\FV at Break@AnyToken at UTF#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@AnyToken at UTF@i
+    \let\FV at UTF@octets at after\FV at Break@AnyToken at UTF@i
   \else
     \let\FV at Break@Next\FV at Break@AnyToken at UTF@i
   \fi
@@ -1108,7 +2077,7 @@
 \def\FV at Break@BeforeAfterToken at UTF#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@BeforeAfterToken at UTF@i
+    \let\FV at UTF@octets at after\FV at Break@BeforeAfterToken at UTF@i
   \else
     \let\FV at Break@Next\FV at Break@BeforeAfterToken at UTF@i
   \fi
@@ -1167,7 +2136,7 @@
   \expandafter\FV at Break@AfterTokenBreak at UTF\expandafter{\FV at RescanToken}}
 \def\FV at Break@AfterTokenBreak at UTF#1{%
   \def\FV at LastToken{#1}%
-  \@ifnextchar\FV at Space@ifx%
+  \@ifnextchar\FV at FVSpaceToken%
    {\g at addto@macro{\FV at TmpLine}{#1}\FV at Break@Scan}%
    {\ifthenelse{\boolean{FV at BreakAfterGroup}}%
      {\g at addto@macro{\FV at TmpLine}{#1}%
@@ -1183,7 +2152,7 @@
 \def\FV at Break@AfterTokenBreak at UTF@i#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@AfterTokenBreak at UTF@i
+    \let\FV at UTF@octets at after\FV at Break@AfterTokenBreak at UTF@i
   \else
     \def\FV at NextToken{#1}%
     \ifx\FV at LastToken\FV at NextToken
@@ -1206,7 +2175,7 @@
 \def\FV at Break@AfterTokenBreak at Group@UTF at ii#1{%
   \ifcsname FV at U8:\detokenize{#1}\endcsname
     \expandafter\let\expandafter\FV at Break@Next\csname FV at U8:\detokenize{#1}\endcsname
-    \let\FV at Break@NextNext\FV at Break@AfterTokenBreak at Group@UTF at ii
+    \let\FV at UTF@octets at after\FV at Break@AfterTokenBreak at Group@UTF at ii
   \else
     \def\FV at NextToken{#1}%
     \ifx\FV at LastToken\FV at NextToken
@@ -1216,7 +2185,7 @@
     \let\FV at Break@Next\FV at Break@Scan
   \fi
   \FV at Break@Next#1}
-\fi\fi
+\fi
 \def\FV at makeLineNumber{%
   \hss
   \FancyVerbBreakSymbolLeftLogic{\FancyVerbBreakSymbolLeft}%
@@ -1230,9 +2199,10 @@
 \def\FV at RaggedRight{%
   \let\\\@centercr
   \@rightskip\@flushglue\rightskip\@rightskip\leftskip\z at skip\parindent\z@}
+\newdimen\FV at LineWidth
 \def\FV at SaveLineBox#1{%
   \savebox{\FV at LineBox}{%
-    \advance\linewidth by -\FV at BreakIndent
+    \advance\FV at LineWidth by -\FV at BreakIndent
     \hbox to \FV at BreakIndent{\hfill}%
     \ifthenelse{\boolean{FV at BreakAutoIndent}}%
      {\let\FV at LineIndentChars\@empty
@@ -1239,15 +2209,15 @@
       \FV at GetLineIndent#1\FV at Undefined
       \savebox{\FV at LineIndentBox}{\FV at LineIndentChars}%
       \hbox to \wd\FV at LineIndentBox{\hfill}%
-      \advance\linewidth by -\wd\FV at LineIndentBox
+      \advance\FV at LineWidth by -\wd\FV at LineIndentBox
       \setcounter{FV at TrueTabCounter}{0}}%
      {}%
     \ifdefempty{\FancyVerbBreakSymbolLeft}{}%
      {\hbox to \FV at BreakSymbolIndentLeft{\hfill}%
-      \advance\linewidth by -\FV at BreakSymbolIndentLeft}%
+      \advance\FV at LineWidth by -\FV at BreakSymbolIndentLeft}%
     \ifdefempty{\FancyVerbBreakSymbolRight}{}%
-     {\advance\linewidth by -\FV at BreakSymbolIndentRight}%
-    \parbox[t]{\linewidth}{%
+     {\advance\FV at LineWidth by -\FV at BreakSymbolIndentRight}%
+    \parbox[t]{\FV at LineWidth}{%
       \FV at RaggedRight
       \leftlinenumbers*
       \begin{internallinenumbers*}%
@@ -1272,13 +2242,14 @@
   \hbox to \hsize{%
   \kern\leftmargin
   \hbox to \linewidth{%
+  \FV at LineWidth\linewidth
   \ifx\FV at RightListFrame\relax\else
-    \advance\linewidth by -\FV at FrameSep
-    \advance\linewidth by -\FV at FrameRule
+    \advance\FV at LineWidth by -\FV at FrameSep
+    \advance\FV at LineWidth by -\FV at FrameRule
   \fi
   \ifx\FV at LeftListFrame\relax\else
-    \advance\linewidth by -\FV at FrameSep
-    \advance\linewidth by -\FV at FrameRule
+    \advance\FV at LineWidth by -\FV at FrameSep
+    \advance\FV at LineWidth by -\FV at FrameRule
   \fi
   \ifx\FV at Tab\FV at TrueTab
     \let\FV at TrueTabSaveWidth\FV at TrueTabSaveWidth@Save
@@ -1291,7 +2262,7 @@
   \ifx\FV at Tab\FV at TrueTab
     \let\FV at TrueTabSaveWidth\relax
   \fi
-  \ifdim\wd\FV at LineBox>\linewidth
+  \ifdim\wd\FV at LineBox>\FV at LineWidth
     \setcounter{FancyVerbLineBreakLast}{0}%
     \ifx\FV at Tab\FV at TrueTab
       \let\FV at Tab\FV at TrueTab@UseWidth
@@ -1316,7 +2287,7 @@
     \FV at LeftListFrame
     \FancyVerbFormatLine{%
       \FancyVerbHighlightLine{%
-        \parbox[t]{\linewidth}{%
+        \parbox[t]{\FV at LineWidth}{%
           \noindent\strut\FV at ObeyTabs{\FancyVerbFormatText{#1}}\strut}}}%
     \FV at RightListFrame
     \FV at RightListNumber



More information about the tex-live-commits mailing list