diff options
Diffstat (limited to 'Master/texmf-dist/tex/csplain/opmac/opmac.tex')
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac.tex | 108 |
1 files changed, 62 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex index a365fea689b..bea5cdb51e7 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{Aug. 2013} +\def\OPmacversion{Sep. 2013} \immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>} @@ -23,8 +23,8 @@ \addprotect~ \newif\ifpdftex \pdftextrue -\ifx\pdfoutput\undefined \pdftexfalse -\else \ifnum\pdfoutput=0 \pdftexfalse \fi \fi +\ifx\pdfoutput\undefined \pdftexfalse \else \ifnum\pdfoutput=0 \pdftexfalse \fi \fi +\ifx\XeTeXversion\undefined \else \pdftextrue \fi \def\sdef#1{\expandafter\def\csname#1\endcsname} \def\sxdef#1{\expandafter\xdef\csname#1\endcsname} @@ -55,9 +55,8 @@ \let\\=\undefined {\lccode`\?=`\% \lowercase{\gdef\percent{?}}} {\lccode`\?=`\\ \lowercase{\gdef\bslash{?}}} -\addprotect\percent \addprotect\bslash -\def\,{\ifmmode \mskip\thinmuskip \else \kern.166em \fi} - +\def\,{\ifmmode \mskip\thinmuskip \else \thinspace \fi} +\addprotect\percent \addprotect\bslash \addprotect\, \addprotect\exfont %%%%%%%%%%%%%% Global parameters, sec. 3.2 in opmac-d.pdf @@ -246,7 +245,7 @@ \ifeof\testin \else \closein\testin \input \jobname.ref - \fnotenum=0 \mnotenum=0 + \fnotenum=0 \mnotenum=0 \immediate\openout\reffile=\jobname.ref \def\wref##1##2{\write\reffile{\string##1##2}} \immediate\write\reffile {\percent\percent\space OPmac - REF file} @@ -264,15 +263,15 @@ %%%%%%%%%%%%%% \label, \ref, \pgref, sec. 3.7 in opmac-d.pdf -\def\label[#1]{\xdef\lastlabel{#1}\ignorespaces} +\def\label[#1]{\isdefined{l0:#1}% + \iftrue \opwarning{duplicated label [#1], ignored}\else \xdef\lastlabel{#1}\fi + \ignorespaces} \def\wlabel#1{% \ifx\lastlabel\undefined \else \dest[ref:\lastlabel]% \edef\tmp{\wref\Xlabel{{\lastlabel}{#1}}}\tmp - \isdefined{lab:\lastlabel}\iftrue \else - \sxdef{lab:\lastlabel}{#1}% - \fi + \sxdef{lab:\lastlabel}{#1}\sxdef{l0:\lastlabel}{}% \global\let\lastlabel=\undefined \fi } @@ -365,7 +364,7 @@ \def\othe#1.{\ifnum#1>0 \the#1.\fi} \def\thechapnum{} \def\thesecnum{} \def\theseccnum{} -\def\afternoindent{\global\everypar={\wipeepar\setbox0=\lastbox}} +\def\afternoindent{\global\everypar={\wipeepar\setbox7=\lastbox}} \def\wipeepar{\global\everypar={}} \let\firstnoindent=\afternoindent \def\nbpar{{\interlinepenalty=10000\par}} @@ -395,6 +394,8 @@ } \def\printcaption#1#2{{\bf#1 #2}\enspace} +\expandafter\def\expandafter\endinsert\expandafter{\expandafter\par\endinsert} + \def\eqmark{\global\advance\dnum by1 \ifinner\else\eqno \fi {\destheight=2.1em \wlabel\thednum}\thednum @@ -821,7 +822,7 @@ \def\setcmykcolor#1{{% \def\tmp{#1}\expandafter \ifx\csname currcolor\pdfK\endcsname \tmp \else - \special{PDF:#1 \pdfK}% + \pdfliteral{#1 \pdfK}% \expandafter\xdef\csname currcolor\pdfK\endcsname{#1}% \writecolor\pdfK \fi}% @@ -850,9 +851,9 @@ \def\restorecolor{{\def\tmp##1##2##3##4\end{\xdef\savedcolors{##4}% \def\tmpa{##2}\def\tmpb{##3}\writecolortrue - \ifx\tmpa\currcolork \else \special{PDF:##2 k}\xdef\currcolork{##2}% + \ifx\tmpa\currcolork \else \pdfliteral{##2 k}\xdef\currcolork{##2}% \ifnum##1=1 \writecolor k\fi\fi - \ifx\tmpb\currcolorK \else \special{PDF:##3 K}\xdef\currcolorK{##3}% + \ifx\tmpb\currcolorK \else \pdfliteral{##3 K}\xdef\currcolorK{##3}% \ifnum##1=1 \writecolor K\fi\fi}% \expandafter\tmp\savedcolors\end}} @@ -880,25 +881,23 @@ {\let\setpgcolor=\relax \sxdef{pgc:#1}% {\csname pgc:#1\endcsname\setpgcolor K{\pdflastcolorK}}}\fi } -\def\setpgcolor#1#2{\special{PDF:#2 #1}} +\def\setpgcolor#1#2{\pdfliteral{#2 #1}} \def\preboxcclv{\csname pgc:\the\pageno\endcsname} -\def\postboxcclv{% +\def\postboxcclv{{% \def\setpgcolor##1##2{\expandafter\xdef\csname currcolor##1\endcsname{##2}}% - \ifnum\pageno<\lastpage {\advance\pageno by1 \csname pgc:\the\pageno\endcsname}% + \ifnum\pageno<\lastpage + \globaldefs=-1 \advancepageno \globaldefs=0 \csname pgc:\the\pageno\endcsname \else \xdef\currcolork{\pdflastcolork}\xdef\currcolorK{\pdflastcolorK}\fi - \Black \linecolor\Black -} + \let\longlocalcolor=\relax \let\localcolor=\relax \Black \linecolor\Black +}} \ifpdftex\else - \def\setcmykcolor#1{} - \let\localcolor=\relax + \def\setcmykcolor#1{} \def\pdfliteral#1{} + \let\localcolor=\relax \let\longlocalcolor=\relax \fi -\def\draft{\edef\tmp{\headline={\noexpand\draftbox{\tenbf DRAFT}\the\headline}} - \ifpdftex \tmp \else - \opwarning{\string\draft: Grey color is possible in pdfTeX only}% - \fi} +\def\draft{\edef\tmp{\headline={\noexpand\draftbox{\tenbf DRAFT}\the\headline}}\tmp} \def\draftbox#1{\vbox to0pt{\setbox0=\hbox{\typosize[10/]#1}% \kern.5\vsize \kern4\wd0 \hbox to0pt{\kern.5\hsize \kern-2.5\wd0 @@ -907,6 +906,10 @@ \pdfrestore \hss}\vss}\hss} +\ifpdftex\else + \def\draft{\opwarning{\string\draft: Grey color is possible in pdfTeX only}} +\fi + %%%%%%%%%%%%%% Hyperrefs -- sec. 3.16 in opmac-d.pdf @@ -941,13 +944,12 @@ \def\pglink##1{\link[pg:##1]{\localcolor#1}{##1}}% \def\citelink##1{\link[cite:##1]{\localcolor#1}{##1}}% \def\reflink[##1]##2{\link[ref:##1]{\localcolor#1}{##2}}% - \def\ulink[##1]##2{\urllink[##1]{##2}}% + \def\ulink[##1]##2{\urllink[url:##1]{##2}}% \def\urlcolor{\longlocalcolor#2}% } \def\pdfborder#1{\if^#1^\else \isdefined{#1border}\iftrue - \if^\csname#1border\endcsname^\else - attr{/C[\csname#1border\endcsname] /Border[0 0 1]}% + \if^\csname#1border\endcsname^\else attr{/C[\csname#1border\endcsname] /Border[0 0 1]}% \fi\fi\fi } @@ -970,7 +972,7 @@ \replacestrings{\{}{\char`\{ }% \replacestrings{\}}{\char`\} }% \replacestrings{&}{\urlbskip\char`\& \urlskip}% - \ulink[url:#1]{\urlfont\tmpb}% + \ulink[#1]{\urlfont\tmpb}% }} \def\urlfont{\tt} \def\urlskip{\null\nobreak\hskip0pt plus0.05em\relax} @@ -1038,8 +1040,10 @@ } \def\setlccodes#1#2{\if\relax#2\relax \else \lccode`#1=`#2 \expandafter \setlccodes \fi} -\def\insertoutline#1{\pdfdest name{oul:#1} xyz\relax - \pdfoutline goto name{oul:#1} count0 {#1}\relax +\newcount\oulnum +\def\insertoutline#1{\global\advance\oulnum by1 + \pdfdest name{oul:\the\oulnum} xyz\relax + \pdfoutline goto name{oul:\the\oulnum} count0 {#1}\relax } \ifpdftex \else @@ -1170,8 +1174,8 @@ \halign\expandafter{\the\tabdata\tabstrutA\cr#2\crcr}\egroup} \def\scantabdata#1{\let\next=\scantabdata - \ifx#1\relax\let\next=\relax - \else\if#1|\addtabvrule + \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}% @@ -1311,10 +1315,12 @@ \fi } \def\mnoteA#1{\global\advance \mnotenum by1 - \isdefined{mn:\the\mnotenum}\iftrue - \else\opwarning{unknown \noexpand\mnote side. TeX me again}\fi - \edef\tmp{\csname mn:\the\mnotenum\endcsname}% - \openref\wref\Xmnote{}% + \ifx\mnotesfixed\undefined + \isdefined{mn:\the\mnotenum}\iftrue + \else\opwarning{unknown \noexpand\mnote side. TeX me again}\fi + \edef\tmp{\csname mn:\the\mnotenum\endcsname}% + \openref\wref\Xmnote{}% + \else \let\tmp=\mnotesfixed \fi \expandafter\ifx\tmp \left \hbox to0pt{\kern-\mnotesize \kern-\mnoteindent \vbox to0pt{\vss \setbox0=\vtop{\hsize=\mnotesize @@ -1330,9 +1336,7 @@ \def\Xmnote{\advance\mnotenum by1 \sxdef{mn:\the\mnotenum}{\ifodd\lastpage \right \else \left \fi}} -\def\fixmnotes#1{\tmpnum=0 - \loop \advance\tmpnum by1 - \isdefined{mn:\the\tmpnum}\iftrue \sxdef{mn:\the\tmpnum}{#1}\repeat} +\def\fixmnotes#1{\def\mnotesfixed{#1}} %%%%%%%%%%%%%% \cite, \bib, \usebibtex, \usebbl -- sec. 3.23 in opmac-d.pdf @@ -1424,8 +1428,7 @@ \def\readbblfile #1{% \openin\testin=#1.bbl \ifeof\testin - \opwarning{.bbl file doesn't exist. - Use the ``bibtex #1'' command}% + \opwarning{.bbl file doesn't exist. Use the ``bibtex #1'' command}% \else \closein\testin \bibnum=0 @@ -1587,8 +1590,9 @@ \fi} \def\truedimen#1{#1=\expandafter\ignorept\the#1truept } -%%%%%%%%%%%%%% REF file is read now -- sec 3.26 in opmac-d.pdf +%%%%%%%%%%%%%% XeTeX specific + REF file is read now -- sec 3.26 in opmac-d.pdf +\ifx\XeTeXversion\undefined \else \pdftexfalse \input opmac-xetex \fi \inputref \endinput @@ -1617,7 +1621,7 @@ May 2013 \margins (2pages laylout) can be redefined by new \margins \outlines use \pdfcatalog{/PageMode/UseOutlines} Jul. 2013 \fnotetext unwanted space - corrected \picw=0pt prints picture in natural size, \picheight introduced - \isinlist corrected, + \isinlist corrected, \othe\secnum in \secc removed \dotocnum, \remskip, \reminsert introduced \nonum, \notoc implemented @@ -1632,7 +1636,19 @@ Aug. 2013 \dgsize corrected \destheight rewritten as a dimen register \rightskip, \leftskip corrected in \mnote space corrected in \prepii - \input ams-math only if \normalmath is \undefined + \input ams-math only if \normalmath is \undefined (released) +Sep. 2013 \label: the ``duplicated label'' test added + \afternoindent: \box0 -> \box7 + \scantabdata: \if#1| -> \ifx|#1 + \fixmnotes recoded + \, uses \thinspace and it is \addprotected + \pdfliteral instead \special{PDF:...} used + XeTeX specific added + \draft, \insertoulines recoded + \endinsert redefined (\par added) + \addprotect\exfont (for exchars.tex cooperating) + \ulink improved and added to opmac-u + \postboxcclv: {\advancepageno} corrected %%%%%%%%%%%%%% End of opmac.tex |