summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/csplain/opmac/opmac.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-04-30 21:18:46 +0000
committerKarl Berry <karl@freefriends.org>2014-04-30 21:18:46 +0000
commitf3bfe79d0b938997f051a018e20b5398f379d5d7 (patch)
tree120f444c3d49ffce43c16110ca86b9dcfd5c82bb /Master/texmf-dist/tex/csplain/opmac/opmac.tex
parentdd46297c9435a2d46d4cfa54a70052bebeb0035c (diff)
csplain (30apr14)
git-svn-id: svn://tug.org/texlive/trunk@33770 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/csplain/opmac/opmac.tex')
-rw-r--r--Master/texmf-dist/tex/csplain/opmac/opmac.tex111
1 files changed, 66 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/csplain/opmac/opmac.tex b/Master/texmf-dist/tex/csplain/opmac/opmac.tex
index ece2e866a3c..d414231cf31 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. 2014}
+\def\OPmacversion{Apr. 2014c}
\immediate\write16{This is OPmac (Olsak's Plain macros), version <\OPmacversion>}
@@ -96,6 +96,7 @@
\def\cnvhook{} % hook before conversion of outlines
\def\pghook{} % hook in \output rutine
\def\toclinehook{} % hook in \tocline
+\def\fnotehook{} % hook in \fnote
\def\mnotehook{} % hook in \mnote
\def\captionhook#1{} % hook in \caption (#1 is "t" or "f")
@@ -117,7 +118,9 @@
%%%%%%%%%%%%%% Sizes of fonts and \baselineskip, sec. 3.4 in opmac-d.pdf
\ifx\regfont\undefined
- \opwarning{csplain version <Nov. 2012> or later is recommended}
+ \ifx\uselanguage\undefined
+ \opwarning{csplain version <Nov. 2012> or later is recommended}
+ \fi
% macros from csplain, file csfontsm.tex:
\font\tenbi=csbxti10 \def\bi{\tenbi}
\def\letfont#1#2{\ifx#2=\expandafter\letfont\expandafter#1\else
@@ -362,7 +365,7 @@
\ifx\dotocnumafter\relax \else
\opwarning{\noexpand\dotocnum unused in printchap/printsec/printsecc}\fi
}
-\def\insertmark#1{\toks0={#1}\mark{{\thetocnum} {\the\toks0}}}
+\def\insertmark#1{\toks0={#1}\mark{{\ifnonum\else\thetocnum\fi} {\the\toks0}}}
\newskip\remskipamount
\def\remskip{\afterassignment\remskipA \global\remskipamount}
@@ -398,7 +401,7 @@
\parfillskip=0pt plus2fil
\def\par{\endgraf\egroup}%
\captionhook{#1}\noindent
- {\destheight=2.1em \wlabel{\csname the#1num\endcsname}}%
+ \wlabel{\csname the#1num\endcsname}%
\printcaption{\mtext{#1}}{\csname the#1num\endcsname}%
}
\def\printcaption#1#2{{\bf#1 #2}\enspace}
@@ -407,7 +410,7 @@
\def\eqmark{\global\advance\dnum by1
\ifinner\else\eqno \fi
- {\destheight=2.1em \wlabel\thednum}\thednum
+ \wlabel\thednum \thednum
}
%%%%%%%%%%%%%% Items -- sec. 3.10 in opmac-d.pdf
@@ -922,7 +925,7 @@
%%%%%%%%%%%%%% Hyperrefs -- sec. 3.16 in opmac-d.pdf
-\newdimen\destheight \destheight=1.3em
+\def\destheight{1.4em}
\def\destactive[#1:#2]{\if$#2$\else\ifvmode
\tmpdim=\prevdepth \prevdepth=-1000pt
\destbox[#1:#2]\prevdepth=\tmpdim
@@ -942,7 +945,7 @@
}
\def\toclink#1{\toclinkA{#1}}
\def\pglink#1{#1}
-\def\citelink#1{#1}
+\def\citelink#1#2{#2}
\def\reflink[#1]#2{#2}
\def\ulink[#1]#2{{#2}}
\def\urlcolor{}
@@ -951,7 +954,7 @@
\let\dest=\destactive
\def\toclink##1{\link[toc:##1]{\localcolor#1}{\toclinkA{##1}}}%
\def\pglink##1{\link[pg:##1]{\localcolor#1}{##1}}%
- \def\citelink##1{\link[cite:##1]{\localcolor#1}{##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}}%
\def\urlcolor{\longlocalcolor#2}%
@@ -1301,7 +1304,7 @@
\iflocfnum \leavevmode\openref\wref\Xfnote{}%
\isdefined{fn:\the\fnotenum}\iftrue
\else\opwarning{unknown \noexpand\fnote mark. TeX me again}\fi\fi
- \fnmarkx{\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}%
+ \fnmarkx{\fnotehook\typobase\typoscale[800/800]\vfootnote\fnmarkx{#1}}%
}
\def\fnotemark#1{{\advance\fnotenum by#1\relax
\isdefined{fn:\the\fnotenum}\iftrue\thefnote
@@ -1354,20 +1357,22 @@
\def\fixmnotes#1{\def\mnotesfixed{#1}}
+
%%%%%%%%%%%%%% \cite, \bib, \usebibtex, \usebbl -- sec. 3.23 in opmac-d.pdf
\newwrite\auxfile % AUX file for BibTeX
\newcount\bibnum % the bibitem counter
+\newtoks\bibmark % the bibmark used if \nonumcitations
\newcount\lastcitenum \lastcitenum=0 % for \shortcitations
\def\cite[#1]{{\citeA#1,,,[\printsavedcites]}}
\def\nocite[#1]{{\citeA#1,,,}}
-\def\rcite#1{{\citeA#1,,,\printsavedcites}}
+\def\rcite[#1]{{\citeA#1,,,\printsavedcites}}
\def\savedcites{}
\def\citeA #1#2,{\if#1,\else
\if *#1\addcitelist{*}\expandafter \skiptorelax \fi
- \expandafter \ifx \csname bib:#1#2\endcsname \relax
+ \isdefined{bib:#1#2}\iftrue \else
\addcitelist{#1#2}%
\opwarning{The cite [#1#2] unknown. Try to TeX me again}\openref
\addto\savedcites{?,}\def\sortcitesA{}\lastcitenum=0
@@ -1430,30 +1435,44 @@
}
\def\shortcitations{\lastcitenum=1 }
-\def\printcite#1{\citesep\citelink{#1}\def\citesep{,\hskip.2em\relax}}
-\def\printdashcite#1{\hbox{--}\citelink{#1}}
+\def\printcite#1{\citesep\citelink{#1}{\citelinkA{#1}}\def\citesep{,\hskip.2em\relax}}
+\def\printdashcite#1{\ifmmode-\else\hbox{--}\fi\citelink{#1}{\citelinkA{#1}}}
\def\citesep{}
-\def\bib[#1]{\par \ifnum\bibnum>0 \bibskip \fi
+\def\nonumcitations{\lastcitenum=0\def\sortcitesA{}\def\etalchar##1{$^{##1}$}%
+ \def\citelinkA##1{\isdefined{bim:##1}\iftrue \csname bim:##1\endcsname
+ \else ##1\opwarning{\noexpand\nonumcitations + empty bibmark. Maybe bad BibTeX style}\fi}
+}
+\def\citelinkA{}
+
+\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\bibA[#1]=#2{\bibmark={#2}\bibB[#1]}
+\def\bibB[#1]{\par \ifnum\bibnum>0 \bibskip \fi
\advance\bibnum by1
- \wbib{#1}{\the\bibnum}%
- \hangindent=\iindent
- \noindent \def\tmpb{#1}\dest[cite:\the\bibnum]%
- \indent \llap{[\the\bibnum] }\ignorespaces
+ \noindent \def\tmpb{#1}\wbib{#1}{\the\bibnum}{\the\bibmark}%
+ \printbib \ignorespaces
}
-\def\wbib#1#2{\edef\tmp{\wref\Xbib{{#1}{#2}}}%
- \ifx\tmp\empty\else \immediate\tmp \fi
+\def\wbib#1#2#3{\dest[cite:\the\bibnum]%
+ \ifx\wref\wrefrelax\else \immediate\wref\Xbib{{#1}{#2}{#3}}\fi}
+
+\def\Xbib#1#2#3{\sdef{bib:#1}{\bibnn{#2}&}\if^#3^\else\sdef{bim:#2}{#3}\fi\def\lastbibnum{#2}}
+
+\def\printbib{\hangindent=\iindent
+ \ifx\citelinkA\empty \noindent\hskip\iindent \llap{[\the\bibnum] }%
+ \else \noindent \fi
}
-\def\Xbib#1#2{\sdef{bib:#1}{\bibnn{#2}&}}
-\def\addcitelist#1{\global\addto\citelist{\lcite[#1]}}
+\def\addcitelist#1{\global\addto\citelist{\citeI[#1]}}
\def\writeaux#1{\immediate\write\auxfile{\string\citation{#1}}}
\def\writeXcite#1{\openref\immediate\wref\Xcite{{#1}}}
\def\citelist{} \def\citelistB{}
\def\usebibtex#1#2{%
\openref \openauxfile{#1}{#2}%
- \def\lcite[##1]{\writeaux{##1}}\citelist
+ \def\citeI[##1]{\writeaux{##1}}\citelist
\global\let\addcitelist=\writeaux
\bgroup \readbblfile{\jobname}\egroup
}
@@ -1471,27 +1490,22 @@
\else
\closein\testin
\bibnum=0
- \def\begin##1##2{}\def\end##1{}% LaTeX environment
- \def\newcommand##1 {}%
+ \long\def\begin##1\bibitem{\bibitem}\def\end##1{}% LaTeX environment
\def\httpAddr##1{\url{http:##1}}\def\\{\hfill\break}%
\def\newblock{\hskip .11em plus.33em minus.07em}%
- \def\mbox{\leavevmode\hbox}\let\em=\it
+ \def\mbox{\leavevmode\hbox}\def\emph##1{{\it##1}}%
\parindent=\iindent \bibtexhook\relax
\input #1.bbl
\par
\fi
}
-\def\bibitem{\isnextchar[{\bibitemB}{\def\tmpa{}\bibitemC}}
-\def\bibitemB[#1]{\def\tmpa{#1}\bibitemC}
+\def\bibitem{\isnextchar[{\bibitemB}{\bibmark={}\bibitemC}}
+\def\bibitemB[#1]{\bibmark={#1}\bibitemC}
\def\bibitemC#1{\bibitemD{#1}}
\def\bibitemD#1{\par\ifnum\bibnum>0 \bibskip \fi
\advance\bibnum by1
- \noindent \def\tmpb{#1}\dest[cite:\if$\tmpa$\the\bibnum\else\tmpa\fi]%
- \hangindent=\parindent
- \if$\tmpa$\indent\llap{[\the\bibnum] }\wbib{#1}{\the\bibnum}%
- \else [\tmpa]\wbib{#1}{\tmpa}\enskip
- \fi
- \ignorespaces
+ \noindent \def\tmpb{#1}\wbib{#1}{\the\bibnum}{\the\bibmark}%
+ \printbib \ignorespaces
}
\def\genbbl#1#2{\openauxfile{#1}{#2}%
\immediate\write\auxfile{\string\citation{*}}%
@@ -1513,7 +1527,7 @@
\sdef{bbl:a}#1{\bgroup \readbblfile{#1}\egroup}
\sdef{bbl:b}#1{\bgroup
- \let\lcite=\relax \xdef\citelist{\citelist\citelistB}%
+ \let\citeI=\relax \xdef\citelist{\citelist\citelistB}%
\def\bibitemC##1 ##2\par{%
\isinlist\citelist{[##1]}\iftrue \bibitemD{##1}##2\par\fi}%
\readbblfile{#1}%
@@ -1521,21 +1535,23 @@
\egroup
}
\sdef{bbl:c}#1{\bgroup
- \let\lcite=\relax \xdef\citelist{\citelist\citelistB}%
+ \ifx\citelinkA\empty \else
+ \opwarning{\string\nonumcitations: don't use \string\usebbl/c}\fi
+ \let\citeI=\relax \xdef\citelist{\citelist\citelistB}%
\def\bibitemC##1 ##2\par{%
\isinlist\citelist{[##1]}\iftrue
- \ifx\tmpa\empty \sdef{bb:##1}{\bibitemD{##1}##2\par}%
+ \if^\the\bibmark^\sdef{bb:##1}{\bibitemD{##1}##2\par}%
\else \toks0={##2\par}%
- \edef\tmpa{\noexpand\sdef{bb:##1}{% \tmpa have to expand
- \noexpand\bibitemB[\tmpa]{##1}\the\toks0}}\tmpa
+ \edef\tmpa{\noexpand\sdef{bb:##1}{% \the\bibmark have to expand
+ \noexpand\bibitemB[\the\bibmark]{##1}\the\toks0}}\tmpa
\fi\fi}%
\readbblfile{#1}%
\def\bibitemC##1{\bibitemD{##1}}%
- \def\lcite[##1]{\csname bb:##1\endcsname}\citelist
+ \def\citeI[##1]{\csname bb:##1\endcsname}\citelist
\global\let\addcitelist=\writeXcite
\egroup
}
-\def\Xcite#1{\addto\citelistB{\lcite[#1]}}
+\def\Xcite#1{\addto\citelistB{\citeI[#1]}}
%%%%%%%%%%%%%% output -- sec. 3.24 in opmac-d.pdf
@@ -1550,7 +1566,7 @@
}
\def\doprotect#1{\let#1=\relax}
\addto\begoutput{\def\nl{ }\def\fnote##1{}\def\fnotemark##1{}}
-\def\prepage{\destheight=25pt \dest[pg:\the\pageno]}
+\def\prepage{\def\destheight{25pt}\dest[pg:\the\pageno]}
{\catcode`\@=11
\gdef\pagecontents{\prepage % dest of pageno
@@ -1699,9 +1715,14 @@ Nov. 2013 \Xpage: \ifnum\lastpage=#1 \else inserted
\cr -> \crcr in \crl, \crll and \crli
\doverbinput: \ifeof\vifile added (bug ``empty line at EOF'' corrected)
eTeX support for multilang added.
-Feb. 2014 \sortcitations introduced, internal macros of \cite rewritten.
+Feb. 2014 \sortcitations introduced, internal macros of \cite rewritten
Mar. 2014 \frame: \setbox0=\hbox{{#1}} in order to \aftergroup in #1
- \mnote: \pdfsave,\pdfrestore inserted, \mnote colors rewritten.
-
+ \mnote: \pdfsave,\pdfrestore inserted, \mnote colors rewritten
+Apr. 2014 \nonumcitations, \ecite, \printbib, \lastbibnum introduced
+ \wbib, \citelink rewritten (more parameters now)
+ \destheight rewritten as macro, sorry
+ \fnotehook introduced
+Apr. 2014b \nocite[*] bug removed, \insertmark corrected
+Apr. 2014c nowarn about old csplain if csplain isn't used
%%%%%%%%%%%%%% End of opmac.tex