diff options
Diffstat (limited to 'Master/texmf-dist/tex/csplain/opmac/opmac.tex')
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac.tex | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex index fbd35930f14..6f7e5da9002 100644 --- a/Master/texmf-dist/tex/csplain/opmac/opmac.tex +++ b/Master/texmf-dist/tex/csplain/opmac/opmac.tex @@ -5,7 +5,7 @@ %% The history of versions is at the end of this file, after \endpinput \ifx\OPmacversion\undefined \else \endinput \fi -\def\OPmacversion{Mar. 2016} +\def\OPmacversion{Apr. 2016a} \immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>} %%%%%%%%%%%%%% Basic macros, sec. 3.1 in opmac-d.pdf @@ -41,10 +41,14 @@ \csname iftrue\expandafter\endcsname \fi}% end of \def\tmp \expandafter\tmp#1\endlistsep#2\end } -\long\def\isnextchar#1#2#3{\begingroup\def\tmpa{\endgroup#2}\def\tmpb{\endgroup#3}% +\long\def\isnextchar#1#2#3{\begingroup\toks0={\endgroup#2}\toks1={\endgroup#3}% \let\tmp=#1\futurelet\next\isnextcharA } -\def\isnextcharA{\ifx\tmp\next\expandafter\tmpa\else\expandafter\tmpb\fi} +\def\isnextcharA{\the\toks\ifx\tmp\next0\else1\fi\space} + +\def\eoldef#1{\def#1{\begingroup \catcode`\^^M=12 \eoldefA#1}% + \expandafter\def\csname\string#1:M\endcsname} +{\catcode`\^^M=12 \gdef\eoldefA#1#2^^M{\endgroup\csname\string#1:M\endcsname{#2}}} \def\maybebreak{\afterassignment\maybebreakA\tmpdim=} \def\maybebreakA{\ifvmode \vskip0pt plus\tmpdim \penalty-130 \vskip0pt plus-\tmpdim @@ -329,9 +333,9 @@ {\seccfont \noindent \dotocnum{\thetocnum\quad}#1\nbpar}% \nobreak \remskip\medskipamount \firstnoindent } -\def\tit#1\par{\vglue4em +\eoldef\tit#1{\vglue4em {\leftskip=0pt plus1fill \rightskip=\leftskip - \titfont \noindent #1\unskip\par}% + \titfont \noindent #1\par}% \nobreak\bigskip } \def\titfont{\typobase\typoscale[\magstep4/\magstep4]\bfshape} @@ -344,23 +348,23 @@ \newif\ifnotoc \notocfalse \def\notoc{\global\notoctrue} \newif\ifnonum \nonumfalse \def\nonum{\global\nonumtrue} -\def\chap#1\par{\ifnonum\else \global\advance\chapnum by1 \fi +\eoldef\chap#1{\ifnonum\else \global\advance\chapnum by1 \fi \chaphook {\globaldefs=1 \secnum=0 \seccnum=0 \tnum=0 \fnum=0 \dnum=0}\relax \edef\thechapnum{\the\chapnum}\let\thetocnum=\thechapnum \def\dotocnumafter{\wtotoc0\bfshape{#1}}% - \printchap{#1\unskip}\resetnonumnotoc + \printchap{#1}\resetnonumnotoc } -\def\sec#1\par{\ifnonum\else \global\advance\secnum by1 \fi +\eoldef\sec#1{\ifnonum\else \global\advance\secnum by1 \fi \sechook {\globaldefs=1 \seccnum=0 \tnum=0 \fnum=0 \dnum=0}\relax \edef\thesecnum{\othe\chapnum.\the\secnum}\let\thetocnum=\thesecnum \def\dotocnumafter{\wtotoc1\rm{#1}}% - \printsec{#1\unskip}\resetnonumnotoc + \printsec{#1}\resetnonumnotoc } -\def\secc#1\par{\ifnonum\else \global\advance\seccnum by1 \fi +\eoldef\secc#1{\ifnonum\else \global\advance\seccnum by1 \fi \secchook {}\relax \edef\theseccnum{\othe\chapnum.\the\secnum.\the\seccnum}\let\thetocnum=\theseccnum \def\dotocnumafter{\wtotoc2\rm{#1}}% - \printsecc{#1\unskip}\resetnonumnotoc + \printsecc{#1}\resetnonumnotoc } \def\wtotoc#1#2#3{% #1 = level, #2 = info, #3 = titletext \ifnotoc\else @@ -479,7 +483,7 @@ \ifischap\advance\leftskip by\iindent\fi \ifnum#1>1 \advance\leftskip by\iindent\fi \toclinehook \noindent\llap{#2\toclink{#3}\enspace}% - {#2#4\unskip}\nobreak\tocdotfill\pglink{#5}\nobreak\hskip-2\iindent\null\par}} + {#2#4}\nobreak\tocdotfill\pglink{#5}\nobreak\hskip-2\iindent\null\par}} \def\tocdotfill{\leaders\hbox to.8em{\hss.\hss}\hskip 1em plus1fill\relax} \def\maketoc{\par \ifx\toclist\empty @@ -1199,9 +1203,9 @@ \edef\vrule{\orivrule width\the\tmpdim}} \long\def\frame#1{% - \hbox{\vrule\vtop{\vbox{\hrule\kern\vvkern{% + \hbox{\vrule\vtop{\vbox{\hrule\kern\vvkern \hbox{\kern\hhkern#1\kern\hhkern}% - }}\kern\vvkern\hrule}\vrule}} + }\kern\vvkern\hrule}\vrule}} %%%%%%%%%%%%%% \inspic -- sec. 3.20 in opmac-d.pdf @@ -1758,5 +1762,8 @@ Nov. 2015 \parskip=0 in \doverbinput, \vskip\parskip before first \ttskip Jan. 2016 \inspicpage introduced \isolangset: \chardef..Patt added Mar. 2016 \thefnote default changed: ^{num}) -> ^{num} +Apr. 2016 \frame: redundant group removed + \isnextchar improved (using \toks) + \eoldef introduced to \tit, \chap, \sec, \secc, see OPmac trick 0121 %%%%%%%%%%%%%% End of opmac.tex |