summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/optex/base/verbatim.opm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/optex/base/verbatim.opm')
-rw-r--r--Master/texmf-dist/tex/optex/base/verbatim.opm27
1 files changed, 21 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/optex/base/verbatim.opm b/Master/texmf-dist/tex/optex/base/verbatim.opm
index 8fd20ee5317..08748eb5a69 100644
--- a/Master/texmf-dist/tex/optex/base/verbatim.opm
+++ b/Master/texmf-dist/tex/optex/base/verbatim.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \begtt {Verbatim <2021-01-22>} % preloaded in format
+\_codedecl \begtt {Verbatim <2021-04-18>} % preloaded in format
\_doc ----------------------------
The internal parameters
@@ -125,15 +125,16 @@
\_ifnum\_ttline<0 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi
\_adef{ }{\_dsp}\_adef\^^I{\t}\_parindent=\_ttindent \_parskip=0pt
\_def\t{\_hskip \_dimexpr\_tabspaces em/2\_relax}%
+ \_protrudechars=0 % disable protrusion
\_the\_everytt \_relax #1\_relax \_ttfont
\_def\_testcommentchars##1\_iftrue{\_iffalse}\_let\_hicomments=\_relax
- \_endlinechar=`^^J
+ \_savemathsb \_endlinechar=`^^J
\_startverb
}
\_ea\_def\_ea\_startverb \_ea#\_ea1\_csstring\\endtt#2^^J{%
\_prepareverbdata\_tmpb{#1^^J}%
\_ea\_printverb \_tmpb\_end
- \_par
+ \_par \_restoremathsb
\_endgroup \_ttskip
\_isnextchar\_par{}{\_noindent}%
}
@@ -246,8 +247,9 @@
\_ifnum\_ttline<-1 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi
\_setverb \_adef{ }{\_dsp}\_adef\^^I{\t}\_parindent=\_ttindent \_parskip=0pt
\_def\t{\_hskip \_dimexpr\_tabspaces em/2\_relax}%
+ \_protrudechars=0 % disable protrusion
\_the\_everytt\_relax \_tmpb\_relax \_ttfont
- \_endlinechar=`^^J \_tmpnum=0
+ \_savemathsb \_endlinechar=`^^J \_tmpnum=0
\_loop \_ifeof\_vifile \_tmpnum=\_vinolines\_space \_fi
\_ifnum\_tmpnum<\_vinolines\_space
\_vireadline \_advance\_tmpnum by1 \_repeat %% skip lines
@@ -265,7 +267,7 @@
\_catcode`\ =10 \_catcode`\%=9 % used in \commentchars comments
\_ea\_printverb \_tmpb\_end
\_global\_ttlinesave
- \_par
+ \_par \_restoremathsb
\_endgroup
\_ttskip
\_isnextchar\_par{}{\_noindent}%
@@ -276,6 +278,17 @@
\_public \verbinput ;
\_doc -----------------------------
+ \`\_savemathsb`, \`\_restoremathsb` pair is used
+ in \^`\begtt`...\^`\endtt` or in \^`\verbinput` to temporary suppress
+ the \^`\mathsbon` because we don't need to print `\int _a`
+ in verbatim mode if `\int``_a` is really written. The \^`\_restoremathsb`
+ is defined locally as \^`\mathsbon` only if it is needed.
+ \_cod -----------------------------
+
+\_def\_savemathsb{\_ifmathsb \_mathsboff \_def\_restoremathsb{\_mathsbon}\_fi}
+\_def\_restoremathsb{}
+
+ \_doc -----------------------------
If the language of your code\label[commentchars]\wlabel{}
printed by \^`\verbinput` supports the
format of comments started by two characters from the beginning of the
@@ -363,7 +376,9 @@
\_endinput
History:
-2020-01-22 ... \activettchar changed to \verbchar
+2021-04-18 ... \_protrudechars=0 added
+2021-04-07 ... \_savemathsb, \_restoremathsb introduced
+2021-01-22 ... \activettchar changed to \verbchar
2020-12-30 ... \secc followed by \begtt must be unbreakable
2020-11-13 ... \commentchars implemented
2020-04-22 ... \ttshift introduced