add code macro usable inside other environments

This commit is contained in:
Maximilian Keßler 2022-02-10 01:13:34 +01:00
parent 394ecc310c
commit 371ce76a81

View file

@ -7,15 +7,18 @@ __NEW_IF__(pipe,false)
\catcode`_=13 \catcode`_=13
\let_\_ \let_\_
\catcode`_=8 \catcode`_=8
\newcommand\code{
\begingroup \ExplSyntaxOn
\catcode`_=\active \NewDocumentCommand{\code}{m}
\code@impl {
\tl_set_rescan:Nnn \l_tmpa_tl
{
\char_set_catcode_active:N _
} }
\newcommand\code@impl[1]{ { #1 }
\texttt{#1} \texttt{ \tl_use:N \l_tmpa_tl }
\endgroup
} }
\ExplSyntaxOff
\newif\ifactive\activefalse \newif\ifactive\activefalse
__IF__(pipe) __IF__(pipe)