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
|
||||
\let_\_
|
||||
\catcode`_=8
|
||||
\newcommand\code{
|
||||
\begingroup
|
||||
\catcode`_=\active
|
||||
\code@impl
|
||||
|
||||
\ExplSyntaxOn
|
||||
\NewDocumentCommand{\code}{m}
|
||||
{
|
||||
\tl_set_rescan:Nnn \l_tmpa_tl
|
||||
{
|
||||
\char_set_catcode_active:N _
|
||||
}
|
||||
\newcommand\code@impl[1]{
|
||||
\texttt{#1}
|
||||
\endgroup
|
||||
{ #1 }
|
||||
\texttt{ \tl_use:N \l_tmpa_tl }
|
||||
}
|
||||
\ExplSyntaxOff
|
||||
|
||||
\newif\ifactive\activefalse
|
||||
__IF__(pipe)
|
||||
|
|
Loading…
Reference in a new issue