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
\newcommand\code@impl[1]{ {
\texttt{#1} \char_set_catcode_active:N _
\endgroup }
} { #1 }
\texttt{ \tl_use:N \l_tmpa_tl }
}
\ExplSyntaxOff
\newif\ifactive\activefalse \newif\ifactive\activefalse
__IF__(pipe) __IF__(pipe)