add code macro usable inside other environments
This commit is contained in:
parent
394ecc310c
commit
371ce76a81
1 changed files with 12 additions and 9 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue