summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/tex/csplain/opmac/opmac.tex86
1 files changed, 65 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex
index 74883ed93cc..08a82f01687 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{Jun 2016}
+\def\OPmacversion{Jun. 2017}
\immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>}
%%%%%%%%%%%%%% Basic macros, sec. 3.1 in opmac-d.pdf
@@ -40,9 +40,9 @@
\csname iftrue\expandafter\endcsname
\fi
}
-\long\def\isinlist#1#2#3{\long\def\tmp##1#2##2\end{\def\tmp{##2}%
- \ifx\tmp\empty \csname iffalse\expandafter\endcsname \else
- \csname iftrue\expandafter\endcsname \fi}% end of \def\tmp
+\long\def\isinlist#1#2#3{\begingroup \long\def\tmp##1#2##2\end{\def\tmp{##2}%
+ \ifx\tmp\empty \endgroup \csname iffalse\expandafter\endcsname \else
+ \endgroup \csname iftrue\expandafter\endcsname \fi}% end of \def\tmp
\expandafter\tmp#1\endlistsep#2\end
}
\long\def\isnextchar#1#2#3{\begingroup\toks0={\endgroup#2}\toks1={\endgroup#3}%
@@ -1152,51 +1152,90 @@
\newtoks\tabdata
\def\tabstrutA{\tabstrut}
-\newcount\colnum \colnum=0
+\newcount\colnum
\def\ddlinedata{}
\def\vvleft{}
\def\table{\vbox\bgroup \catcode`\|=12 \tableA}
-\def\tableA#1#2{\offinterlineskip \def\tmpa{}\tabdata={}\scantabdata#1\relax
+\def\tableA#1#2{\offinterlineskip \colnum=0 \def\tmpa{}\tabdata={}\scantabdata#1\relax
\halign\expandafter{\the\tabdata\cr#2\crcr}\egroup}
\def\scantabdata#1{\let\next=\scantabdata
\ifx\relax#1\let\next=\relax
\else\ifx|#1\addtabvrule
- \else\expandafter\ifx\csname tabdeclare#1\endcsname \relax
- \opwarning{tab-declare letter #1 unknown, ignored}%
- \else\expandafter \addtabitem\expandafter{\csname tabdeclare#1\endcsname}%
- \fi\fi\fi \next
+ \else\isinlist{123456789}#1\iftrue \def\next{\scantabdataC#1}%
+ \else \expandafter\ifx\csname tabdeclare#1\endcsname \relax
+ \expandafter\ifx\csname paramtabdeclare#1\endcsname \relax
+ \opwarning{tab-declarator "#1" unknown, ignored}%
+ \else \def\next{\expandafter \scantabdataB \csname paramtabdeclare#1\endcsname}\fi
+ \else \def\next{\expandafter\scantabdataA \csname tabdeclare#1\endcsname}%
+ \fi\fi\fi\fi \next
+}
+\def\scantabdataA#1{\addtabitem \expandafter\addtabdata\expandafter{#1\tabstrutA}\scantabdata}
+\def\scantabdataB#1#2{\addtabitem\expandafter\addtabdata\expandafter{#1{#2}\tabstrutA}\scantabdata}
+\def\scantabdataC {\def\tmpb{}\afterassignment\scantabdataD \tmpnum=}
+\def\scantabdataD#1{\loop \ifnum\tmpnum>0 \advance\tmpnum by-1 \addto\tmpb{#1}\repeat
+ \expandafter\scantabdata\tmpb
}
\def\tabdeclarec{\tabiteml\hfil##\unsskip\hfil\tabitemr}
\def\tabdeclarel{\tabiteml##\unsskip\hfil\tabitemr}
\def\tabdeclarer{\tabiteml\hfil##\unsskip\tabitemr}
+\def\paramtabdeclarep#1{\tabiteml\vtop{\hsize=#1\relax \baselineskip=\normalbaselineskip
+ \lineskiplimit=0pt \noindent##\unsskip \vbox to0pt{\vss\hbox{\tabstrutA}}}\tabitemr}
\def\unsskip{\ifdim\lastskip>0pt \unskip\fi}
-\def\addtabitem#1{\ifnum\colnum>0 \addtabdata{&}\addto\ddlinedata{&\dditem}\fi
- \advance\colnum by1 \let\tmpa=\relax \expandafter\addtabdata\expandafter{#1\tabstrutA}}
+\def\addtabitem{\ifnum\colnum>0 \addtabdata{&}\addto\ddlinedata{&\dditem}\fi
+ \advance\colnum by1 \let\tmpa=\relax}
\def\addtabdata#1{\tabdata\expandafter{\the\tabdata#1}}
-\def\addtabvrule{\ifx\tmpa\vrule \addtabdata{\kern\vvkern}%
- \ifnum\colnum=0\def\vvleft{\vvitem}\else\addto\ddlinedata{\vvitem}\fi\fi
+\def\addtabvrule{%
+ \ifx\tmpa\vrule \addtabdata{\kern\vvkern}%
+ \ifnum\colnum=0 \addto\vvleft{\vvitem}\else\addto\ddlinedata{\vvitem}\fi
+ \else \ifnum\colnum=0 \addto\vvleft{\vvitemA}\else\addto\ddlinedata{\vvitemA}\fi\fi
\let\tmpa=\vrule \addtabdata{\vrule}}
\def\crl{\crcr\noalign{\hrule}}
\def\crll{\crcr\noalign{\hrule\kern\hhkern\hrule}}
-\def\crli{\crcr \omit \gdef\dditem{\omit\tablinefil}\gdef\vvitem{\tabvvline}%
+\def\crli{\crcr \omit
+ \gdef\dditem{\omit\tablinefil}\gdef\vvitem{\kern\vvkern\vrule}\gdef\vvitemA{\vrule}%
\vvleft\tablinefil\ddlinedata\crcr}
\def\crlli{\crli\noalign{\kern\hhkern}\crli}
\def\tablinefil{\leaders\hrule\hfil}
-\def\tabvvline{\vrule\kern\vvkern\vrule}
+
+\def\crlp#1{\crcr \noalign{\kern-\drulewidth}%
+ \omit \xdef\crlplist{#1}\xdef\crlplist{,\expandafter}\expandafter\crlpA\crlplist,\end,%
+ \global\tmpnum=0 \gdef\dditem{\omit\crlpD}%
+ \gdef\vvitem{\kern\vvkern\kern\drulewidth}\gdef\vvitemA{\kern\drulewidth}%
+ \vvleft\crlpD\ddlinedata \global\tmpnum=0 \crcr}
+\def\crlpA#1,{\ifx\end#1\else \crlpB#1-\end,\expandafter\crlpA\fi}
+\def\crlpB#1#2-#3,{\ifx\end#3\xdef\crlplist{\crlplist#1#2,}\else\crlpC#1#2-#3,\fi}
+\def\crlpC#1-#2-#3,{\tmpnum=#1\relax
+ \loop \xdef\crlplist{\crlplist\the\tmpnum,}\ifnum\tmpnum<#2\advance\tmpnum by1 \repeat}
+\def\crlpD{\global\advance\tmpnum by1
+ \edef\tmpa{\noexpand\isinlist\noexpand\crlplist{,\the\tmpnum,}}%
+ \tmpa\iftrue \kern-\drulewidth \tablinefil \kern-\drulewidth\else\hfil \fi}
\def\tskip{\afterassignment\tskipA \tmpdim}
-\def\tskipA{\gdef\dditem{}\gdef\vvitem{}\gdef\tabstrutA{}%
+\def\tskipA{\gdef\dditem{}\gdef\vvitem{}\gdef\vvitemA{}\gdef\tabstrutA{}%
\vbox to\tmpdim{}\ddlinedata \crcr \noalign{\gdef\tabstrutA{\tabstrut}}}
+\def\mspan{\omit \tabdata={\tabstrut}\let\tmpa=\relax \afterassignment\mspanA \mscount=}
+\def\mspanA[#1]{\loop \ifnum\mscount>1 \csname span\endcsname \omit \advance\mscount by-1 \repeat
+ \mspanB#1\relax}
+\def\mspanB#1{\ifx\relax#1\def\tmpa{\def\tmpa####1}%
+ \expandafter\tmpa\expandafter{\the\tabdata\ignorespaces}\expandafter\tmpa\else
+ \ifx |#1\ifx\tmpa\vrule\addtabdata{\kern\vvkern}\fi \addtabdata{\vrule}\let\tmpa=\vrule
+ \else \let\tmpa=\relax
+ \ifx c#1\addtabdata{\tabiteml\hfil\ignorespaces##1\unsskip\hfil\tabitemr}\fi
+ \ifx l#1\addtabdata{\tabiteml\ignorespaces##1\unsskip\hfil\tabitemr}\fi
+ \ifx r#1\addtabdata{\tabiteml\hfil\ignorespaces##1\unsskip\tabitemr}\fi
+ \fi \expandafter\mspanB \fi}
+
+\newdimen\drulewidth \drulewidth=0.4pt
\let\orihrule=\hrule \let\orivrule=\vrule
-\def\rulewidth{\afterassignment\rulewidthA \tmpdim}
-\def\rulewidthA{\edef\hrule{\orihrule height\the\tmpdim}%
- \edef\vrule{\orivrule width\the\tmpdim}}
+\def\rulewidth{\afterassignment\rulewidthA \drulewidth}
+\def\rulewidthA{\edef\hrule{\orihrule height\the\drulewidth}%
+ \edef\vrule{\orivrule width\the\drulewidth}}
\long\def\frame#1{%
\hbox{\vrule\vtop{\vbox{\hrule\kern\vvkern
@@ -1280,7 +1319,7 @@
\else$^?$\opwarning{unknown \string\fnotemark. TeX me again}\fi}%
}
\long\def\fnotetext#1{\global\advance \fnotenum by1 \openref\wref\Xfnote{}%
- {\fnotehook\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}%
+ {\everypar={}\fnotehook\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}%
}
\def\fnmarkx{\isdefined{fn:\the\fnotenum}\iftrue\thefnote\else$^?$\fi}
\def\thefnote{$^{\locfnum}$}
@@ -1768,5 +1807,10 @@ May 2016 \replacestrings improved
\tskip corrected
Jun. 2016 \thefontsize: \fontdim=#1\ptunit added.
\pdfhvorigin unknown in XeTeX, bug fixed
+Jun. 2017 \begingroup...\endgroup trick introduced in \isinlist
+ \table: repeating and p declarator added,
+ \colnum=0 in table corrected (cor cases table in table)
+ \mspan added
+ \fnotetext: \everypar={} added (bug correction)
%%%%%%%%%%%%%% End of opmac.tex