diff options
author | Karl Berry <karl@freefriends.org> | 2014-12-07 22:08:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-12-07 22:08:16 +0000 |
commit | ab3062b08a73205b7571ff70e0ba6ffae8bb69a5 (patch) | |
tree | e176d0b31c375fcbee1b486e7febb0cfa6d5f614 | |
parent | f43ed3f714713e40993b5acda3cab8b2ad3f4bb8 (diff) |
csplain (7dec14)
git-svn-id: svn://tug.org/texlive/trunk@35763 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/tex/csplain/base/csplain.ini | 3 | ||||
-rw-r--r-- | Master/texmf-dist/tex/csplain/base/hyphen.lan | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac-xetex.tex | 14 | ||||
-rw-r--r-- | Master/texmf-dist/tex/csplain/opmac/opmac.tex | 345 |
4 files changed, 166 insertions, 198 deletions
diff --git a/Master/texmf-dist/tex/csplain/base/csplain.ini b/Master/texmf-dist/tex/csplain/base/csplain.ini index 3e5e342bd05..271d5f070b2 100644 --- a/Master/texmf-dist/tex/csplain/base/csplain.ini +++ b/Master/texmf-dist/tex/csplain/base/csplain.ini @@ -210,6 +210,9 @@ file extcode.tex renamed to il2code.tex (suggested by Jan Kasprzak) * uni-lcuc.tex introduced; hyphen.lan reads it when \UnicodeLcUc=y. * ntx-math.tex (derived from tx-math.tex) added. + Dec. 2014: [format wasn't modified] +* opmac <Dec. 2014> added (new implementation of color stuff) + COPYRIGHT ========= diff --git a/Master/texmf-dist/tex/csplain/base/hyphen.lan b/Master/texmf-dist/tex/csplain/base/hyphen.lan index 6ceceb49598..f93eae9f0e5 100644 --- a/Master/texmf-dist/tex/csplain/base/hyphen.lan +++ b/Master/texmf-dist/tex/csplain/base/hyphen.lan @@ -469,7 +469,7 @@ \message{\the\numpatterns\space patterns preloaded: \pattlist} \message{Defaults: \string\language=\the\language, - \string\cmaccents, \string\nofrenchspacing,} + \string\cmaccents, \string\nonfrenchspacing,} % ========= for backward compatibility ======== diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac-xetex.tex b/Master/texmf-dist/tex/csplain/opmac/opmac-xetex.tex index 61c3dcf8d80..3760e34d647 100644 --- a/Master/texmf-dist/tex/csplain/opmac/opmac-xetex.tex +++ b/Master/texmf-dist/tex/csplain/opmac/opmac-xetex.tex @@ -1,6 +1,6 @@ % opmac-xetex.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Petr Olsak, 2013 +%% Petr Olsak, 2013, 2014 % OPmac features (such as hyperlinks, outlines, colors, transformations, % pictures) are based on pdfTeX primitives. Unfortunately, these pdfTeX @@ -23,8 +23,8 @@ {#3#4}\special{pdf:eann}% } \def\pdfborder#1{\if^#1^\else \isdefined{#1border}\iftrue - \if^\csname#1border\endcsname^\else /C[\csname#1border\endcsname]/Border[0 0 1]% - \fi\fi\fi + \if^\csname#1border\endcsname^\else /C[\csname#1border\endcsname]/Border[0 0 .6]\fi + \else /Border[0 0 0]\fi\fi } % Unfortunately, \pdflinkmargin is unsupported in XeTeX. We create @@ -52,6 +52,14 @@ \def\pdfliteral#1{\special{pdf:literal #1}} +% \pdfcolorstack is implemented by \special{color push <text>} and \special{color pop} + +\def\colorstackpush#1{\colorspecialinit \special{color push cmyk #1}} +\def\colorstackpop{\special{color pop}} +\def\colorstackset#1{\colorspecialinit \special{color pop}\special{color push cmyk #1}} +\def\colorspecialinit{\special{color push gray 0}\gdef\colorspecialinit{}} +%\def\special#1{\message{special:{#1}}} + % The \pdfsetmatrix, \pdfsave, \pdfrestore can be implemented by \pdfliteral: \def\pdfsetmatrix#1{\pdfliteral{#1 0 0 cm}} diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex index f4f7281372e..62769a82fc9 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. 2014} +\def\OPmacversion{Dec. 2014} \immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>} %%%%%%%%%%%%%% Basic macros, sec. 3.1 in opmac-d.pdf @@ -36,12 +36,12 @@ \csname iftrue\expandafter\endcsname \fi } -\def\isinlist#1#2#3{\def\tmp##1#2##2\end{\def\tmp{##2}% +\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 \expandafter\tmp#1\endlistsep#2\end } -\def\isnextchar#1#2#3{\def\tmpa{#2}\def\tmpb{#3}% +\long\def\isnextchar#1#2#3{\def\tmpa{#2}\def\tmpb{#3}% \let\tmp=#1\futurelet\next\isnextcharA } \def\isnextcharA{\ifx\tmp\next\expandafter\tmpa\else\expandafter\tmpb\fi} @@ -57,6 +57,14 @@ \def\,{\ifmmode \mskip\thinmuskip \else \thinspace \fi} \addprotect\percent \addprotect\bslash \addprotect\, \addprotect\exfont +\bgroup \catcode`!=3 \catcode`?=3 +\gdef\replacestrings#1#2{\long\def\replacestringsA##1#1##2!{% + \ifx!##2!\addto\tmpb{##1}\else\addto\tmpb{##1#2}\replacestringsA##2!\fi}% + \edef\tmpb{\expandafter}\expandafter\replacestringsA\tmpb?#1!% + \long\def\replacestringsA##1?{\def\tmpb{##1}}\expandafter\replacestringsA\tmpb +} +\egroup + %%%%%%%%%%%%%% Global parameters, sec. 3.2 in opmac-d.pdf @@ -322,7 +330,7 @@ \titfont \noindent #1\unskip\par}% \nobreak\bigskip } -\def\titfont{\typobase\typoscale[\magstep4/\magstep4]\bf} +\def\titfont{\typobase\typoscale[\magstep4/\magstep4]\bfshape} \def\chapfont{\typobase\typoscale[\magstep3/\magstep3]\bfshape} \def\secfont{\typobase\typoscale[\magstep2/\magstep2]\bfshape} \def\seccfont{\typobase\typoscale[\magstep1/\magstep1]\bfshape} @@ -381,7 +389,7 @@ \def\afternoindent{\global\everypar={\wipeepar\setbox7=\lastbox}} \def\wipeepar{\global\everypar={}} \let\firstnoindent=\afternoindent -\def\nbpar{{\interlinepenalty=10000\par}} +\def\nbpar{{\interlinepenalty=10000\endgraf}} \def\nl{\hfil\break} @@ -401,7 +409,7 @@ \leftskip=\iindent plus1fil \rightskip=\iindent plus-1fil \parfillskip=0pt plus2fil - \def\par{\endgraf\egroup}% + \def\par{\nbpar\egroup}% \captionhook{#1}\noindent \wlabel{\csname the#1num\endcsname}% \printcaption{\mtext{#1}}{\csname the#1num\endcsname}% @@ -454,7 +462,7 @@ \def\toclist{} \newif\ifischap \ischapfalse -\def\Xchap#1#2#3{\ischaptrue\addto\toclist{\tocline{0}{\bf}{#1}{#2}{#3}}} +\def\Xchap#1#2#3{\ischaptrue\addto\toclist{\tocline{0}{\bfshape}{#1}{#2}{#3}}} \def\Xsec#1#2#3{\addto\toclist{\tocline{1}{\rm}{#1}{#2}{#3}}} \def\Xsecc#1#2#3{\addto\toclist{\tocline{2}{\rm}{#1}{#2}{#3}}} @@ -540,25 +548,26 @@ \ifx\iilist\empty \opwarning{index data-buffer is empty. TeX me again} \else \bgroup - \setprimarysorting - \def\act##1{\ifx##1\relax \else - \firstdata##1\XindexA \seconddata##1\XindexB - \if\tmpb+% - \preparesorting##1% converted item by sorting data in \tmpb - \xdef##1{{\tmpb}{\tmp}} + \setprimarysorting + \def\act##1{\ifx##1\relax \else + \firstdata##1\XindexA \seconddata##1\XindexB + \if\tmpb+% + \preparesorting##1% converted item by sorting data in \tmpb + \xdef##1{{\tmpb}{\tmp}} \else - \preparesorting##1% converted item by sorting data in \tmpb - \xdef##1{{\tmpb}{\tmp\pgfolioA{\tmpa}}} + \preparesorting##1% converted item by sorting data in \tmpb + \xdef##1{{\tmpb}{\tmp\pgfolioA{\tmpa}}} \fi \expandafter\act\fi} - \expandafter \act \iilist \relax + \expandafter \act \iilist \relax \egroup \dosorting % sorting is in progress - \iiparparams - \gdef\act##1{\ifx##1\relax \else \prepii##1% - \seconddata##1\printiipages \expandafter\act \fi} - \expandafter \act \iilist \relax - \orippx \global\let\act=\undefined \global\let\orippx=\undefined + \bgroup + \rightskip=0pt plus1fil \exhyphenpenalty=10000 \leftskip=\iindent + \def\act##1{\ifx##1\relax \else \prepii##1% + \seconddata##1\printiipages \expandafter\act \fi} + \expandafter \act \iilist \relax + \egroup \fi } \def\printiipages#1&{ #1\par} @@ -587,15 +596,6 @@ \def\iiemdash{\kern.1em---\space} \def\everyii{} -\def\iiparparams{% - \xdef\orippx{\global\rightskip=\the\rightskip - \global\leftskip=\the\leftskip - \global\exhyphenpenalty=\the\exhyphenpenalty} - \global\rightskip=0pt plus1fil - \global\exhyphenpenalty=10000 - \global\leftskip=\iindent -} - \def\scanprevii#1/#2&{\def\previi{#2}\def\tmpa{#1}\edef\tmpa{\meaning\tmpa}} \def\previi{} % previous index item @@ -612,8 +612,8 @@ eE\'e\'E\v e\v E,% fF,% gG,% - h^^HH,% - ^^T^^U^^V,% + hH,% + ^^T^^U^^V,% ch Ch CH iI\'i\'I,% jJ,% kK,% @@ -632,50 +632,51 @@ vV,% wW,% xX,% - yY,\'y\'Y,% + yY\'y\'Y,% zZ,% \v z\v Z,% 0,1,2,3,4,5,6,7,8,9,'.% } -\def\setprimarysorting {\csname sort:\csname lan:\the\language\endcsname \endcsname +\def\setignoredchars{\setlccodes ,.;.?.!.:.'.".|.(.).[.].<.>.=.+.{}{}} +\def\specsortingdatacs {ch:^^T Ch:^^U CH:^^V} +\def\specsortingdatask {ch:^^T Ch:^^U CH:^^V} % DZ etc. are sorted normally + +\def\setprimarysorting {% + \ifx\r\undefined + \opwarning{\noexpand\csaccents is unused, falling back to ASCII sorting}% + \global\let\asciisorting=t% + \fi + \ifx\asciisorting\undefined + \xdef\sortingdata{\sortingdata}% expand sorting data now + \isdefined{specsortingdata\csname lan:\the\language\endcsname}\iftrue + \xdef\specsortingdata{\csname specsortingdata\csname lan:\the\language\endcsname + \endcsname\space}% + \expandafter\setprimarysortingA \meaning\specsortingdata\relax + \else \gdef\specsortingdata{}\fi + \else + \gdef\sortingdata{.}\gdef\specsortingdata{}% + \fi \def\act##1{\ifx##1.\else \ifx##1,\advance\tmpnum by1 \else \lccode`##1=\tmpnum \fi \expandafter \act \fi}% - \ifx\r\undefined - \opwarning{\noexpand\csaccents is unused, falling back to ASCII sorting}% - \gdef\sortingdata{.}\global\let\chsorting=n% - \else - \xdef\sortingdata{\sortingdata}% expand sorting data now - \fi - \tmpnum=133 \expandafter \act\sortingdata \setignoredchars + \tmpnum=60 \expandafter \act\sortingdata \setignoredchars } -\sdef{sort:en}{\global\let\chsorting=n} % skipping ch processing in English language +\def\setprimarysortingA#1->#2\relax{\gdef\specsortingdata{#2}} \def\setsecondarysorting {\def\act##1{\ifx##1.\else \ifx##1,\else \advance\tmpnum by1 \lccode`##1=\tmpnum \fi \expandafter \act \fi}% - \tmpnum=133 \expandafter \act\sortingdata \setignoredchars -} -\bgroup -\lccode`4=`c \lccode`5=`h \lccode`6=`C \lccode`7=`H -\lowercase{ -\gdef\iiscanch #145#2\relax{#1\if$#2$\else^^T\iiscanch #2\relax\fi} -\gdef\iiscanCh #165#2\relax{#1\if$#2$\else^^U\iiscanCh #2\relax\fi} -\gdef\iiscanCH #167#2\relax{#1\if$#2$\else^^V\iiscanCH #2\relax\fi} -\gdef\preparesorting#1{\expandafter\preparesortingA\string#1&} -\gdef\preparesortingA#1#2#3&{\xdef\tmpb{#3}% - \ifx\chsorting\undefined - \xdef\tmpb{\expandafter\iiscanch\tmpb 45\relax}% - \xdef\tmpb{\expandafter\iiscanCh\tmpb 65\relax}% - \xdef\tmpb{\expandafter\iiscanCH\tmpb 67\relax}\fi - \lowercase\expandafter{\expandafter\gdef\expandafter\tmpb\expandafter{\tmpb}}% - \xdef\tmpb{\expandafter\removedot\tmpb.\relax}% -}} -\egroup + \tmpnum=60 \expandafter \act\sortingdata \setignoredchars +} -\def\removedot #1.#2\relax{#1\if$#2$\else\removedot #2\relax\fi} -\def\setignoredchars{\setlccodes ,.;.?.!.:.'.".|.(.).[.].<.>.=.+.{}{}} +\def\preparesorting#1{\expandafter\preparesortingA\string#1&} +\gdef\preparesortingA#1#2#3&{\xdef\tmpb{#3}% + \expandafter\preparesortingB\specsortingdata.:{} + \lowercase\expandafter{\expandafter\gdef\expandafter\tmpb\expandafter{\tmpb}}% + \replacestrings{.}{}% +} +\def\preparesortingB#1#2:#3 {\ifx.#1\else \replacestrings{#1#2}{#3}\expandafter\preparesortingB\fi} \newif \ifAleB @@ -744,32 +745,35 @@ %%%%%%%%%%%%%% \begmulti ... \endmulti TBN p. 244, 245 -- sec. 3.14 in opmac-d.pdf +\newcount\mullines \def\corrsize #1{%% #1 := #1 + \splittopskip - \topskip - \advance #1 by \splittopskip \advance #1 by-\topskip} - -\def\begmulti #1 {\par\wipeepar\multiskip\penalty0 \def\Ncols{#1} - \splittopskip=\baselineskip + \advance #1 by \splittopskip \advance #1 by-\topskip +} +\def\begmulti #1 {\par\bgroup\wipeepar\multiskip\penalty0 \def\Ncols{#1} \setbox6=\vbox\bgroup\penalty0 %% \hsize := Sirka sloupce = (\hsize+\colsep) / n - \colsep \advance\hsize by\colsep \divide\hsize by\Ncols \advance\hsize by-\colsep - \dimen0=0pt - \def\par{\endgraf\advance\dimen0 by\the\prevgraf\baselineskip - \ifdim\dimen0>.9\maxdimen \message{flushcolumns:}% - \global\let\balancecolumns=\flushcolumns \expandafter \endmulti - \fi}% + \mullines=0 + \def\par{\ifhmode\endgraf\global\advance\mullines by\prevgraf\fi}% } -\def\endmulti{\vskip-\prevdepth\vfil\egroup \setbox1=\vsplit6 to0pt +\def\endmulti{\vskip-\prevdepth\vfil + \expandafter\egroup\expandafter\baselineskip\the\baselineskip\relax + \dimen0=.8\maxdimen \tmpnum=\dimen0 \divide\tmpnum by\baselineskip + \splittopskip=\baselineskip + \setbox1=\vsplit6 to0pt %% \dimen1 := the free space on the page \ifdim\pagegoal=\maxdimen \dimen1=\vsize \corrsize{\dimen1} \else \dimen1=\pagegoal \advance\dimen1 by-\pagetotal \fi \ifdim \dimen1<2\baselineskip \vfil\break \dimen1=\vsize \corrsize{\dimen1} \fi - \dimen0=\ht6 \divide\dimen0 by\Ncols \relax + \ifnum\mullines<\tmpnum \dimen0=\ht6 \else \dimen0=.8\maxdimen \fi + \divide\dimen0 by\Ncols \relax %% split the material to more pages? \ifdim \dimen0>\dimen1 \splitpart \else \balancecolumns \fi % only balancing - \multiskip\relax} + \multiskip\egroup +} \def\makecolumns{\bgroup % full page, destination height: \dimen1 \vbadness=20000 \setbox1=\hbox{}\tmpnum=0 \loop \ifnum\Ncols>\tmpnum @@ -778,11 +782,16 @@ \repeat \hbox{}\nobreak\vskip-\splittopskip \nointerlineskip \line{\unhbox1\unskip} - \egroup} + \dimen0=\dimen1 \divide\dimen0 by\baselineskip \multiply\dimen0 by\Ncols + \global\advance\mullines by-\dimen0 + \egroup +} \def\splitpart{% \makecolumns % full page \vskip 0pt plus 1fil minus\baselineskip \break - \dimen0=\ht6 \divide\dimen0 by\Ncols \relax + \ifnum\mullines<\tmpnum \dimen0=\ht6 \else \dimen0=.8\maxdimen \fi + \divide\dimen0 by\Ncols \relax + \ifx\balancecolumns\flushcolumns \advance\dimen0 by-.5\vsize \fi \dimen1=\vsize \corrsize{\dimen1}\dimen2=\dimen1 \advance\dimen2 by-\Ncols\baselineskip %% split the material to more pages? @@ -791,7 +800,6 @@ \else \balancecolumns % last balancing \fi \fi } - \def\balancecolumns{\bgroup \setbox7=\copy6 % destination height: \dimen0 \ifdim\dimen0>\baselineskip \else \dimen0=\baselineskip \fi \vbadness=20000 @@ -810,23 +818,15 @@ \hbox to\hsize{\unhbox1\unskip}% \egroup } -\def\flushcolumns#1\relax{\fi\fi\fi - \setbox6=\vbox\bgroup\penalty0 - \global\let\balancecolumns=\ibalancecolumns - \dimen0=\ht6 \unvbox6 \unskip\unskip - \advance\hsize by\colsep - \divide\hsize by\Ncols \advance\hsize by-\colsep - \def\par{\endgraf\advance\dimen0 by\the\prevgraf\baselineskip - \ifdim\dimen0>.9\maxdimen \message{flush-columns:}% - \global\let\balancecolumns=\flushcolumns \expandafter \endmulti - \fi}% -} -\let\ibalancecolumns=\balancecolumns %%%%%%%%%%%%%% Colors -- sec. 3.15 in opmac-d.pdf -\newif\ifwritecolor \writecolortrue -\newcount\lastpage \lastpage=0 % the last page of the document +\newif\iflocalcolor \localcolorfalse +\let\localcolor=\localcolortrue + +% for backward compatibility: +\let\longlocalcolor=\localcolor \let\locpgcolor=\relax +\def\linecolor#1{} \def\Blue{\setcmykcolor{1 1 0 0}} \def\Red{\setcmykcolor{0 1 1 0}} @@ -840,85 +840,33 @@ \def\LightGrey{\setcmykcolor{0 0 0 0.2}} \def\Black{\setcmykcolor{0 0 0 1}} -\def\setcmykcolor#1{{% - \def\tmp{#1}\expandafter \ifx\csname currcolor\pdfK\endcsname \tmp \else - \pdfliteral{#1 \pdfK}% - \expandafter\xdef\csname currcolor\pdfK\endcsname{#1}% - \writecolor\pdfK - \fi}% -} -\def\writecolor#1{\ifwritecolor - \openref - \edef\act{\noexpand\wref\noexpand\Xpdfcolor{#1{\csname currcolor#1\endcsname}}}\act - \fi +\def\setcmykcolor#1{\global\let\ensureblacko=\ensureblackoA + \iflocalcolor \edef\currentcolor{#1}\colorstackpush\currentcolor \aftergroup\colorstackpop + \else \xdef\currentcolor{#1}\colorstackset\currentcolor \fi } -\def\pdfK{k} -\def\linecolor#1{{\def\pdfK{K}#1}} - \def\pdfblackcolor{0 0 0 1} -\xdef\currcolork{\pdfblackcolor} \xdef\currcolorK{\pdfblackcolor} - -\xdef\savedcolors{} - -\def\localcolor{\aftergroup\restorecolor \writecolorfalse - \xdef\savedcolors{0{\currcolork}{\currcolorK}\savedcolors}} -\def\longlocalcolor{\aftergroup\restorecolor - \ifwritecolor\else \opwarning{\noexpand\longlocalcolor inside - \string\localcolor. Something wrong}\fi - \writecolortrue - \xdef\savedcolors{1{\currcolork}{\currcolorK}\savedcolors}} -\let\locpgcolor=\relax % for backward compatibility - -\def\restorecolor{{\def\tmp##1##2##3##4\end{\xdef\savedcolors{##4}% - \def\tmpa{##2}\def\tmpb{##3}\writecolortrue - \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}} +\xdef\currentcolor{\pdfblackcolor} +\def\ensureblacko#1{#1} +\def\ensureblackoA#1{\colorstackpush\pdfblackcolor #1\colorstackpop} + +\ifx\pdfcolorstack\undefined + \def\colorstackpush#1{\pdfliteral{#1 k #1 K}} + \def\colorstackpop{\colorstackpush\currentcolor} + \let\colorstackset=\colorstackpush +\else + \mathchardef\colorstackcnt=\pdfcolorstackinit page {0 g 0 G} + \def\colorstackpush#1{\pdfcolorstack\colorstackcnt push{#1 k #1 K}} + \def\colorstackpop{\pdfcolorstack\colorstackcnt pop} + \def\colorstackset#1{\pdfcolorstack\colorstackcnt set{#1 k #1 K}} +\fi \addprotect\setcmykcolor \addprotect\localcolor \addprotect\longlocalcolor -\def\begoutput{\writecolorfalse \let\longlocalcolor=\localcolor - \edef\restoreoutputcolor{% - \xdef\noexpand\currcolork{\currcolork}\xdef\noexpand\currcolorK{\currcolorK}}% - \xdef\currcolork{\pdfblackcolor}\xdef\currcolorK{\pdfblackcolor}% - \immediate\wref\Xpage{{\the\pageno}}% -} -\def\endoutput{\restoreoutputcolor} - -\def\Xpdfcolork#1{\def\pdflastcolork{#1}} -\def\XpdfcolorK#1{\def\pdflastcolorK{#1}} -\let\pdflastcolork=\pdfblackcolor \let\pdflastcolorK=\pdfblackcolor - -\def\Xpage#1{\ifnum\lastpage=#1 \else \lastpage=#1 \fnotenumlocal=0 - \ifx\pdflastcolork\pdfblackcolor\else - \isdefined{pgc:#1}\iftrue \else \sxdef{pgc:#1}{}\fi - {\let\setpgcolor=\relax \sxdef{pgc:#1}% - {\csname pgc:#1\endcsname\setpgcolor k{\pdflastcolork}}}\fi - \ifx\pdflastcolorK\pdfblackcolor\else - \isdefined{pgc:#1}\iftrue \else \sxdef{pgc:#1}{}\fi - {\let\setpgcolor=\relax \sxdef{pgc:#1}% - {\csname pgc:#1\endcsname\setpgcolor K{\pdflastcolorK}}}\fi\fi -} -\def\setpgcolor#1#2{\pdfliteral{#2 #1}} - -\def\preboxcclv{\csname pgc:\the\pageno\endcsname} -\def\postboxcclv{{% - \def\setpgcolor##1##2{\expandafter\xdef\csname currcolor##1\endcsname{##2}}% - \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 -}} - \ifpdftex\else - \def\setcmykcolor#1{} \def\pdfliteral#1{} - \let\localcolor=\relax \let\longlocalcolor=\relax + \def\setcmykcolor#1{} \def\pdfliteral#1{} \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 \pdfsave \pdfrotate{55}\pdfscale{10}{10}% @@ -967,12 +915,12 @@ \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}}% - \def\urlcolor{\longlocalcolor#2}% + \def\urlcolor{\localcolor#2}% } \def\pdfborder#1{\if^#1^\else \isdefined{#1border}\iftrue - \if^\csname#1border\endcsname^\else attr{/C[\csname#1border\endcsname] /Border[0 0 .6]}% - \fi\fi\fi + \if^\csname#1border\endcsname^\else attr{/C[\csname#1border\endcsname] /Border[0 0 .6]}\fi + \else attr{/Border[0 0 0]}\fi\fi } \ifpdftex \else @@ -1003,14 +951,6 @@ \def\urlslashslash{/\urlskip/} \addprotect\url -\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 @@ -1084,7 +1024,7 @@ \def\setverb{\frenchspacing\def\do##1{\catcode`##1=12}\dospecials \catcode`\*=12 } \def\begtt{\par\ttskip\bgroup \wipeepar - \setverb \adef{ }{ }% + \setverb \adef{ }{\ }% \ifx\savedttchar\undefined \else \catcode\savedttchar=12 \fi \parindent=\ttindent \vskip\parskip \parskip=0pt \tthook\relax @@ -1096,7 +1036,7 @@ \obeylines \startverb} {\catcode`\|=0 \catcode`\\=12 |gdef|startverb#1\endtt{|tt#1|egroup|par|ttskip|testparA}} -\def\testparA{\afterassignment\testparB\let\tmpa= } +\def\testparA{\expandafter\testparB\romannumeral-`\.} \def\testparB{\futurelet\tmpa\testparC} \def\testparC{\ifx\tmpa\par\else\afternoindent\fi} @@ -1105,7 +1045,7 @@ \chardef\savedttchar=`#1% \chardef\savedttcharc=\catcode`#1% \bgroup\lccode`\~=`#1% - \lowercase {\egroup\def~}{\leavevmode\hbox\bgroup\setverb\adef{ }{ }% + \lowercase {\egroup\def~}{\leavevmode\hbox\bgroup\setverb\adef{ }{\ }% \intthook\tt\readverb}% \bgroup\lccode`\~=`#1\lowercase{\egroup\def\readverb ##1~}{##1\egroup}% \catcode`#1=13 @@ -1158,7 +1098,7 @@ \edef\vinolines{\the\tmpnum}% \fi \par\ttskip\bgroup \wipeepar - \setverb \adef{ }{ }% + \setverb \adef{ }{\ }% \ifx\savedttchar\undefined \else \catcode\savedttchar=12 \fi \parindent=\ttindent \tthook\relax @@ -1313,8 +1253,8 @@ \newif\iflocfnum \locfnumtrue \def\fnote#1{\global\advance \fnotenum by1 - \iflocfnum \leavevmode\openref\wref\Xfnote{}% - \isdefined{fn:\the\fnotenum}\iftrue + \leavevmode\openref\wref\Xfnote{}% + \iflocfnum \isdefined{fn:\the\fnotenum}\iftrue \else\opwarning{unknown \noexpand\fnote mark. TeX me again}\fi\fi \fnmarkx{\fnotehook\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}% } @@ -1349,21 +1289,17 @@ \openref\wref\Xmnote{}% \else \let\tmp=\mnotesfixed \fi \expandafter\ifx\tmp \left - \hbox to0pt{\pdfsave\mnoteC\kern-\mnotesize \kern-\mnoteindent + \hbox to0pt{\kern-\mnotesize \kern-\mnoteindent \vbox to0pt{\vss \setbox0=\vtop{\hsize=\mnotesize \leftskip=0pt plus 1fill \rightskip=0pt {\mnotehook\noindent#1\endgraf}}% - \dp0=0pt \box0 \kern\mnoteskip \global\mnoteskip=0pt}\hss\mnoteD\pdfrestore}% + \dp0=0pt \box0 \kern\mnoteskip \global\mnoteskip=0pt}\hss}% \else - \hbox to0pt{\pdfsave\mnoteC\kern\hsize \kern\mnoteindent + \hbox to0pt{\kern\hsize \kern\mnoteindent \vbox to0pt{\vss \setbox0=\vtop{\hsize=\mnotesize \rightskip=0pt plus 1fil \leftskip=0pt {\mnotehook\noindent#1\endgraf}}% - \dp0=0pt \box0 \kern\mnoteskip \global\mnoteskip=0pt}\hss\mnoteD\pdfrestore}% + \dp0=0pt \box0 \kern\mnoteskip \global\mnoteskip=0pt}\hss}% \fi } -\def\mnoteC{\writecolorfalse \let\longlocalcolor=\localcolor - \edef\mnoteD{\xdef\noexpand\currcolork{\currcolork}\xdef\noexpand\currcolorK{\currcolorK}}% - \long\edef\currcolork{\currcolork}\long\edef\currcolorK{\currcolorK}% -} \def\Xmnote{\advance\mnotenum by1 \sxdef{mn:\the\mnotenum}{\ifodd\lastpage \right \else \left \fi}} @@ -1460,7 +1396,8 @@ \def\ecite[#1]{\bgroup\citeA#1,,,\expandafter\eciteB\savedcites;} \def\eciteB#1,#2;#3{\if?#1\relax #3\else \citelink{#1}{#3}\fi\egroup} -\def\bib[#1] {\isnextchar={\bibA[#1]}{\bibmark={}\bibB[#1]}} +\def\bib[#1]{\def\tmp{\isnextchar={\bibA[#1]}{\bibmark={}\bibB[#1]}}% + \expandafter\tmp\romannumeral-`\.} % ignore optional space \def\bibA[#1]=#2{\bibmark={#2}\bibB[#1]} \def\bibB[#1]{\par \ifnum\bibnum>0 \bibskip \fi \advance\bibnum by1 @@ -1569,32 +1506,39 @@ %%%%%%%%%%%%%% output -- sec. 3.24 in opmac-d.pdf \output={\begoutput \opmacoutput \endoutput} +\def\begoutput{% + \immediate\wref\Xpage{{\the\pageno}}% + \def\nl{ }\def\fnote##1{}\def\fnotemark##1{}% +} +\def\endoutput{} \def\opmacoutput{% - \setbox0=\vbox{\makeheadline\pagebody\makefootline}% + \setbox0=\vbox{\ensureblacko{\makeheadline}\pagebody\ensureblacko{\makefootline}}% \pghook \protectlist \shipout\box0 \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \def\doprotect#1{\let#1=\relax} -\addto\begoutput{\def\nl{ }\def\fnote##1{}\def\fnotemark##1{}} \def\prepage{\def\destheight{25pt}\dest[pg:\the\pageno]} +\def\preboxcclv{} \def\postboxcclv{} {\catcode`\@=11 \gdef\pagecontents{\prepage % dest of pageno - \ifvoid\topins\else\unvbox\topins\fi - \preboxcclv % colors setting + \ifvoid\topins\else\ensureblacko{\unvbox\topins}\fi + \preboxcclv \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255 - \postboxcclv % colors restoring + \postboxcclv \ifvoid\footins\else % footnote info is present \vskip\skip\footins - \footnoterule - \unvbox\footins\fi + \ensureblacko{\footnoterule \unvbox\footins}\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi }} \footline={\hss\tenrm\thefontsize[10]\folio\hss} +\newcount\lastpage \lastpage=0 % the last page of the document +\def\Xpage#1{\lastpage=#1 \fnotenumlocal=0 } + %%%%%%%%%%%%%% margins -- sec. 3.25 in opmac-d.pdf @@ -1751,5 +1695,18 @@ Jun. 2014c \pgfolioA, \pgfolioB introduced Jul. 2014 \bgroup -> \begingroup in \adef Aug. 2014 \parskip=0pt in \begtt ...\endtt \addtabdata: redundant \expandafter removed +Sep. 2014 \bib [...] = {...} space before = is now optional + \nbpar in \caption + \replacestrings: reduced by 3\expandafter + \isnextchar, \isinlist prefixed as \long + \testparA uses \romannumeral trick now. +Oct. 2014 \pdfborder corrected: /Border [0 0 0] set for AR users. +Nov. 2014 \sortingdata corrected, \specsortingdata introduced. + \replacestrings uses \replacestringsA instead \tmp + \bfshape used in \titfont and \Xchap + \adef{ }{\ } in verbatim environment (instead \adef{ }[ }). + \fnotemark+\fnotetext+\runningfnotes bug fixed. + \flushcolumns, \iiparams removed, \mullines introduced +Dec. 2014 Color features rewritten using \pdfcolorstack %%%%%%%%%%%%%% End of opmac.tex |