summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/csplain/opmac
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-08-03 18:16:29 +0000
committerKarl Berry <karl@freefriends.org>2014-08-03 18:16:29 +0000
commitfa08289d204e8dde53c5b71063e2e2b610490aac (patch)
tree2992d2656991cc1ca0d975ed9fc6accd9532a847 /Master/texmf-dist/tex/csplain/opmac
parent2ad4fa86a0cbc3b72484cbb2db1e95859e77268b (diff)
csplain
git-svn-id: svn://tug.org/texlive/trunk@34820 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/csplain/opmac')
-rw-r--r--Master/texmf-dist/tex/csplain/opmac/opmac.tex110
1 files changed, 64 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex
index c40f07fcbb1..9fcab18f3e0 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 2014}
+\def\OPmacversion{Jul. 2014}
\immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>}
%%%%%%%%%%%%%% Basic macros, sec. 3.1 in opmac-d.pdf
@@ -28,7 +28,7 @@
\def\sdef#1{\expandafter\def\csname#1\endcsname}
\def\sxdef#1{\expandafter\xdef\csname#1\endcsname}
-\def\adef#1{\catcode`#1=13 \bgroup \lccode`\~=`#1\lowercase{\egroup\def~}}
+\def\adef#1{\catcode`#1=13 \begingroup \lccode`\~=`#1\lowercase{\endgroup\def~}}
\def\isdefined #1#2{\expandafter\ifx \csname#1\endcsname \relax
\csname iffalse\expandafter\endcsname
@@ -120,7 +120,7 @@
%%%%%%%%%%%%%% Sizes of fonts and \baselineskip, sec. 3.4 in opmac-d.pdf
\ifx\regfont\undefined
- \ifx\uselanguage\undefined % if this is eplain, the following warning is suppressed
+ \ifx\uselanguage\undefined % if this is etex.src, the following warning is suppressed
\opwarning{csplain version <Nov. 2012> or later is recommended}
\fi
% macros from csplain, file csfontsm.tex:
@@ -239,7 +239,7 @@
\sdef{lan:5}{cs} \sdef{lan:15}{cs} \sdef{lan:115}{cs}
\sdef{lan:6}{sk} \sdef{lan:16}{sk} \sdef{lan:116}{sk}
-\ifx\uselanguage\undefined \else \message{OPmac: eplain detected}
+\ifx\uselanguage\undefined \else \message{OPmac: etex.src macros detected}
\bgroup
\uselanguage{czech} \sxdef{lan:\the\language}{cs}
\uselanguage{slovak} \sxdef{lan:\the\language}{sk}
@@ -488,31 +488,39 @@
\def\iid #1 {\leavevmode\iindex{#1}#1\futurelet\tmp\iiD}
\def\iiD{\ifx\tmp,\else\ifx\tmp.\else\space\fi\fi}
-\def\Xindex#1#2{\bgroup \def~{ }%
- \isdefined{,#1}\iftrue
- \expandafter\firstdata \csname,#1\endcsname \XindexA
- \ifnum#2=\tmpa % \ii on the same page
- \else
- \tmpnum=#2 \advance\tmpnum by-1
- \expandafter\seconddata \csname,#1\endcsname \XindexB
- \if\tmpb+% state: the pagelist ends by a pagenumber
- \ifnum\tmpnum=\tmpa % the consecutive page
- \sxdef{,#1}{{#2/-}{\tmp\iiendash}}
- \else % the pages drop
- \sxdef{,#1}{{#2/+}{\tmp, #2}}
- \fi
- \else % state: the pagelist ends by --
- \ifnum\tmpnum=\tmpa % the consecutive page
- \sxdef{,#1}{{#2/-}{\tmp}}
- \else % the pages drop
- \sxdef{,#1}{{#2/+}{\tmp\tmpa, #2}}
- \fi
- \fi
- \fi
- \else % first occurrence of the index item #1
- \sxdef{,#1}{{#2/+}{#2}}
- \global \expandafter\addto \expandafter\iilist \csname,#1\endcsname
- \fi
+\def\Xindex{\Xindexg,}
+\def\Xindexg#1#2#3{\bgroup \def~{ }% #1=prefix, #2=index-item, #3=pageno
+ \isdefined{#1#2}\iftrue
+ \ifx^#3^\else
+ \expandafter\firstdata \csname#1#2\endcsname \XindexA
+ \ifnum#3=\tmpa % \ii on the same page
+ \else
+ \tmpnum=#3 \advance\tmpnum by\pgfolioB-1
+ \expandafter\seconddata \csname#1#2\endcsname \XindexB
+ \ifx\tmp\empty
+ \sxdef{#1#2}{{#3/+}{\pgfolioA{#3}}} % previous item: empty page
+ \else
+ \if\tmpb+% state: the pagelist ends by a pagenumber
+ \ifnum\tmpnum=\tmpa % the consecutive page
+ \sxdef{#1#2}{{#3/-}{\tmp\iiendash}}
+ \else % the pages drop
+ \sxdef{#1#2}{{#3/+}{\tmp, \pgfolioA{#3}}}
+ \fi
+ \else % state: the pagelist ends by --
+ \ifnum\tmpnum=\tmpa % the consecutive page
+ \sxdef{#1#2}{{#3/-}{\tmp}}
+ \else % the pages drop
+ \sxdef{#1#2}{{#3/+}{\tmp\pgfolioA{\tmpa}, \pgfolioA{#3}}}
+ \fi\fi\fi\fi\fi
+ \else % first occurrence of the index item #2
+ \ifx^#3^\sxdef{#1#2}{{0/+}{}}\else \sxdef{#1#2}{{#3/+}{\pgfolioA{#3}}}\fi
+ \ifx,#1
+ \global \expandafter\addto \expandafter\iilist \csname#1#2\endcsname
+ \else
+ \isdefined{iilist:#1}\iftrue
+ \global\expandafter\addto \csname iilist:#1\expandafter\endcsname \csname#1#2\endcsname
+ \else \sxdef{iilist:#1}{\expandafter\noexpand \csname#1#2\endcsname}
+ \fi\fi\fi
\egroup
}
\def\iilist{} \def\iiendash{--}
@@ -525,6 +533,9 @@
\def\XindexA#1/#2&{\def\tmpa{#1}\let\tmpb=#2}
\def\XindexB#1&{\def\tmp{#1}}
+\def\pgfolioA#1{\ifnum#1<0 \romannumeral-\fi#1}
+\def\pgfolioB{\ifnum\tmpnum<0-\fi}
+
\def\makeindex{\par
\ifx\iilist\empty \opwarning{index data-buffer is empty. TeX me again}
\else
@@ -537,7 +548,7 @@
\xdef##1{{\tmpb}{\tmp}}
\else
\preparesorting##1% converted item by sorting data in \tmpb
- \xdef##1{{\tmpb}{\tmp\tmpa}}
+ \xdef##1{{\tmpb}{\tmp\pgfolioA{\tmpa}}}
\fi
\expandafter\act\fi}
\expandafter \act \iilist \relax
@@ -546,7 +557,7 @@
\iiparparams
\gdef\act##1{\ifx##1\relax \else \prepii##1%
\seconddata##1\printiipages \expandafter\act \fi}
- \expandafter \act \iilist \relax
+ \expandafter \act \iilist \relax
\orippx \global\let\act=\undefined \global\let\orippx=\undefined
\fi
}
@@ -860,10 +871,10 @@
\def\restorecolor{{\def\tmp##1##2##3##4\end{\xdef\savedcolors{##4}%
\def\tmpa{##2}\def\tmpb{##3}\writecolortrue
- \ifx\tmpa\empty\else \ifx\tmpa\currcolork\else \pdfliteral{##2 k}\xdef\currcolork{##2}%
- \ifnum##1=1 \writecolor k\fi\fi\fi
- \ifx\tmpb\empty\else \ifx\tmpb\currcolorK\else \pdfliteral{##3 K}\xdef\currcolorK{##3}%
- \ifnum##1=1 \writecolor K\fi\fi\fi}%
+ \ifx\tmpa\currcolork\else \pdfliteral{##2 k}\xdef\currcolork{##2}%
+ \ifnum##1=1 \writecolor k\fi\fi
+ \ifx\tmpb\currcolorK\else \pdfliteral{##3 K}\xdef\currcolorK{##3}%
+ \ifnum##1=1 \writecolor K\fi\fi}%
\expandafter\tmp\savedcolors\end}}
\addprotect\setcmykcolor \addprotect\localcolor \addprotect\longlocalcolor
@@ -895,7 +906,7 @@
\def\preboxcclv{\csname pgc:\the\pageno\endcsname}
\def\postboxcclv{{%
\def\setpgcolor##1##2{\expandafter\xdef\csname currcolor##1\endcsname{##2}}%
- \ifnum\pageno<\lastpage
+ \ifnum\pageno \ifnum\lastpage<0 >\else<\fi \lastpage % simply: \ifnum\pageno < \lastpage
\globaldefs=-1 \advancepageno \globaldefs=0 \csname pgc:\the\pageno\endcsname
\else \xdef\currcolork{\pdflastcolork}\xdef\currcolorK{\pdflastcolorK}\fi
\let\longlocalcolor=\relax \let\localcolor=\relax \Black \linecolor\Black
@@ -943,7 +954,7 @@
{\def~{\nobreak\space}\urlcolor#3}\pdfendlink}%
}
\def\toclink#1{\toclinkA{#1}}
-\def\pglink#1{#1}
+\def\pglink#1{\pgfolioA{#1}\relax}
\def\citelink#1#2{#2}
\def\reflink[#1]#2{#2}
\def\ulink[#1]#2{{#2}}
@@ -952,7 +963,7 @@
\def\hyperlinks#1#2{%
\let\dest=\destactive \let\link=\linkactive
\def\toclink##1{\link[toc:##1]{\localcolor#1}{\toclinkA{##1}}}%
- \def\pglink##1{\link[pg:##1]{\localcolor#1}{##1}}%
+ \def\pglink##1{\link[pg:##1]{\localcolor#1}{\pgfolioA{##1}}}%
\def\citelink##1##2{\link[cite:##1]{\localcolor#1}{##2}}%
\def\reflink[##1]##2{\link[ref:##1]{\localcolor#1}{##2}}%
\def\ulink[##1]##2{\urllink[url:##1]{##2}}%
@@ -992,12 +1003,13 @@
\def\urlslashslash{/\urlskip/}
\addprotect\url
-\def\replacestrings#1#2{%
- \def\tmp##1#1##2\relax{\if$##2$\addto\tmpb{##1}\else\addto\tmpb{##1#2}\tmp##2\relax\fi}%
- \expandafter\def\expandafter\tmpb\expandafter{\expandafter}%
- \expandafter\tmp\tmpb\/#1\relax
- \def\tmp##1\/{\def\tmpb{##1}}\expandafter\tmp\tmpb
+\bgroup \catcode`!=3 \catcode`?=3
+\gdef\replacestrings#1#2{%
+ \long\def\tmp##1#1##2!{\ifx!##2!\addto\tmpb{##1}\else\addto\tmpb{##1#2}\tmp##2!\fi}%
+ \expandafter\def\expandafter\tmpb\expandafter{\expandafter}\expandafter\tmp\tmpb?#1!%
+ \def\tmp##1?{\def\tmpb{##1}}\expandafter\tmp\tmpb
}
+\egroup
%%%%%%%%%%%%%% Outlines -- sec. 3.17 in opmac-d.pdf
@@ -1350,7 +1362,7 @@
}
\def\mnoteC{\writecolorfalse \let\longlocalcolor=\localcolor
\edef\mnoteD{\xdef\noexpand\currcolork{\currcolork}\xdef\noexpand\currcolorK{\currcolorK}}%
- \def\currcolork{}\def\currcolorK{}%
+ \long\edef\currcolork{\currcolork}\long\edef\currcolorK{\currcolorK}%
}
\def\Xmnote{\advance\mnotenum by1
\sxdef{mn:\the\mnotenum}{\ifodd\lastpage \right \else \left \fi}}
@@ -1581,7 +1593,7 @@
\ifr@ggedbottom \kern-\dimen@ \vfil \fi
}}
-\footline={\hss\tenrm\thefontsize[10]\the\pageno\hss}
+\footline={\hss\tenrm\thefontsize[10]\folio\hss}
%%%%%%%%%%%%%% margins -- sec. 3.25 in opmac-d.pdf
@@ -1730,6 +1742,12 @@ May 2014c \maybebreak introduced
May 2014d \seccfont bug fixed
\tabstrut inserted to each column in the \table
Jun 2014 \opwarning about missing .bbl file rewritten.
-
+ more robust \replacestrings
+Jun. 2014a \mnoteC: default base mnote color set as current
+Jun. 2014b \footline: \the\pageno replaced by \folio
+ ? instead \/ in \replacestrings
+Jun. 2014c \pgfolioA, \pgfolioB introduced
+ \Xindexg introduced
+Jul. 2014 \bgroup -> \begingroup in \adef
%%%%%%%%%%%%%% End of opmac.tex