39 lines
686 B
Text
39 lines
686 B
Text
__HEADER__(Hacky code setup for verbatim code)
|
|
|
|
__NEW_IF__(pipe,false)
|
|
\DeclareOption{pipe}{__SET_IF__(pipe,true)}
|
|
\ProcessOptions
|
|
|
|
\catcode`_=13
|
|
\let_\_
|
|
\catcode`_=8
|
|
|
|
\ExplSyntaxOn
|
|
\NewDocumentCommand{\code}{m}
|
|
{
|
|
\tl_set_rescan:Nnn \l_tmpa_tl
|
|
{
|
|
\char_set_catcode_active:N _
|
|
}
|
|
{ #1 }
|
|
\texttt{ \tl_use:N \l_tmpa_tl }
|
|
}
|
|
\ExplSyntaxOff
|
|
|
|
\newif\ifactive\activefalse
|
|
__IF__(pipe)
|
|
\catcode`|=\active
|
|
\def|{
|
|
\ifactive
|
|
\endgroup
|
|
\activefalse
|
|
\else
|
|
\begingroup
|
|
\catcode`_=13
|
|
\ttfamily
|
|
\fi
|
|
}
|
|
% Quick fix for tables
|
|
\AddToHook{env/tabular/begin}[code]{\catcode`|=13}
|
|
\AddToHook{env/tabular/end}[code]{\catcode`|=8}
|
|
\fi
|