add code macro usable inside other environments

Build branch master (371ce76) from kesslermaximilian/LatexPackages
This commit is contained in:
Maximilian Keßler 2022-02-10 00:14:06 +00:00
parent 89e7d8c669
commit a0064f3b16
2 changed files with 20 additions and 17 deletions

View file

@ -1,8 +1,8 @@
{ {
"build_time": "", "build_time": "",
"source files": { "source files": {
"version": "v2.9-3-g394ecc3", "version": "v2.9-4-g371ce76",
"commit": "394ecc310cf67afd6630fae6d9321e9ea2e2da8c", "commit": "371ce76a81138a9ba73676a41190c71ecd2b5748",
"dirty": false "dirty": false
}, },
"pytex": { "pytex": {
@ -36,12 +36,12 @@
{ {
"name": "wip/code/mkessler-code.sty", "name": "wip/code/mkessler-code.sty",
"source file": "wip/code/code.pysty", "source file": "wip/code/code.pysty",
"build time": "2022/02/09 23:40", "build time": "2022/02/10 00:14",
"source version": "v2.9-3-g394ecc3", "source version": "v2.9-4-g371ce76",
"source commit hash": "394ecc310cf67afd6630fae6d9321e9ea2e2da8c", "source commit hash": "371ce76a81138a9ba73676a41190c71ecd2b5748",
"pytex version": "v1.2.0-31-gc9bb0e8", "pytex version": "v1.2.0-31-gc9bb0e8",
"pytex commit hash": "c9bb0e87c91beae3e17a829603e4459cf804ec51", "pytex commit hash": "c9bb0e87c91beae3e17a829603e4459cf804ec51",
"md5sum": "c7e63292c9f515f645da21352bb6785e", "md5sum": "68ded87bc3cbb44e2c3ff6874eda1a5e",
"dirty": false "dirty": false
}, },
{ {

View file

@ -31,7 +31,7 @@
% %
% Build details: % Build details:
% PyTeX version: v1.2.0-31-gc9bb0e8 (commit c9bb0e8) % PyTeX version: v1.2.0-31-gc9bb0e8 (commit c9bb0e8)
% Source code version: v2.9-3-g394ecc3 (commit 394ecc3) % Source code version: v2.9-4-g371ce76 (commit 371ce76)
% %
% This LaTeX package is free software and is dual-licensed % This LaTeX package is free software and is dual-licensed
% under the LPPLv1.3c and the GPLv3 licenses. % under the LPPLv1.3c and the GPLv3 licenses.
@ -47,7 +47,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-code}[2022/02/09 - Hacky code setup for verbatim code] \ProvidesPackage{mkessler-code}[2022/02/10 - Hacky code setup for verbatim code]
@ -58,15 +58,18 @@
\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
\ifmkessler@code@pipe \ifmkessler@code@pipe