From 675c7eb7a82a0d94c0477932a4a8427491c6e841 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Jan 2006 23:51:36 +0000 Subject: trunk/Master/texmf-dist/source/latex/carlisle git-svn-id: svn://tug.org/texlive/trunk@181 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/carlisle/fix2col.dtx | 631 ++++++ .../texmf-dist/source/latex/carlisle/fix2col.ins | 10 + .../texmf-dist/source/latex/carlisle/ltxtable.tex | 230 ++ .../texmf-dist/source/latex/carlisle/pspicture.dtx | 703 ++++++ .../texmf-dist/source/latex/carlisle/pspicture.ins | 14 + .../texmf-dist/source/latex/carlisle/typehtml.dtx | 2364 ++++++++++++++++++++ .../texmf-dist/source/latex/carlisle/typehtml.ins | 3 + 7 files changed, 3955 insertions(+) create mode 100644 Master/texmf-dist/source/latex/carlisle/fix2col.dtx create mode 100644 Master/texmf-dist/source/latex/carlisle/fix2col.ins create mode 100644 Master/texmf-dist/source/latex/carlisle/ltxtable.tex create mode 100644 Master/texmf-dist/source/latex/carlisle/pspicture.dtx create mode 100644 Master/texmf-dist/source/latex/carlisle/pspicture.ins create mode 100644 Master/texmf-dist/source/latex/carlisle/typehtml.dtx create mode 100644 Master/texmf-dist/source/latex/carlisle/typehtml.ins diff --git a/Master/texmf-dist/source/latex/carlisle/fix2col.dtx b/Master/texmf-dist/source/latex/carlisle/fix2col.dtx new file mode 100644 index 00000000000..963f35e8fd1 --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/fix2col.dtx @@ -0,0 +1,631 @@ +% \iffalse +%% Source File: fix2col.dtx Copyright 1997 1998 David Carlisle +%% +%% This file may be distributed under the terms of the LPPL. +%% See 00readme.txt for details. +% +%<*dtx> + \ProvidesFile{fix2col.dtx} +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{fix2col} +% \ProvidesFile{fix2col.drv} +% \fi +% \ProvidesFile{fix2col.dtx} + [1998/08/17 v0.03 Output Routine fixes for two column mode (DPC,FMi)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{fix2col.dtx} +\end{document} +% +% \fi +% +% \GetFileInfo{fix2col.dtx} +% \CheckSum{579} +% +% \changes{v0.01}{1997/11/07} +% {Initial version} +% +% \changes{v0.02}{1997/11/11} +% {\cs{@ztryfc}} +% +% \title{The \textsf{fix2col} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle\thanks{%^^A +% Part one is essentially a copy of the fixmarks package by +% Piet van Oostrum, itself based on earlier work by Joe Pallas. +% Part two is loosely based on the fixfloats package, originally +% by Ed Sznyter, with some modifications by Bil Kleb.}} +% +% \date{\filedate} +% +% \let\package\textsf +% \let\env\textsf +% \let\url\texttt +% +% \maketitle +% +% \section{Introduction} +% This package makes two independent changes to \LaTeX's two column +% output routine to fix the following two longstanding `features'. +% +% \begin{itemize} +% \item +% If the \TeX\ mark system is used (for example using the +% `headings' page style in the standard \LaTeX\ classes) then any marks +% that originate on the first column are `lost' as \LaTeX\ constructs +% the second column. An example document showing how this can result +% in incorrect page headings may be found in the latex bug database:\\ +% \url{http://www.uni-mainz.de/cgi-bin/ltxbugs2html?pr=latex/2613} +% +% \item +% The second feature is documented in the \LaTeX\ book. By default +% \LaTeX\ does not attempt to keep double and single column floats in +% sequence, so if `Figure 1' is a double column float produced with +% |figure*|, then it may float +% after `Figure 2' if that is a single column, |figure|, float. +% Further correspondence about this may also be found in the +% bug database:\\ +% \url{http://www.uni-mainz.de/cgi-bin/ltxbugs2html?pr=latex/2346} +% \end{itemize} +% +% \StopEventually{} +% +% \section{Notes on the Implementation Strategies} +% +% \subsection{Preserving Marks} +% +% The standard \LaTeX\ twocolumn system works internally by making +% each column a separate `page' that is passed independently to \TeX's +% pagebreaker. (Unlike say the \package{multicol} package, where all +% columns are gathered together and then split into columns later, +% using |\vsplit|.) This means that the primitive \TeX\ marks that are +% normally used for header information, are globally reset after the +% first column. By default \LaTeX\ does nothing about this. +% A good solution is provided by Piet van Oostrum (building on earlier +% work of Joe Pallas) in his \package{fixmarks} package. +% +% After the first column box has been collected the mark information +% for that box is saved, so that any |\firstmark| can be +% `artificially' used to set the page-level marks after the second +% column has been collected. (The second column |\firstmark| is not +% normally required.) Unfortunately \TeX\ does not provide a direct +% way of knowing if any marks are in the page, |\firstmark| always has a +% value from previous pages, even if there is no mark in this page. +% The solution is to make a copy of the box and then |\vsplit| it +% so that any marks show up as |\splitfirstmark|. +% +% The use of |\vsplit| does mean that the output routine will globally +% change the value of |\splitfirstmark| and +% |\splitbotmark|. The \package{fixmarks} package goes to some trouble +% to save and restore these values so that the output routine does +% \emph{not} change the values. This part of \package{fixmarks} is not +% copied here as it is quite costly (having to be run on every page) and +% there is no reason why anyone writing code using |\vsplit| should +% allow the output routine to be triggered before the split marks have +% been accessed. +% +% \subsection{Preserving Float Order} +% +% The standard output routine maintains two lists of floats that have +% been `deferred' for later consideration. One list for single column +% floats, and one for double column floats (which are always +% immediately put onto their deferred list). This mechanism means +% that \LaTeX\ `knows' which type of float is contained in each box +% by the list that it is processing, but having two lists means +% that there is no mechanism for preserving the order between the +% floats in each list. +% +% The solution to this problem consists of two small changes to +% the output routine. +% +% Firstly, abandon the `double column float list' |\@dbldeferlist| +% and change every command where it is used so that instead the +% same |\@deferlist| is used as for single column floats. +% That one change ensures that double and single column floats +% stay in the same sequence, but as \LaTeX\ no longer `knows' +% whether a float is double or single column, it will happily +% insert a double float into a single column, overprinting the +% other column, or the margin. +% +% The second change is to provide an alternative mechanism for +% recording the two column floats. \LaTeX\ already has a compact +% mechanism for recording float information, an integer count register +% assigned to each float records information about the `type' of float +% `figure', `table' and the position information `htp' etc. +% +% The type information is stored in the `high' bits, one bit position +% (above `32') allocated to each float type. The `low' bits store +% information about the allowed positions, one bit each allocated for +% |h t b p|. In the \LaTeX2.09 system, the bit corresponding to `16' +% formed a `boundary' between these two sets of information, and it +% was never actually used by the system. Ed Sznyter's +% \package{fixfloats} package not unreasonably used this position to +% store the double column information, setting the bit for double +% column floats. Then at each point in the output routine at which a +% float is committed to a certain region, an additional check must be +% made to check that the float is (or is not) double column. If it +% spans the wrong number of columns it is deferred rather than being +% added. +% +% Unfortunately the bit `16' is not available in \LaTeXe. It is used +% to encode the extra float position possibility `|!|' that was added +% in that system. It would be possible to use position `32' and to +% move the flags for `table', `figure',\ldots\ up one position, to +% start at 64, but this would mean that in principle one less float +% type would be supported, and more importantly is likely to break +% any other packages that assume anything about the output routine +% internals. So here I instead use another mechanism for flagging +% double column floats: By default all floats have depth 0pt. +% This package arranges that double column ones have depth 1sp. +% This information may then be used in the same manner as in +% the \package{fixfloats} package, to defer any floats that are not of +% the correct column spanning type. +% +% Use of the package showed that one also has to change the way +% \LaTeX{} handles star-form floats: if they are immediately deferred +% (as done normally) certain situations can still result in the float +% sequence getting out of order. This happens when a floats are placed +% in the middle of a paragraph. In that case the wide float is +% deferred immediately while a column wide float early on in the same +% paragraph might not be handled until the end of the paragraph when +% it is finally seen by the output routine. Since by that time the +% wide float is already on the |\@deferlist| the column float will +% also end up there (which is not only incorrect because it may have +% fitted onto the page but also because it is then placed at the end +% of this list). Version v0.03 now fixes this problem. +% +% +% \section{Implementation} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Preserving Marks} +% +% This is just a change to the single command |\@outputdblcol| +% so that it saves mark information for the first column and restores +% it in the second column. +% \begin{macrocode} +\def\@outputdblcol{% + \if@firstcolumn + \global\@firstcolumnfalse +% \end{macrocode} +% Save the left column +% \begin{macrocode} + \global\setbox\@leftcolumn\copy\@outputbox +% \end{macrocode} +% +% Remember the marks from the first column +% \begin{macrocode} + \splitmaxdepth\maxdimen + \vbadness\maxdimen + \setbox\@outputbox\vsplit\@outputbox to\maxdimen +% \end{macrocode} +% +% One minor difference from the current \package{fixmarks}, pass the +% marks through a token register to stop any |#| tokens causing an +% error in a |\def|. +% \begin{macrocode} + \toks@\expandafter{\topmark}% + \xdef\@firstcoltopmark{\the\toks@}% + \toks@\expandafter{\splitfirstmark}% + \xdef\@firstcolfirstmark{\the\toks@}% +% \end{macrocode} +% +% This test does not work if truly empty marks have been inserted, but +% \LaTeX\ marks should always have (at least) two brace groups. +% (Except before the first mark is used, when the marks are empty, +% but that is OK here.) +% \begin{macrocode} + \ifx\@firstcolfirstmark\@empty + \global\let\@setmarks\relax + \else + \gdef\@setmarks{% + \let\firstmark\@firstcolfirstmark + \let\topmark\@firstcoltopmark}% + \fi +% \end{macrocode} +% +% End of change +% \begin{macrocode} + \else + \global\@firstcolumntrue + \setbox\@outputbox\vbox{% + \hb@xt@\textwidth{% + \hb@xt@\columnwidth{\box\@leftcolumn \hss}% + \hfil + \vrule \@width\columnseprule + \hfil + \hb@xt@\columnwidth{\box\@outputbox \hss}}}% + \@combinedblfloats +% \end{macrocode} +% Override current first and top with those of first column if necessary +% \begin{macrocode} + \@setmarks +% \end{macrocode} +% End of change +% \begin{macrocode} + \@outputpage + \begingroup + \@dblfloatplacement + \@startdblcolumn + \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}% + \endgroup + \fi} +% \end{macrocode} +% +% \subsection{Preserving Float Order} +% +% Changes |\@dbldeferlist| to |\@deferlist| are not explicitly noted +% but are flagged by blank comment lines around the changed line. +% +% +% \begin{macrocode} +\def\end@dblfloat{% +\if@twocolumn + \@endfloatbox + \ifnum\@floatpenalty <\z@ + \@largefloatcheck +% \end{macrocode} +% +% Force the depth of two column float boxes. +% \begin{macrocode} + \global\dp\@currbox1sp % +% \end{macrocode} +% +% \changes{v0.03}{1998/08/17}{FMi: use output routine to +% defer float} +% Next line assumes that first token of |\end@float| is +% |\@endfloatbox| so we gobble that. +% \begin{macrocode} +% \@cons\@deferlist\@currbox + \expandafter\@gobble\end@float +% \end{macrocode} +% |\@Esphack| is then added by |\@endfloat| above. +% \begin{macrocode} + \fi +% \ifnum \@floatpenalty =-\@Mii \@Esphack\fi +\else + \end@float +\fi +} +% \end{macrocode} +% +% Test if the float box has the wrong width. (Actually as noted above +% the test is for a conventional depth setting rather than for the +% width of the float). +% \begin{macrocode} +\def\@testwrongwidth #1{% + \ifdim\dp#1=\f@depth + \else + \global\@testtrue + \fi} +% \end{macrocode} +% +% Normally looking for single column floats, which have zero depth. +% \begin{macrocode} +\let\f@depth\z@ +% \end{macrocode} +% +% but when making two column float area, look for floats with 1sp +% depth. +% \begin{macrocode} +\def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber + \global\@dbltoproom \dbltopfraction\@colht + \@textmin \@colht + \advance \@textmin -\@dbltoproom + \@fpmin \dblfloatpagefraction\textheight + \@fptop \@dblfptop + \@fpsep \@dblfpsep + \@fpbot \@dblfpbot +% \end{macrocode} +% +% \begin{macrocode} + \def\f@depth{1sp}} +% \end{macrocode} +% +% All the remaining changes are replacing the double column defer list +% or insering the extra test |\@testwrongwidth|\marg{box} at suitable +% places. That is at plces where a box is taken off the deferlist. +% \begin{macrocode} +\def \@doclearpage {% + \ifvoid\footins + \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa + \setbox\@tempboxa\box\@cclv + \xdef\@deferlist{\@toplist\@botlist\@deferlist}% + \global \let \@toplist \@empty + \global \let \@botlist \@empty + \global \@colroom \@colht + \ifx \@currlist\@empty + \else + \@latexerr{Float(s) lost}\@ehb + \global \let \@currlist \@empty + \fi + \@makefcolumn\@deferlist + \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}% + \if@twocolumn + \if@firstcolumn +% \end{macrocode} +% +% \begin{macrocode} + \xdef\@deferlist{\@dbltoplist\@deferlist}% +% \end{macrocode} +% +% \begin{macrocode} + \global \let \@dbltoplist \@empty + \global \@colht \textheight + \begingroup + \@dblfloatplacement +% \end{macrocode} +% +% \begin{macrocode} + \@makefcolumn\@deferlist + \@whilesw\if@fcolmade \fi{\@outputpage + \@makefcolumn\@deferlist}% +% \end{macrocode} +% +% \begin{macrocode} + \endgroup + \else + \vbox{}\clearpage + \fi + \fi +% \end{macrocode} +% the next line is needed to avoid losing floats in certain +% circumstances a single call to the original |\doclearpage| +% will now no longer output all floats. +% \changes{v0.03}{1998/08/17}{FMi: ensure \cs{doclearpage} is called again +% until all floats are output} +% \begin{macrocode} + \ifx\@deferlist\@empty \else\clearpage \fi + \else + \setbox\@cclv\vbox{\box\@cclv\vfil}% + \@makecol\@opcol + \clearpage + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def \@startdblcolumn {% + \@tryfcolumn \@deferlist + \if@fcolmade + \else + \begingroup + \let \reserved@b \@deferlist + \global \let \@deferlist \@empty + \let \@elt \@sdblcolelt + \reserved@b + \endgroup + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\@addtonextcol{% + \begingroup + \@insertfalse + \@setfloattypecounts + \ifnum \@fpstype=8 + \else + \ifnum \@fpstype=24 + \else + \@flsettextmin + \@reqcolroom \ht\@currbox + \advance \@reqcolroom \@textmin + \ifdim \@colroom>\@reqcolroom + \@flsetnum \@colnum + \ifnum\@colnum>\z@ + \@bitor\@currtype\@deferlist + \@testwrongwidth\@currbox + \if@test + \else + \@addtotoporbot + \fi + \fi + \fi + \fi + \fi + \if@insert + \else + \@cons\@deferlist\@currbox + \fi + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\def\@addtodblcol{% + \begingroup + \@insertfalse + \@setfloattypecounts + \@getfpsbit \tw@ + \ifodd\@tempcnta + \@flsetnum \@dbltopnum + \ifnum \@dbltopnum>\z@ + \@tempswafalse + \ifdim \@dbltoproom>\ht\@currbox + \@tempswatrue + \else + \ifnum \@fpstype<\sixt@@n + \advance \@dbltoproom \@textmin + \ifdim \@dbltoproom>\ht\@currbox + \@tempswatrue + \fi + \advance \@dbltoproom -\@textmin + \fi + \fi + \if@tempswa + \@bitor \@currtype \@deferlist +% \end{macrocode} +% +% not in fixfloats? +% \begin{macrocode} + \@testwrongwidth\@currbox +% \end{macrocode} +% +% \begin{macrocode} + \if@test + \else + \@tempdima -\ht\@currbox + \advance\@tempdima + -\ifx \@dbltoplist\@empty \dbltextfloatsep \else + \dblfloatsep \fi + \global \advance \@dbltoproom \@tempdima + \global \advance \@colht \@tempdima + \global \advance \@dbltopnum \m@ne + \@cons \@dbltoplist \@currbox + \@inserttrue + \fi + \fi + \fi + \fi + \if@insert + \else + \@cons\@deferlist\@currbox + \fi + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\def \@addtocurcol {% + \@insertfalse + \@setfloattypecounts + \ifnum \@fpstype=8 + \else + \ifnum \@fpstype=24 + \else + \@flsettextmin + \advance \@textmin \@textfloatsheight + \@reqcolroom \@pageht + \ifdim \@textmin>\@reqcolroom + \@reqcolroom \@textmin + \fi + \advance \@reqcolroom \ht\@currbox + \ifdim \@colroom>\@reqcolroom + \@flsetnum \@colnum + \ifnum \@colnum>\z@ + \@bitor\@currtype\@deferlist +% \end{macrocode} +% We need to defer the float also if its width +% doesn't fit. +% \changes{v0.03}{1998/08/17}{FMi: test for wide float was +% in wrong place} +% \begin{macrocode} + \@testwrongwidth\@currbox +% \end{macrocode} +% +% \begin{macrocode} + \if@test + \else + \@bitor\@currtype\@botlist + \if@test + \@addtobot + \else + \ifodd \count\@currbox + \advance \@reqcolroom \intextsep + \ifdim \@colroom>\@reqcolroom + \global \advance \@colnum \m@ne + \global \advance \@textfloatsheight \ht\@currbox + \global \advance \@textfloatsheight 2\intextsep + \@cons \@midlist \@currbox + \if@nobreak + \nobreak + \@nobreakfalse + \everypar{}% + \else + \addpenalty \interlinepenalty + \fi + \vskip \intextsep + \box\@currbox + \penalty\interlinepenalty + \vskip\intextsep + \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi + \outputpenalty \z@ + \@inserttrue + \fi + \fi + \if@insert + \else + \@addtotoporbot + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \if@insert + \else + \@resethfps + \@cons\@deferlist\@currbox + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\@xtryfc #1{% + \@next\reserved@a\@trylist{}{}% + \@currtype \count #1% + \divide\@currtype\@xxxii + \multiply\@currtype\@xxxii + \@bitor \@currtype \@failedlist + \@testfp #1% +% \end{macrocode} +% +% \begin{macrocode} + \@testwrongwidth #1% +% \end{macrocode} +% +% \begin{macrocode} + \ifdim \ht #1>\@colht + \@testtrue + \fi + \if@test + \@cons\@failedlist #1% + \else + \@ytryfc #1% + \fi} +% \end{macrocode} +% +% \begin{macrocode} +\def\@ztryfc #1{% + \@tempcnta\count #1% + \divide\@tempcnta\@xxxii + \multiply\@tempcnta\@xxxii + \@bitor \@tempcnta {\@failedlist \@flfail}% + \@testfp #1% +% \end{macrocode} +% +% not in fixfloats? +% \begin{macrocode} + \@testwrongwidth #1% +% \end{macrocode} +% +% \begin{macrocode} + \@tempdimb\@tempdima + \advance\@tempdimb\ht #1% + \advance\@tempdimb\@fpsep + \ifdim \@tempdimb >\@colht + \@testtrue + \fi + \if@test + \@cons\@flfail #1% + \else + \@cons\@flsucceed #1% + \@tempdima\@tempdimb + \fi} +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/carlisle/fix2col.ins b/Master/texmf-dist/source/latex/carlisle/fix2col.ins new file mode 100644 index 00000000000..61206a6ca6c --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/fix2col.ins @@ -0,0 +1,10 @@ +\input docstrip +\keepsilent +\preamble +\endpreamble + +\askforoverwritefalse + +\generate{\file{fix2col.sty}{\from{fix2col.dtx}{package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/carlisle/ltxtable.tex b/Master/texmf-dist/source/latex/carlisle/ltxtable.tex new file mode 100644 index 00000000000..ea5ba2f1959 --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/ltxtable.tex @@ -0,0 +1,230 @@ +% +%% User documentation and source for ltxtable package +%% (C) 1995 David Carlisle +% +%% This file may be distributed under the terms of the LPPL. +%% See 00readme.txt for details. +% +% Save this file as ltxtable.tex, then +% latex ltxtable +% +% This will write the ltxtable.sty package file on to your system +% and produce some rather terse typeset documentation. +% +\begin{filecontents}{ltx1.tex} +\begin{longtable}{|cXX|} +the & head& line\endhead +the & foot& line\endfoot +a&b&b\\ +\multicolumn{2}{c}{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}&c\\ +a&b&b b b b b b b b b b b b b b b b b b b b b b b b b b \\ +a a& b b& c c\\ +a a& b b& + c c c c c c c c c c c c c c c c c c c c c c c c c c c c c cc cc\\ +a a aaaa& b b& c ccccc\\ +\end{longtable} +\end{filecontents} + +\begin{filecontents}{ltxtable.sty} +% +%% ltxtable package (C) 1995 David Carlisle +%% +%% This file may be distributed under the terms of the LPPL. +%% See 00readme.txt for details. +% +% User documentation is in the file ltxtable.tex +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ltxtable} + [1995/12/11 v0.2 longtable/tabularx merge (DPC)] +% \end{macrocode} +% +% May as get these in, going to need them... +% \begin{macrocode} +\RequirePackage{tabularx,longtable} +% \end{macrocode} +% +% \begin{macrocode} +\def\LTXtable#1#2{% +\begingroup +\TX@target#1\relax +\expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}% + \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% + \edef\TX@ckpt{\cl@@ckpt}% + \let\@elt\relax + \TX@old@table=\maxdimen + \TX@col@width=\TX@target + \global\TX@cols=\@ne + \TX@typeout@ + {\@spaces Table Width\@spaces Column Width\@spaces X Columns}% +% \end{macrocode} +% Need to modify |\TX@trial| so that |longtable| functions are +% Subverted to do the measuring that |tabularx| normally does. +% Also during the trial runs each `chunk' is not unboxed so it just +% gets thrown away when the next chunk starts. +% \begin{macrocode} +\def\TX@trial##1{% + \setbox\@tempboxa=\hbox{% +% \end{macrocode} +% |\multicolum| A sad tale, For now just stop |longtable| messing with +% it, so that |tabularx| can mess with it. +% \begin{macrocode} +\let\LTmulticolumn\multicolumn +% \end{macrocode} +% +% \begin{macrocode} +\def\endlongtable{% + \LT@echunk +\global\setbox\@ne\hbox{\unhbox\@ne}% + \kern\wd\@ne + \LT@get@widths% + \endgroup}% +% \end{macrocode} +% +% \begin{macrocode} +\def\LT@ntabularcr{% + \ifnum0=`{}\fi + \LT@echunk + \LT@get@widths + \LT@bchunk}% +% \end{macrocode} +% +% \begin{macrocode} +\def\LT@argtabularcr[####1]{% + \ifnum0=`{}\fi + \ifdim ####1>\z@ + \unskip\@xargarraycr{####1}\else \@yargarraycr{####1}\fi + \LT@echunk + \LT@get@widths + \LT@bchunk}% +% \end{macrocode} +% +% \begin{macrocode} +% Any extra commands. This is used on the first run to count the number +% of {\ttfamily X} columns. +% \begin{macrocode} + ##1\relax +% \end{macrocode} +% Added at v1.05: dissable "\write"s during a trial run. This trick is +% from the \TeX{}Book. +% \begin{macrocode} + \let\immediate=\relax\def\write####1####{{\afterassignment}\toks@=}% +% \end{macrocode} +% Turn off warnings (see appendix D). Also prevent them being turned +% back on by setting the parameter names to be registers. +% \begin{macrocode} + \hbadness=\@M\hfuzz=\maxdimen + \let\hbadness=\@tempcnta\let\hfuzz=\@tempdima +% \end{macrocode} +% Make the table, and finish the hbox. +% Since v1.06, "\toks@" contains the preamble specification, +% and possible optional argument, as well as the table body. +% Well it does in |tabularx|, here the body is in an external file so +% just input it. +% \begin{macrocode} + \input{#2}\unskip}% +% \end{macrocode} +% Since v1.05 reset all \LaTeX\ counters, by executing "\TX@ckpt". +% \begin{macrocode} +\TX@ckpt +% \end{macrocode} +% Print some statistics. +% Added "\TX@align" in v1.05, to line up the columns. +% \begin{macrocode} + \TX@typeout@{\@spaces + \expandafter\TX@align + \the\wd\@tempboxa\space\space\space\space\space\@@ + \expandafter\TX@align + \the\TX@col@width\space\space\space\space\space\@@ + \@spaces\the\TX@cols}}% +% \end{macrocode} +% \end{macro} + \TX@trial{\def\NC@rewrite@X{% + \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}% +\let\LT@make@row\LT@blank@row + \loop + \TX@arith + \ifTX@ + \TX@trial{}% + \repeat +% \end{macrocode} +% On the last run, may as well run with |\setlongtables|. +% \begin{macrocode} +\let\LT@make@row\relax +\input{#2}% +\endgroup} +% \end{macrocode} + + +\end{filecontents} + +\documentclass{article} +\setlength{\textheight}{5in} +\usepackage{ltxtable} + +\tracingtabularx +\begin{document} + +\title{ltxtable: longtable meets tabularx} +\author{David Carlisle} +\date{1995/12/11} +\maketitle + +Since \texttt{tabularx} was put on the archives in 1992 or so I have +had a constant stream of email messages asking for a merged +\texttt{tabularx}/\texttt{longtable} package. + +Well here it is! (First draft, anyway.) + +Rules of the game: + +\begin{itemize} +\item Put the \texttt{longtable} environment using \texttt{tabularx} + style \texttt{X} column specifiers in a file \emph{file} on its + own. (You can use the \texttt{filecontents} environment to include + it back into the main document file, if you wish.) +\item If you want to input the file at some point, using the + \texttt{X} columns to force the table width to be \emph{width} wide, + go \verb|\LTXtable{|\emph{width}\verb|}{|\emph{file}\verb|}|. +\item \verb|\multicolumn|: If you read the \texttt{tabularx} and + \texttt{longtable} docs you will find that both packages have a lot + of fun with this command. In order to keep my sanity, for this + merger I disable \texttt{longtable}'s version of \verb|\multicolumn|. + This means that the column widths calculated are not always the same + (not as good as) the widths that would be calculated by an + equivalent \texttt{tabularx} environment. Perhaps one day I will do + something about this. Perhaps. +\end{itemize} + +\clearpage + +\centering + + +A 300pt rule, just so can see the required width. + +\mbox{\vrule width 300pt height 1pt} + +First a tabularx + + +\begingroup +\renewenvironment{longtable}{\noindent\tabularx{300pt}}{\endtabularx} +\def\endhead{\\}\def\endfoot{\rlap{ !!!}\\} +\input{ltx1} +\endgroup + + +Then a longtable + + + +\LTXtable{300pt}{ltx1} + +\end{document} + +1995/11/07 v0.1 first release +1995/12/11 v0.2 (Petr Sojka) Typos fixed so the package works! + (Initial release *always* read the same table file, + ignoring the argument...) diff --git a/Master/texmf-dist/source/latex/carlisle/pspicture.dtx b/Master/texmf-dist/source/latex/carlisle/pspicture.dtx new file mode 100644 index 00000000000..4bb464b4c14 --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/pspicture.dtx @@ -0,0 +1,703 @@ +% +% \iffalse +%% +%% Source File `pspicture.dtx'. +%% Copyright (C) 1992 1999 David Carlisle +%% This file may be distributed under the terms of the LPPL. +%% See 00readme.txt for details. +%% +% +%<*dtx> + \ProvidesFile{pspicture.dtx} +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{pspicture} +%\ProvidesFile{pspicture.drv} +%<*package,driver> +% \fi +% \ProvidesFile{pspicture.dtx} + [1999/04/11/ v2.02 Picture mode via PS specials (DPC)] +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{pspicture.dtx} +\end{document} +% +% \fi +% +% \GetFileInfo{pspicture.dtx} +% \CheckSum{110} +% +% \changes{1} {1989/05/10}{(Not made widely available)} +% \changes{2} {1992/01/02}{support for dvips added} +% \changes{2.01}{1992/06/16}{First public release} +% \changes{2.02}{1999/04/11}{Fix for `new' docstrip, and LPPL} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \title{The \textsf{pspicture} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% +% \author{D. P. Carlisle} +% \date{16 June 1992} +% \maketitle +% +% +% \section{Introduction} +% {\tt pspicture} is a re-implementation, and extension of, \LaTeX's +% {\tt picture} environment, using PostScript |\special|'s. This has +% several advantages, mainly that lines of arbitrary slope and thickness +% may be specified, and there is no limit on the size of the circles +% that may be drawn\footnote{^^A +% There is a certain amount of overlap between this style option and the +% widely available {\tt eepic} option. However when I wrote the first +% version of this, in 1989, I was not aware of {\tt eepic}, and {\tt +% pspicture} has been reasonably popular in Manchester, even +% though {\tt epic} and {\tt eepic} have been installed.}. +% +% One disadvantage is that the picture can no longer be previewed on a +% |dvi| previewer, such as |xdvi|. To help with this problem, a +% companion style option, {\tt texpicture}, may be used while developing +% a document, this uses the standard picture commands as much as +% possible, and silently omits any picture objects that can not be drawn +% with standard \LaTeX. +% +% A second disadvantage, is that a {\tt dvi} file produced with {\tt +% pspicture} will contain embedded |\special| commands. These commands +% will only work with the driver program for which they were intended. +% This makes the {\tt dvi} file less portable. {\tt pspicture} will by +% default use |\special|'s set up for Rokicki's {\tt dvips} program, +% although it should be easy to modify the code to work with other +% PostScript drivers. A {\sc DocStrip} option for a version of {\tt +% dvi2ps} is included with this distribution. +% +% \subsection{Commands Available}{\parskip=\baselineskip\parindent=0pt +% \DescribeMacro{\circle}\DescribeMacro{\circle*} +% Use as described in the \LaTeX\ book but with no maximum diameter. +% The thickness of the circle is altered by the |\linethickness| +% command. The size of the circle produced by |\circle*| is not +% affected by |\linethickness|, so it is not the same as `filling in' +% the circle drawn by |\circle|. +% +% \DescribeMacro{\oval} +% Use as described in the \LaTeX\ book, but as there is no maximum +% diameter for the circular arcs, the oval (in the absence of the +% optional |[tr]| etc) always consists of two semi-circular arcs +% joined by a pair of parallel lines. To obtain a `rectangle with +% rounded corners' the oval command has a second optional argument +% (given first !).\\ +% |\oval[20](100,200)[t]|\\ +% Produces the top half of an oval with quarter circles of radius +% 20*unitlength. +% If unitlength = 1pt then this is equivalent to the standard oval +% command. In general |\oval[R](x,y)| uses circular arcs of radius +% $\min(R,x/2,y/2)$. +% +% \DescribeMacro{\line}\DescribeMacro{\vector} +% Use as described in the \LaTeX\ book but with no restriction on the +% available slopes. The thickness of a sloping line is altered by the +% |\linethickness| command. +% +% \DescribeMacro{\Line}\DescribeMacro{\Vector} +% New forms of the line and vector commands.\\ +% |\put(x1,y1){\Line(x2,y2)}|\\ +% produces a line from (x1,y1) to (x1+x2,y1+y2) and similarly for +% |\Vector|. +% +% \DescribeMacro{\Curve} +% Like |\Line| except that it produce a curve!\\ +% |\put(x1,y1){\Curve(x2,y2){m}}|\\ +% produces a curve from (x1,y1) to (x1+x2,y1+y2). the amount of +% curvature is controlled by m but try $1$ or $-1$ first. m does not +% have to be an integer. Negative numbers curve the opposite way to +% positive numbers. +% +% \DescribeMacro{\thinlines}\DescribeMacro{\thicklines}% +% \DescribeMacro{\linethickness} +% These commands alter the thickness of {\bf all} lines including +% slanted lines and circular arcs.\vspace{\baselineskip} +% +% \DescribeMacro{\arrowlength} +% A new command which specifies the size of the arrowhead drawn by the +% |\vector| and |\Vector| commands. Like |\linethickness| it does not +% get multiplied by |\unitlength|. At present the arrowhead is +% triangular. If a head with curved sides more like the standard +% \LaTeX\ head is required the definition of |!A| in pspicture.ps +% should be altered. +% +% Other {\tt picture} mode commands are not altered by this style, and +% so may be used, just as described in the \LaTeX\ book. These include: +% |\put|, |\multiput|, |\makebox|, |\framebox|, |dashbox| and +% |\shortstack|. +% +% }\newpage\section{Examples} +% +% \noindent A picture built with \LaTeX's line and circle fonts. +% +% \noindent\begin{picture}(300,130) +% \put(0,0){\line(1,2){50}} +% \put(50,50){\vector(1,1){30}} +% \put(50,50){\circle{30}} +% \put(100,50){\circle*{10}} +% \put(150,50){\oval(50,20)[t]} +% \put(150,100){\oval(30,30)[bl]} +% +% ^^A LaTeX does not do these so well +% \put(250,60){\circle{60}} +% \put(250,60){\circle{50}} +% +% \end{picture} +% +% \bigskip +% \def\eatmodule#1>{} + +%\eatmodule +%<*x> + \ifcat a\noexpand @\else + \MakePercentComment + \def\ProvidesPackage#1[#2]{} + \def\NeedsTeXFormat#1{} + \makeatletter ^^A This is NOT the usual way to access this + \input{pspicture.sty} ^^A style. It is intended as a style option: + \makeatother ^^A \documentstyle[a4,pspicture]{article} + \MakePercentIgnore + \fi +%\eatmodule +% +% +% \noindent The same picture built with PostScript |\special|'s. +% +% \noindent\begin{picture}(300,130) +% \put(0,0){\line(1,2){50}} +% \put(50,50){\vector(1,1){30}} +% \put(50,50){\circle{30}} +% \put(100,50){\circle*{10}} +% \put(150,50){\oval(50,20)[t]} +% \put(150,100){\oval(30,30)[bl]} +% +% ^^A LaTeX does not do these so well +% \put(250,60){\circle{60}} +% \put(250,60){\circle{50}} +% +% \end{picture} +% +% \bigskip +% \noindent Some extra features not available using the standard picture +% mode. +% +% \noindent\begin{picture}(300,150) +% \put(250,60){\vector(-8,1){50}} ^^A Vector of any slope. +% \put(200,0){\Line(100,100)} ^^A Line command. +% \put(210,100){\Vector(90,10)} ^^A Vector command. +% \put(70,90){\oval(100,70)} ^^A Control over the radius of +% \put(70,90){\oval[10](100,70)} ^^A `corners' of an oval. +% \linethickness{3pt} +% \put(20,20){\circle{20}} ^^A Circles of any thickness and size. +% \put(20,20){\line(10,1){30}} ^^A Sloping lines of any thickness. +% +% \end{picture} +% +% \StopEventually{} +% +% \section{pspicture.sty} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% First we set up the code that is specific to the driver program that +% is being used. If the driver can incorporate a header file, define +% |\PS@header| appropriately, |\PS@special| should expand to the format +% for inline PostScript code. The driver should protect this code with a +% (g)save (g)restore pair. dvips is treated specially so that it will be +% the default driver if this file is used without being stripped. If you +% find definitions of these macros which work for the driver you use, +% email me, and I will include them in the next release. +% \begin{macro}{\PS@header} +% Code to include the PostScript header. +% \begin{macrocode} +%<*dvips> + \def\PS@header#1{\special{header=#1}} +% +%\def\PS@header#1{\typeout{Print with the option -i #1}} +\PS@header{pspicture.ps} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\PS@special} +% The format of the |\special| command for inline PostScript. +% \begin{macrocode} +%<*dvips> + \def\PS@special#1{\special{"#1}} +% +%\def\PS@special#1{\special{pstext="#1"}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\strippt} +% Strip the final `pt' off the string returned by |\the|. +% \begin{macrocode} +{\catcode`t=12\catcode`p=12\gdef\noPT#1pt{#1}} +\def\strippt#1{\expandafter\noPT\the#1\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@circle} +% Internal name for |\circle|. +% \begin{macrocode} +\def\@circle#1{% + \@tempdimb #1\unitlength + \PS@special{% + \strippt\@wholewidth + \strippt\@tempdimb + !C}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@dot} +% Internal name for |\circle*|. +% \begin{macrocode} +\def\@dot#1{% + \@tempdimb #1\unitlength + \PS@special{% + \strippt\@tempdimb + !D}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\line} +% Line with a \LaTeX\ style slope specification. +% \begin{macrocode} +\def\line(#1,#2)#3{% + \@linelen=#3\unitlength + \PS@special{% + \strippt\@wholewidth + #1 + #2 + \strippt\@linelen + !L}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vector} +% Line and arrow head with a \LaTeX\ style slope specification. +% \begin{macrocode} +\def\vector(#1,#2)#3{% + \@linelen=#3\unitlength + \PS@special{% + \strippt\@arrowlength + \strippt\@wholewidth + #1 + #2 + \strippt\@linelen + !V}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\oval} +% If no optional argument appears, use a default of maximum radius of +% \TeX's maximum length. +% \begin{macrocode} +\def\oval{% + \@ifnextchar[% + {\@ov@l}% + {\count@=\maxdimen \divide\count@ by \unitlength \@ov@l[\count@]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ov@l} +% Look for an optional |tlbr| argument. +% \begin{macrocode} +\def\@ov@l[#1](#2,#3){% + \@ifnextchar[{\@oval[#1](#2,#3)}{\@oval[#1](#2,#3)[]}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@oval} +% The PostScript version of the |\oval| command will print each quarter +% of the oval separately, each quarter will only be printed if the +% appropriate argument is $1$. An optional argument of |t| causes the +% arguments for the two bottom quarters to be set to $0$, similarly, |r| +% causes the two left quarters to be set to $0$. Thus an argument [tr] +% will set the bottom and left quarters to $0$, resulting in only the +% top right quarter being printed. +% \begin{macrocode} +\def\@oval[#1](#2,#3)[#4]{\begingroup + \@tempdimb #1\unitlength + \@ovxx #2\unitlength + \@ovyy #3\unitlength + \def\r{\def\TL{0 }\def\BL{0 }}% + \def\l{\def\TR{0 }\def\BR{0 }}% + \def\t{\def\BL{0 }\def\BR{0 }}% + \def\b{\def\TL{0 }\def\TR{0 }}% + \def\TL{1 }\def\BL{1 }\def\TR{1 }\def\BR{1 }% + \@tfor\@tempa :=#4\do{\csname\@tempa\endcsname}% + \PS@special{% + \BR\BL\TR\TL + \strippt\@wholewidth + \strippt\@tempdimb + \strippt\@ovxx + \strippt\@ovyy + !O}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Line} +% New style |\Line| command. +% \begin{macrocode} +\def\Line(#1,#2){% + \@ovxx #1\unitlength + \@ovyy #2\unitlength + \PS@special{% + \strippt\@wholewidth + \strippt\@ovxx + \strippt\@ovyy + !L2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Curve} +% Not particularly good, but it will do for now. +% \begin{macrocode} +\def\Curve(#1,#2)#3{% + \@ovxx #1\unitlength + \@ovyy #2\unitlength + \PS@special{% + \strippt\@wholewidth + \strippt\@ovxx + \strippt\@ovyy + #3 + !C2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Vector} +% New style |\Vector| command. +% \begin{macrocode} +\def\Vector(#1,#2){% + \@ovxx #1\unitlength + \@ovyy #2\unitlength + \PS@special{% + \strippt\@arrowlength + \strippt\@wholewidth + \strippt\@ovxx + \strippt\@ovyy + !V2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@arrowlength} +% Length of an arrow head. +% \begin{macrocode} +\newdimen\@arrowlength +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\arrowlength} +% Set the length of an arrow head. +% \begin{macrocode} +\def\arrowlength#1{\@arrowlength #1} +\arrowlength{8pt} +% \end{macrocode} +% \end{macro} +% If this file is used as a {\tt .sty} file without being stripped, we +% want to stop here. The |\endinput| must not be at the beginning of the +% line, or {\sf DocStrip} will stop here as well!. +% \begin{macrocode} + \endinput +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} + +% \section{texpicture.sty} +% A dummy style file so that documents using {\tt pspicture.sty} +% can be previewed or printed (as much as possible) using a +% dvi (not PostScript) previewer or printer driver. + +% Just change `{\tt pspicture}' to `{\tt texpicture}' in the +% |\documentstyle| options list. + +% \begin{macrocode} +%<*texsty> +% \end{macrocode} + +% \begin{macrocode} +\@warning{texpicture.sty in operation:^^J\@spaces +LaTeX document with pspicture.sty before printing} +% \end{macrocode} +% \begin{macro}{\Line} +% \begin{macro}{\Vector} +% \begin{macro}{\arrowlength} +% \begin{macro}{\Curve} +% Define all these new commands to silently gobble their arguments. +% \begin{macrocode} +\def\Line(#1,#2){} +\def\Vector(#1,#2){} +\def\arrowlength#1{} +\def\Curve(#1,#2)#3{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@badlinearg} +% If a vector or line is called with a slope specification that is not +% allowed by standard \LaTeX, |\@badlinearg| is called to produce the +% error message. We do not want to see these errors, so: +% \begin{macrocode} +\def\@badlinearg{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\oval} +% \begin{macro}{\@@v@l} +% \begin{macro}{\@@vv@l} +% Give the standard |\oval| command another optional argument (which +% will be ignored), to match the extra argument defined in {\tt +% pspicture.sty}. +% \begin{macrocode} +\let\@@v@l\oval +\def\@@@v@l[#1]{\@@v@l} +\def\oval{\@ifnextchar[{\@@@v@l}{\@@v@l}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \section{pspicture.ps} +% The PostScript header file for use with {\tt pspicture.sty}. +% Probably this should use the PostScript dictionary mechanism, to keep +% identifiers local to this package, but for now, just give them names +% begining with {\tt!}. +% \begin{macrocode} +%<*ps> +% \end{macrocode} +% +% \begin{macro}{!BP} +% PostScript uses \TeX's |bp|, that is $1/72$ of an inch, not \TeX's +% |pt|, $1/72.27$ of an inch, but it is inconvenient to get \TeX\ to +% output in |bp|, so we need to scale the PostScript. +% \begin{macrocode} +/!BP{ + 72 72.27 div dup scale + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!A} +% Arrow head:\\ +% \meta{arrow length} |!A| +% \begin{macrocode} +/!A{ + newpath + 0 0 moveto + dup neg dup .4 mul rlineto + .8 mul 0 exch rlineto + closepath + fill + } def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!V} +% |\vector(|\meta{x}|,|\meta{y}|)| \\ +% \meta{arrow length} \meta{line width} \meta{x} \meta{y} +% \meta{len*unitlength} |!V| +% \begin{macrocode} +/!V{ + !BP + /!X exch def + /!y exch def + /!x exch def + newpath + 0 0 moveto + !x 0 eq {0 !y 0 lt {!X neg}{!X} ifelse} + {!x 0 lt {!X neg}{!X}ifelse !X !y mul !x abs div} ifelse + lineto + setlinewidth % @wholewidth + currentpoint + stroke + translate + !y !x atan + rotate + !A % @arrowlength + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!L} +% |\line(|\meta{x}|,|\meta{y}|)| \\ +% \meta{arrow length} \meta{line width} \meta{x} \meta{y} +% \meta{len*unitlength} |!L| +% \begin{macrocode} +/!L{ + !BP + /!X exch def + /!y exch def + /!x exch def + newpath + 0 0 moveto + !x 0 eq {0 !y 0 lt {!X neg}{!X} ifelse} + {!x 0 lt {!X neg}{!X}ifelse !X !y mul !x abs div} ifelse + lineto + setlinewidth % @wholewidth + stroke + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!C} +% |\circle{|\meta{diam}|}| \\ +% \meta{line width} \meta{diam*unitlength} |!C| +% \begin{macrocode} +/!C{ + !BP + 0 0 3 2 roll + 2 div 0 360 arc + setlinewidth % @wholewidth + stroke + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!D} +% |\circle*{|\meta{diam}|}| \\ +% \meta{diam*unitlength} |!D| +% \begin{macrocode} +/!D{ + !BP + 0 0 3 2 roll + 2 div 0 360 arc fill + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!O} +% |\oval[|\meta{max-radius}|](|\meta{x}|,|\meta{y}|)[|\meta{tlbr}|]| \\ +% \meta{br}\meta{bl}\meta{tr}\meta{tl}\\ +% \meta{line width} \meta{max-radius*unitlength} +% \meta{x*unitlength} \meta{y*unitlength} |!O|\\ +% The first four arguments should be either $0$, denoting that that +% quarter should not be drawn, or $1$, to draw a quarter oval. +% \begin{macrocode} +/!O{ + !BP + /!y exch 2 div def + /!x exch 2 div def + /!r exch !x !y +% \end{macrocode} +% Ghostscript appears to have a {\tt min} operator, so the following 2 +% lines could be coded as {\tt min min}, but it's not in the +% Ref.~Manual, and it doesn't work on my printer! +% \begin{macrocode} + 2 copy gt {exch} if pop + 2 copy gt {exch} if pop + def + setlinewidth % @wholewidth + 1 eq + {newpath + !x neg 0 moveto + !x neg !y 0 !y !r arcto 4 {pop} repeat + 0 !y lineto + stroke}if + 1 eq + {newpath + !x 0 moveto + !x !y 0 !y !r arcto 4 {pop} repeat + 0 !y lineto + stroke}if + 1 eq + {newpath + !x neg 0 moveto + !x neg !y neg 0 !y neg !r arcto 4 {pop} repeat + 0 !y neg lineto + stroke}if + 1 eq + {newpath + !x 0 moveto + !x !y neg 0 !y neg !r arcto 4 {pop} repeat + 0 !y neg lineto + stroke}if + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!V2} +% |\Vector(|\meta{x}|,|\meta{y}|)| \\ +% \meta{arrow length} \meta{line width} \meta{x*unitlength} +% \meta{y*unitlength} |!V2| +% \begin{macrocode} +/!V2{ + !BP + 2 copy exch + atan + /a exch def + 2 copy + newpath + 0 0 moveto + lineto % + 3 2 roll + setlinewidth % @wholewidth + stroke + translate % + a rotate + !A % @arrowlength + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!L2} +% |\Line(|\meta{x}|,|\meta{y}|)| \\ +% \meta{line width} \meta{x*unitlength} \meta{y*unitlength} |!L2| +% \begin{macrocode} +/!L2{ + !BP + newpath + 0 0 moveto + lineto % + setlinewidth % @wholewidth + stroke + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{!C2} +% |\Curve(|\meta{x}|,|\meta{y}|){|\meta{$\pm$}|}| \\ +% \meta{line width} \meta{x*unitlength} \meta{y*unitlength} \meta{$\pm$} +% |!C2| +% \begin{macrocode} +/!C2{ + !BP + /!s exch def + /!y exch def + /!x exch def + newpath + 0 0 moveto + 0 0 + !x 2 div !y 10 div !s mul add + !y 2 div !x 10 div !s mul sub + !x !y + curveto + setlinewidth % @wholewidth + stroke + }def +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \end{document} +% \Finale \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/carlisle/pspicture.ins b/Master/texmf-dist/source/latex/carlisle/pspicture.ins new file mode 100644 index 00000000000..e9bad40d289 --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/pspicture.ins @@ -0,0 +1,14 @@ +\input docstrip +\keepsilent +\preamble +\endpreamble + +\askforoverwritefalse +\def\ps{\perCent!} + +\generate{\file{pspicture.sty}{\from{pspicture.dtx}{package,dvips}} +\usepostamble\empty +\usepreamble\ps + \file{pspicture.ps}{\from{pspicture.dtx}{ps}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/carlisle/typehtml.dtx b/Master/texmf-dist/source/latex/carlisle/typehtml.dtx new file mode 100644 index 00000000000..0cddf95988f --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/typehtml.dtx @@ -0,0 +1,2364 @@ +% +% \iffalse +%% +%% Source File `typehtml.dtx'. +%% Copyright (C) 1996 1997 David Carlisle +%% This file may be distributed under the terms of the LPPL. +%% See 00readme.txt for details. +%% +% +%<*dtx> + \ProvidesFile{typehtml.dtx} +% +%\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%\ProvidesPackage{typehtml} +%\ProvidesFile{typehtml.drv} +% \fi +% \ProvidesFile{typehtml.dtx} + [1997/11/19 v0.12 HTML printer (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage[html3,subsection*,bigint]{typehtml} +\DocInput{typehtml.dtx} +\end{document} +% +% \fi +% +% \GetFileInfo{typehtml.dtx} +% \begin{document} +% \title{The \textsf{typehtml} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% +% \changes{v0.01}{1996/03/06}{Initial version} +% \changes{v0.02}{1996/03/07}{Fiddling} +% \changes{v0.03}{1996/03/08}{HTML3 maths} +% \changes{v0.05}{1996/03/11} +% {change name to prevent clash with html package in latex2html} +% \changes{v0.11}{1996/03/28}{Minor improvements} +% \changes{v0.12}{1997/11/29}{Assorted changes for Bernard Gaulle, active +% french punctuation} +% \maketitle +% +% \CheckSum{2283} +% +% \section{Intoduction} +% +% This package enables the processing of HTML codes. The +% \verb|\dohtml| command +% allows fragments of HTML to be placed within a \LaTeX\ +% document, +%\begin{verbatim} +% \dohtml +% +% html markup ... +% +%\end{verbatim} +% The \verb||\ldots\verb|| is \emph{required}. (It is +% anyway a good idea to have these tags in an HTML document.) +% +% The \verb|\htmlinput| command is similar, but takes a file +% name as argument. In that case the file need not necessarily start +% and end with \verb||\ldots\verb||. +% +% This package covers most of the HTML2 DTD, together with the +% mathematics extensions from HTML3.\footnote +% {The draft specification of HTML3 has expired, and the W3C group +% are currently devising a new proposed extension of HTML, so the +% mathematics typesetting part of this package may need substantial +% revision once a final specification of the HTML mathematics markup +% is agreed.} +% The rest of HTML3 may be added at a later date. +% +% Its current incarnation has not been extensively tested, having been +% thrown together during the last couple of weeks in response to a +% question on \texttt{comp.text.tex} about the availability of such a +% package. +% +% The package falls into three sections. Firstly the options section +% allows a certain amount of customisation, and enabling of +% extensions. Not all these options are fully operational at present. +% Secondly comes a section that implements a kind of SGML parser. This +% is not a real conforming SGML parser (not even a close approximation +% to such a thing!) The assumption (sadly false in the anarchic WWW) +% is that any document will have been validated by a conforming SGML +% parser before it ever gets to the stage of being printed by this +% package. Finally are a set of declarations that essentially map the +% declarations of the HTML DTD into \LaTeX\ constructs. +% +% \section{Options} +% +% \subsection{HTML Level} +% The options \texttt{html2} (the default) and \texttt{html3} control +% HTML variant supported. Using the \texttt{html3} option will use up a +% lot more memory to support the extra features, and the math entity +% (symbol) names. Against my better judgement there is also a +% \texttt{netscape} option to allow some of the non-HTML tags accepted +% by that browser. +% +% \subsection{Headings} +% The six options \texttt{chapter}, \texttt{chapter*}, \texttt{section}, +% \texttt{section*}, \texttt{subsection} and \texttt{subsection*} +% Determine to which \LaTeX\ sectional command the HTML element +% \texttt{h1} is mapped. (\texttt{h2}--\texttt{h6} will +% automatically follow suit.) The default is \texttt{section*}. +% +% \subsection{Double Quote Handling} +% Most HTML pages use |"| as as a quotation mark in text, for +% example: +%\begin{verbatim} +% quoted "like this" example +%\end{verbatim} +% +% This slot in the ISO latin-1 encoding is for `straight' double +% quotes. Unfortunately the Standard \TeX\ fonts in the OT1 encoding +% do not have such a character, only left and right quotes, ``like +% this''. By default this package uses the \texttt{straightquotedbl} +% option which uses the \LaTeX\ command |\textquotedbl| to render +% |"|. If used with the T1 encoded fonts |\usepackage[T1]{fontenc}| +% then the straight double quote from the current font is used. With +% OT1 fonts, the double quote is taken from the |\ttfamily| font, +% which looks \texttt{"}like this\texttt{"} which is fairly +% horrible, but better than the alternative which is ''like this''. +% +% The \texttt{smartquotedbl} option redefines |"| so that it produces +% alternatively an open double quote `` then a close ''. As there is a +% chance of it becoming confused, it is reset to `` at the beginning +% of every paragraph, whatever the current mode. +% +% Neither of these options affects the use of |"| as part of the SGML +% syntax to surround attribute values. +% +% In principle the package ought to have similar options dealing with +% the single quote, but there the situation is more complicated due to +% its dual use as an apostrophe, so currently the package takes no +% special precautions: all single quotes are treated as a closing +% quote/apostrophe. Also the conventions of `open' and `close' quotes +% only really apply to English. If someone wants to suggest what the +% package should do with |"| in other languages\ldots +% +% \subsection{Images} +% The default option is \texttt{imgalt} This means that all inline +% images (the HTML \texttt{img} element) are replaced by the text +% specified by the \texttt{alt} attribute, or \textsf{[image]} if no +% such attribute is specified. +% +% The \texttt{imggif} option\footnote{one day} uses the +% \verb|\includegraphics| command so that inline images appear as +% such in the printed version. +% +% The \texttt{imgps} option\footnotemark[1] is similar to +% \texttt{imggif} but first replaces the extension \texttt{.gif} at +% the end of the source file name by \texttt{.ps}. This will enable +% drivers that can not include GIF files to be used, as long as the +% user keeps the image in both PostScript and Gif formats. +% +% \subsection{Hyperref} +% +% Several options control how the HTML anchor tag is treated. +% +% The default \texttt{nohyperref} option ignores name anchors, and +% typesets the body of src anchors using |\emph|. +% +% The \texttt{ftnhyperref} option is similar to \texttt{nohyperref}, +% but adds a footnote showing the destination address of each link, +% as specified by the SRC attribute. +% +% If the \texttt{hyperref} option is specified, the hypertext markup +% in the HTML file will be replicated using the +% hypertext specials of the Hyper\TeX\ group. If in addition the +% \textsf{hyperref} package is loaded, the extra features of that +% package may be used, for instance producing `native PDF' specials +% for direct use by Adobe distiller rather than producing the specials +% of the hyper\TeX\ conventions. +% +% The \texttt{dviwindo} option converts the hypertext information in +% the HTML into the |\special| conventions of Y\&Y's \emph{dviwindo} +% previewer for Microsoft Windows. +% +% \subsection{Big Integrals} +% \LaTeX\ does not treat integral signs as variable sized symbols, +% in the way that it treats delimiters such as brackets. In common +% with summation signs and a few other operators, they come in +% just two fixed sizes, a small version for inline mathematics, and a +% large version used in displays. In fact by default \LaTeX\ always +% uses the same two sizes (from the 10\,pt math extension font) even if +% the document class has been specified with a size option such as +% \texttt{12pt}, or if a size command such as |\large| has been used. +% +% The standard \textsf{exscale} package loads the math extension font +% at larger sizes if the current font size is larger than 10\,pt. +% +% The HTML3 math description explicitly states that integral signs +% should be treated like delimiters and stretch if applied to a large +% math expression. By default this package ignores this advice and +% treats integral signs in the standard way, however an option +% \texttt{bigint} does cause integral signs to `stretch' (or at least +% be taken from a suitably large font). The standard Computer Modern +% fonts use a very `sloped' integral which means that they are +% not really suitable for being stretched. Some other math fonts, for +% instance Lucida, have more vertical integral signs, and one could +% imagine in those cases making an integral sign with a `repeatable' +% vertical middle section so that it could grow to an arbitrary size, in +% the way that brackets grow. +% +% \section{Latin-1 characters} +% The SGML character entities for the ISO-Latin1 characters such as +% \texttt{\é} are recognised by this style, although as usual, +% some of them such as the Icelandic thorn character, +% \texttt{\þ}, \verb|\th|, produce an error if the old `OT1' +% encoded fonts are being used. These characters will print correctly +% if `T1' encoded fonts are used, for example by declaring +% \verb|\usepackage[T1]{fontenc}|~. +% +% HTML also allows direct 8-bit input of characters according to the +% ISO-latin1 encoding, to enable this you need to enable latin-1 input +% for \LaTeX\ with a declaration such as +% \verb|\usepackage[latin1]{inputenc}|~. +% +% \section{Mathematics} +% The HTML3 MATH element is fairly well supported, including the BOX +% and CLASS attributes. (Currently only CHEM value for class is +% supported, and as far as I can see the BOX attribute is only in the +% report, not in the dtd.) The super and subscripts are supported, +% including the shortref maps, however only the default right +% alignment is +% implemented so far. The convention described in the draft report +% for using white space to distinguish superscript positioning is +% fairly \emph{horrible}! +% +% +% The documentation that I could find on HTML3 did not include a full +% list of the entity names to be used for the symbols. This +% package currently \emph{only} defines the following entities, which +% should be enough for testing purposes at least. +% +% \begin{itemize} +% \item +% |gt| ($>$) |lt| ($<$) (Already in the HTML2 DTD) +% +% \item +% Some Greek letters. +% +% |alpha| ($\alpha$) +% |beta| ($\beta$) +% |gamma| ($\gamma$) +% |Gamma| ($\Gamma$) +% +% \item +% Integral and Sum. $\int$ grows large if the \texttt{bigint} package +% option is given. +% +% |int| ($\int$) +% |sum| ($\sum$) +% +% \item +% Braces (The delimiters ()[] also stretch as expected in the BOX +% element) +% +% |lbrace| ($\lbrace$) +% |rbrace| ($\rbrace$) +% +% \item +% A random collection of mathematical symbols: +% +% |times| ($\times$) +% |cup| ($\cup$) +% |cap| ($\cap$) +% |vee| ($\vee$) +% |wedge| ($\wedge$) +% |infty| ($\infty$) +% |oplus| ($\oplus$) +% |ominus| ($\ominus$) +% |otimes| ($\otimes$) +% +% \item +% A Minimal set of trig functions: +% +% |sin| ($\sin$) +% |cos| ($\cos$) +% |tan| ($\tan$) +% +% \item +% Also in the special context as attributes to ABOVE and BELOW elements +% the entities: +% +% |overbrace| ($\overbrace{\quad}$) +% |underbrace| ($\underbrace{\quad}$) and any (\TeX) math accent name. +% +% \end{itemize} +% +% \section{SGML Minimisation features} +% SGML (and hence HTML) support various minimisation features that aim +% to make it easier to enter the markp `by hand'. These features make +% the kind of `casual' attempt at parsing SGML as implemented in this +% package somewhat error prone. +% +% Two particular features are enabled in HTML. The so called SHORTTAG +% feature means that the name of a tag may be omitted if it may be +% inferred from the context. Typically in HTML this is used in +% examples like +%\begin{verbatim} +% A Document Title</> +%\end{verbatim} +% The end tag is shortened to |</>| and the system infers that +% TITLE is the element to be closed. +% +% The second form of minimisation enabled in HTML is the OMITTAG +% feature. Here a tag may be omitted altogether in certain +% circumstances. +% A typical example is the HTML list, where each list item is started +% with |<li>| but the closing |</li>| at the end of the item may be +% omitted and inferred by the following |<li>| or |</ol>| tag. +% +% This package is reasonably robust with respect to omitted +% tags. However it only makes a half hearted attempt at supporting the +% SHORTTAG feature. The TITLE example above would work, but nested +% elements, with multiple levels of minimised end tags will probably +% break this package. +% +% It would be possible to build a \LaTeX\ system that had full +% knowledge of the HTML (or any other) DTD and in particular the +% `content model' of every element, this would produce a more robust +% parsing system but would take longer than I was prepared to +% spend this week\ldots\ In anycase if you need a fully conforming SGML +% parser, it probably makes sense to use an existing one (excellent +% free parsers are freely available) and then convert the output of +% the parser to a form suitable for \LaTeX. In that way all such +% concerns about SGML syntax features such as minimisation will have +% been resolved by the time \LaTeX\ sees the document. +% +% \section{Examples} +% \let\olddohtml\dohtml +% \def\dohtml{\olddohtml\MakePercentIgnore} +% +% +% \subsection{A section} +% This document uses the \texttt{subsection*} option. +%\begin{verbatim} +% <h1>HTML and LaTeX</h1> +%\end{verbatim} +% \dohtml +% <html> +% <h1>HTML and LaTeX</h1> +% </html> +% +% \subsection{An itemised list} +%\begin{verbatim} +% <ul> +% <li> something +% <li> something else +% </ul> +%\end{verbatim} +% \dohtml +% <html> +% <ul> +% <li> something +% <li> something else +% </ul> +% </html> +% +% \subsection{Latin1 Characters} +%\begin{verbatim} +% é ö +%\end{verbatim} +% \dohtml +% <html> +% é ö +% </html> +% +% \subsection{Images} +% Currently only the ALT attribute is supported. +%\begin{verbatim} +% This is an image of me <img alt="DPC" src="dpc.gif"> +%\end{verbatim} +% \dohtml +% <html> +% This is an image of me <img alt="DPC" src="dpc.gif"> +% </html> +% +% \subsection{A Form} +%\begin{verbatim} +% <form +% action="http://www.cogs.susx.ac.uk/cgi-bin/ltxbugs2html" +% method=get><hr> +% You can search for all the bug reports about: <select name="category"> +% <option>AMS LaTeX</option> +% <option>Babel</option> +% <option>Graphics and colour</option> +% <option>LaTeX</option> +% <option selected>Metafont fonts</option> +% <option>PostScript fonts</option> +% <option>Tools</option> +% </select> +% <hr> +% </form> +%\end{verbatim} +% \dohtml +% <html> +% <form +% action="http://www.cogs.susx.ac.uk/cgi-bin/ltxbugs2html" +% method=get><hr> +% You can search for all the bug reports about: <select name="category"> +% <option>AMS LaTeX</option> +% <option>Babel</option> +% <option>Graphics and colour</option> +% <option>LaTeX</option> +% <option selected>Metafont fonts</option> +% <option>PostScript fonts</option> +% <option>Tools</option> +% </select> +% <hr> +% </form> +% </html> +% +% \subsection{Styles of Mathematics} +%\begin{verbatim} +% <math> +% H_2_O + CO_2_ +% </math> +% <math class=chem> +% H_2_O + CO_2_ +% </math> +% <math box> +% H_2_O + CO_2_ +% </math> +% <math class=chem box> +% H_2_O + CO_2_ +% </math> +%\end{verbatim} +% \dohtml +% <html> +% <math> +% H_2_O + CO_2_ +% </math> +% <math class=chem> +% H_2_O + CO_2_ +% </math> +% <math box> +% H_2_O + CO_2_ +% </math> +% <math class=chem box> +% H_2_O + CO_2_ +% </math> +% </html> +% +% \subsection{Integrals} +% Stretchy integrals with the \texttt{bigint} option. +%\begin{verbatim} +% <math> +% {∫^1^_3_<left> +% 1 +% <over> +% {x+{1<over>x+{2<over>x+ +% {3<over>x+{4<over>x}}}}} +% <right>dx} +% </math> +%\end{verbatim} +% \dohtml +% <html> +% <math> +% {∫^1^_3_<left> +% 1 +% <over> +% {x+{1<over>x+{2<over>x+ +% {3<over>x+{4<over>x}}}}} +% <right><t>d</t> x} +% </math> +% </html> +% And the same integral with the standard integral sign. +% \begingroup +% \makeatletter +% \let\HTML@bigint\int +% \dohtml +% <html> +% <math> +% {∫^1^_3_<left> +% 1 +% <over> +% {x+{1<over>x+{2<over>x+ +% {3<over>x+{4<over>x}}}}} +% <right><t>d</t>x} +% </math> +% </html> +% \endgroup +% +% \subsection{Oversized delimiters} +%\begin{verbatim} +% <math> +% <box>(<left>1 <atop> 2 <right>)</box> +% <box size=large>(<left>1 <atop> 2 <right>)</box> +% </math> +%\end{verbatim} +% \dohtml +% <html> +% <math> +% <box>(<left>1 <atop> 2 <right>)</box> +% <box size=large>(<left>1 <atop> 2 <right>)</box> +% </math> +% </html> +% +% \subsection{Roots, Overbraces etc} +%\begin{verbatim} +% <math> +% <above sym=overbrace> abc </above><sup>k</sup> +%   +% <root>3<of>x</root> +% <sqrt>5</sqrt> +%   +% <below sym=underline> abc </below> +% <above sym=widehat> abc </above> +% </math> +%\end{verbatim} +% \dohtml +% <html> +% <math> +% <above sym=overbrace> a bc </above><sup>k</sup> +%   +% <root>3<of>x</root> +% <sqrt>5</sqrt> +%   +% <below sym=underline> abc </below> +% <above sym=widehat> abc </above> +% </math> +% </html> +% +% \subsection{Arrays} +% +%\begin{verbatim} +% <math> +% aa<array align=top> +% <row><item><text>first col</text><item><text>second col</text><item> +% <text>third col</text><item><text>fourth col</text> +% <row><item><text>row 2</text><item> a_22_ <item>a_23_<item>a_24_ +% <row><item><text>row 3</text><item rowspan=3 colspan=2> +% a_32_-a_53_<item>a_34_ +% <row><item><text>row 4</text><item>a_44_ +% <row><item><text>row 5</text><item>a_54_ +% <row><item><text>row 6</text><item align=left> +% al_62_<item>a_63_<item>a_64_ +% <row><item><text>row 7</text><item align=right> +% ar_72_<item>a_73_<item>a_74_ +% </array>bb +% </math> +%\end{verbatim} +% +% \dohtml +% <html> +% <math> +% aa<array align=top> +% <row><item><text>first col</text><item><text>second col</text><item> +% <text>third col</text><item><text>fourth col</text> +% <row><item><text>row 2</text><item> a_22_ <item>a_23_<item>a_24_ +% <row><item><text>row 3</text><item rowspan=3 colspan=2> +% a_32_-a_53_<item>a_34_ +% <row><item><text>row 4</text><item>a_44_ +% <row><item><text>row 5</text><item>a_54_ +% <row><item><text>row 6</text><item align=left> +% al_62_<item>a_63_<item>a_64_ +% <row><item><text>row 7</text><item align=right> +% ar_72_<item>a_73_<item>a_74_ +% </array>bb +% </math> +% </html> +% +% Repeat that element, but change the ARRAY attributes as follows: +%\begin{verbatim} +% <array ldelim="(" rdelim=")" labels> +%\end{verbatim} +% +% \dohtml +% <html> +% <math> +% aa<array ldelim="(" rdelim=")" labels> +% <row><item><text>first col</text><item><text>second col</text><item> +% <text>third col</text><item><text>fourth col</text> +% <row><item><text>row 2</text><item> a_22_ <item>a_23_<item>a_24_ +% <row><item><text>row 3</text><item rowspan=3 colspan=2> +% a_32_-a_53_<item>a_34_ +% <row><item><text>row 4</text><item>a_44_ +% <row><item><text>row 5</text><item>a_54_ +% <row><item><text>row 6</text><item align=left> +% al_62_<item>a_63_<item>a_64_ +% <row><item><text>row 7</text><item align=right> +% ar_72_<item>a_73_<item>a_74_ +% </array>bb +% </math> +% </html> +% +% and finally an example of COLSPEC +%\begin{verbatim} +% <math> +% <array colspec="R+C=L"> +% <row><item>abc_11_<item>abc_12_<item>abc_13_ +% <row><item>a_21_<item>a_22_<item>a_23_ +% <row><item>a_31_<item>a_32_<item>a_33_ +% </array> +% </math> +%\end{verbatim} +% +% \dohtml +% <html> +% <math> +% <array colspec="R+C=L"> +% <row><item>abc_11_<item>abc_12_<item>abc_13_ +% <row><item>a_21_<item>a_22_<item>a_23_ +% <row><item>a_31_<item>a_32_<item>a_33_ +% </array> +% </math> +% </html> +% +% \subsection{Tables} +% HTML3 tables are not yet supported, but there is a minimal ammount to +% catch simple cases. +% +%\begin{verbatim} +% <table> +% <caption>Simple Table</caption> +% <tr><td>one <td> two +% <tr><td>a <td> b +% </table> +%\end{verbatim} +% +% \dohtml +% <html> +% <table> +% <caption>Simple Table</caption> +% <tr><td>one <td> two +% <tr><td>a <td> b +% </table> +% </html> +% +% \StopEventually{} +% +% \section{The Code} +% +% \subsection{Option Handling} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{html2}{\let\HTML@two@stop\endinput} +% \end{macrocode} +% +% The |#| here, and in later option code will need doubling +% if you are using a \LaTeX\ before June 95. +% \begin{macrocode} +\DeclareOption{netscape} + {\def\HTML@not#1{\SGML@w{<#1> is not valid HTML}}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{html3}{\let\HTML@two@stop\relax} +% \end{macrocode} +% +% \changes{v0.08}{1996/03/16}{Add nohyperref option} +% \begin{macrocode} +\DeclareOption{nohyperref}{% + \let\HTML@doname\@secondoftwo + \def\HTML@dosrc#1#2{\emph{#2}}} +% \end{macrocode} +% +% \changes{v0.08}{1996/03/16}{Add ftnhyperref option} +% \begin{macrocode} +\DeclareOption{ftnhyperref}{% + \let\HTML@doname\@secondoftwo + \def\HTML@dosrc#1#2{\emph{#2}\footnote{HREF: \texttt{#1}}}} +% \end{macrocode} +% +% \changes{v0.08}{1996/03/16} +% {make hyperref independent of hyperref package} +% \begin{macrocode} +\DeclareOption{hyperref}{% + \AtBeginDocument{% + \providecommand\href[2]{\special{html:<A href="#1">}% + #2\special{html:</A>}}% + \providecommand\hypertarget[2]{\special{html:<A name="#1">}% + #2\special{html:</A>}}% + \let\HTML@doname\hypertarget + \let\HTML@dosrc\href}} +% \end{macrocode} +% +% \changes{v0.08}{1996/03/16}{Add dviwindo option} +% Dviwindo itself deals with links within a document i.e., a src +% attribute of the form |"#name"|. The code below detects +% a more general URL and fires a |launch:| action from the |\special|, +% which calls the non-existant command \texttt{typehtml}. Presumably +% this could be a batch file that calls netscape or some other WWW +% engine to process the URL. +% \begin{macrocode} +\DeclareOption{dviwindo}{% + \def\HTML@dosrc#1#2{{% + \leavevmode\sbox\z@{#2}\count@\ht\z@\@tempcnta\wd\z@ + \if\string##\@car#1\@nil + \special{button: \the\@tempcnta\space\the\count@\space + "\@gobble#1"}% + \else + \special{button: \the\@tempcnta\space\the\count@\space + launch: typehtml "#1"} + \fi + \special{color push}\special{color rgb 0 1 0}% + \unhbox\z@ + \special{color pop}}}% + \def\HTML@doname#1#2{\leavevmode\special{mark: "#1"}#2}}% +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{imgalt}{} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{imggif}{\SGML@w{img gif support not done yet}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{imgps}{\SGML@w{img ps support not done yet}} +% \end{macrocode} +% +% \changes{v0.10}{1996/03/25}{Add double quote handling} +% \begin{macrocode} +\DeclareOption{smartquotedbl}{% + \def\SGMLquotedbla{% + \textquotedblleft\global\let\SGMLquotedbl\SGMLquotedblb} + \def\SGMLquotedblb{% + \textquotedblright\global\let\SGMLquotedbl\SGMLquotedbla} + \let\SGMLquotedbl\SGMLquotedbla + \let\SGML@savedeverypar\everypar + \newtoks\everypar + \SGML@savedeverypar{% + \global\let\SGMLquotedbl\SGMLquotedbla\the\everypar}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{straightquotedbl}{% + \DeclareTextCommandDefault{\textquotedbl}{{\ttfamily\char`\"}}% + \let\SGMLquotedbl\textquotedbl} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{chapter}{% + \def\HTML@headings{% + \chapter\section\subsection% + \subsubsection\paragraph\subparagraph}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{chapter*}{% + \def\HTML@headings{% + {\chapter*}{\section*}{\subsection*}% + {\subsubsection*}{\paragraph*}{\subparagraph*}}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{section}{% + \def\HTML@headings{% + \section\subsection% + \subsubsection\paragraph\subparagraph\endgraf}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{section*}{% + \def\HTML@headings{% + {\section*}{\subsection*}% + {\subsubsection*}{\paragraph*}{\subparagraph*}\endgraf}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{subsection}{% + \def\HTML@headings{% + \subsection% + \subsubsection\paragraph\subparagraph\endgraf\endgraf}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{subsection*}{% + \def\HTML@headings{% + {\subsection*}% + {\subsubsection*}{\paragraph*}{\subparagraph*}\endgraf\endgraf}} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{bigint}{% + \let\HTML@int\int + \AtEndOfPackage{\RequirePackage{exscale}}} +% \end{macrocode} +% +% \changes{v0.08}{1996/03/16}{Make unnumbered sections the default} +% \begin{macrocode} +\ExecuteOptions{section*,imgalt,html2,nohyperref,straightquotedbl} +% \end{macrocode} +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% \subsection{Fake SGML parser} +% +% \begin{macrocode} +\begingroup +% \end{macrocode} +% +% \changes{v0.12}{1997/11/29}{activate gtr and semicolon} +% \begin{macrocode} +\catcode`\<=\active +\catcode`\>=\active +\catcode`\&=\active +\catcode`\$=\active +\catcode`\"=\active +\catcode`\^=\active +\catcode`\_=\active +\catcode`\;=\active +\catcode`\A=\active +\catcode`\B=\active +\catcode`\C=\active +\catcode`\D=\active +% \end{macrocode} +% \changes{v0.12}{1997/11/29}{\cs{uppercase} not \cs{lowercase}} +% \begin{macrocode} +\uccode`\A=`\{% +\uccode`\B=`\}% +% \end{macrocode} +% \changes{v0.10}{1996/03/25}{Swap round lccodes of C and D} +% \changes{v0.10}{1996/03/25}{Add double quote handling} +% \begin{macrocode} +\uccode`\C=`\|% +\uccode`\D=`\\% +% \end{macrocode} +% +% \begin{macrocode} +\uppercase{\endgroup +% \end{macrocode} +% +% \begin{macro}{\SGMLent@@} +% \changes{v0.12}{1997/11/29}{delimit with active semicolon and gtr} +% \begin{macrocode} +\def\SGMLent@@#1;{\csname SGML@E@#1\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLent@@} +% \changes{v0.12}{1997/11/29}{macro added} +% \begin{macrocode} +\def\SGML@def@active#1>{% + \expandafter\def\csname SGML@#1\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\dohtml{% + \begingroup + \ifx;\@undefined\expandafter\let\expandafter;\string;\fi + \ifx>\@undefined\expandafter\let\expandafter>\string>\fi + \catcode`\<=\active + \catcode`\>=\active + \catcode`\&=\active + \catcode`\{=\active + \catcode`\}=\active + \catcode`\$=\active + \catcode`\"=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\\=\active + \catcode`\|=\active + \catcode\endlinechar=10 + \catcode`\%=12 + \catcode`\#=12 + \catcode`\;=\active + \def\verbatim@nolig@list{\do\`\do\,\do\'\do\-} + \def<{\SGMLopen}% + \def&{\SGMLent}% + \let^\textasciicircum + \let~\textasciitilde + \def_{\_}% + \let$\$% + \def"{\SGMLquotedbl}% + \def A{\{}% + \def B{\}}% + \def C{\texttt{|}}% + \def D{\texttt{\char`\\}}% +% \end{macrocode} +% \changes{v0.07}{1996/03/15}{macro added} +% Need to be careful about writing to table of contents. +% \begin{macrocode} + \def\addcontentsline##1##2##3{% + {\def<{\string<}\def&{\string&}% + \addtocontents{##1}{\protect\dotochtml<html>}% + \addtocontents{##1}{\protect\contentsline{##2}{##3}{\thepage}}% + \addtocontents{##1}{\protect</html>}}}} +% \end{macrocode} +% +% \begin{macro}{\dotochtml} +% A `compromise' version of |\dohtml| for use in table of contents +% files. +% Allows HTML markup |<|, |&| etc, but also \TeX\ markup |\|, |{|, |}|. +% As these are incompatible, this is not 100\% reliable but it seems to +% cover most cases in practice. +% \changes{v0.07}{1996/03/15}{macro added} +% \begin{macrocode} +\def\dotochtml{% + \dohtml + \catcode`\\\z@ + \catcode`\{\@ne + \catcode`\}\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLshortend} +% \changes{v0.04}{1996/03/09}{macro added} +% \begin{macrocode} +\def\SGMLshortend{/} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLgrab@} +% \begin{macrocode} +\def\SGMLgrab@#1<#2>{% + \edef\@tempd{\lowercase{\def\noexpand\@tempd{\gobblespc#2 \relax}}}% + \@tempd +% \end{macrocode} +% +% \changes{v0.04}{1996/03/09}{SHORTTAG support} +% \begin{macrocode} + \ifx\@tempd\SGMLshortend\let\@tempd\@tempc\fi +% \end{macrocode} +% +% \begin{macrocode} + \ifx\@tempb\@tempd + \advance\@tempcnta\@ne + \else + \ifx\@tempc\@tempd + \advance\@tempcnta\m@ne + \fi + \fi + \ifnum\@tempcnta=\z@ + \expandafter\@tempa\expandafter{\the\@temptokena#1}% + \else + \addto@hook\@temptokena{#1<#2>}% + \expandafter\SGMLgrab@ + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLopen} +% \changes{v0.10}{1996/03/25}{Add double quote handling} +% \changes{v0.12}{1997/11/29}{delimit with active gtr} +% \begin{macrocode} +\def\SGMLopen#1>{% + \SGMLopen@#1 \@nil} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% \begin{macro}{\htmlinput} +% \begin{macrocode} +\def\htmlinput#1{\dohtml\let\@endhtml\relax\input{#1}\endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gobblespc} +% \begin{macrocode} +\def\gobblespc#1 #2\relax{#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLgrabber} +% \begin{macrocode} +\def\SGMLgrabber#1#2{% + \def\@tempa{#2}% + \@tempcnta\@ne + \@temptokena{}% + \lowercase{\def\@tempb{#1}\def\@tempc{/#1}}% + \SGMLgrab@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLopen@} +% \changes{v0.07}{1996/03/15}{macro added} +% \begin{macrocode} +\begingroup +\catcode`\"=\active +\uppercase{\endgroup +\def\SGMLopen@#1 #2\@nil{% + \toks@{}% + \edef\@tempa{\lowercase{\def\noexpand\SGMLelement{#1}}}\@tempa + \if!\@car#1\relax\@nil + \toks@{#1 #2}% + \SGML@w{Declaration ignored\MessageBreak<\the\toks@>\MessageBreak}% + \else + \if$#2$\else + \replacequotes#2"\@nil"% + \SGMLafterfi + \expandafter\toks@\expandafter{\expandafter}% + \expandafter\SGMLgetattrib\the\toks@ \@nil + \fi + \expandafter\ifx\csname SGML@\SGMLelement + \expandafter\endcsname\relax + \SGML@w{<\SGMLelement> undefined}% + \else + \csname SGML@\SGMLelement + \expandafter\expandafter\expandafter\endcsname + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\replacequotes} +% \begin{macrocode} +\def\replacequotes#1"#2"{% + \def\@tempb{#2}% + \ifx\@tempb\@nnil + \addto@hook\toks@{#1}% + \else + \addto@hook\toks@{#1{#2}}% + \expandafter\replacequotes + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLafterfi} +% \begin{macrocode} +\def\SGMLafterfi#1\fi{\fi#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLgobbletofi} +% \begin{macrocode} +\def\SGMLgobbletofi#1\fi{\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLgetattrib} +% \changes{v0.10}{1996/03/25}{use dollar to distingish empty value} +% \begin{macrocode} +\def\SGMLgetattrib#1 #2{% + \ifx\box#1\box\else + \SGMLgetval#1=$=\@nil + \def\@tempa{#2}% + \ifx\@tempa\@nnil + \expandafter\SGMLgobbletofi + \else + \expandafter\SGMLafterfi + \fi + \SGMLgetattrib#2% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLgetval} +% \changes{v0.08}{1996/03/16}{lowercase attribute names} +% If no value was supplied |#2| will be |$| (Even if the value is |$| +% The test is false, as that would be catcode 13. Done this way rather +% than looking for empty to distinguish |alt=""| with empty value. +% \begin{macrocode} +\def\SGMLgetval#1=#2=#3\@nil{% + \ifcat$#2% + \lowercase{\SGML@addattrib\doimplied{#1}}% + \else + \lowercase{\SGML@addattrib{\do{#1}}}{#2}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGML@addattrib} +% \changes{v0.08}{1996/03/16}{macro added} +% \begin{macrocode} +\def\SGML@addattrib#1#2{\addto@hook\toks@{#1{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGML@w} +% \begin{macrocode} +\def\SGML@w{\PackageWarning{typehtml}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLdef} +% \changes{v0.12}{1997/11/29}{allow active delimiters} +% \begin{macrocode} +\def\SGMLdef#1{% + \ifcat\noexpand#1\noexpand~% + \expandafter\SGML@def@active + \else + \expandafter\SGML@def + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLdef} +% \changes{v0.12}{1997/11/29}{macro added} +% make sure this is a catcode 12 |>|. +% \begin{macrocode} +\edef\@tempa{\def\noexpand\SGML@def##1\string>}\@tempa{% + \expandafter\def\csname SGML@#1\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLent} +% \begin{macrocode} +\expandafter\def\expandafter\SGMLent\expandafter{% + \expandafter\protect\csname& \endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{& } +% \begin{macrocode} +\expandafter\def\csname& \endcsname{% + \futurelet\@let@token\SGMLent@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLent@} +% \begin{macrocode} +\def\SGMLent@{% + \ifx\@let@token\@sptoken + \&% + \else + \expandafter\SGMLent@@ + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGMLentity} +% \begin{macrocode} +\def\SGMLentity#1{% + \expandafter\def\csname SGML@E@#1\endcsname} +% \end{macrocode} +% \end{macro} +% +% \subsection{The HTML2 DTD} +% +% \begin{macrocode} +\SGMLdef<html>{} +\SGMLdef</html>{\@endhtml} +\let\@endhtml\endgroup +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<title>{\typeout{***TITLE***}\SGMLgrabber{title}\typeout} +% \end{macrocode} +% +% \begin{macrocode} +\long\def\@tempa#1#2#3#4#5#6{% + \SGMLdef<h1>{\SGMLgrabber{h1}{\HTMLsection{#1}}}% + \SGMLdef<h2>{\SGMLgrabber{h2}{\HTMLsection{#2}}}% + \SGMLdef<h3>{\SGMLgrabber{h3}{\HTMLsection{#3}}}% + \SGMLdef<h4>{\SGMLgrabber{h4}{\HTMLsection{#4}}}% + \SGMLdef<h5>{\SGMLgrabber{h5}{\HTMLsection{#5}}}% + \SGMLdef<h6>{\SGMLgrabber{h6}{\HTMLsection{#6}}}} +% \end{macrocode} +% +% \begin{macrocode} +\expandafter\@tempa\HTML@headings +% \end{macrocode} +% +% \begin{macrocode} +\def\HTMLsection#1#2{#1{\ignorespaces#2\unskip}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<head>{} +\SGMLdef</head>{} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<body>{} +\SGMLdef</body>{} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<bodytext>{} +\SGMLdef</bodytext>{} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<p>{\par} +\SGMLdef</p>{\par} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<blockquote>{\begin{quote}} +\SGMLdef</blockquote>{\end{quote}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<address>{\begin{quote}} +\SGMLdef</address>{\end{quote}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<ul>{\begin{itemize}} +\SGMLdef</ul>{\end{itemize}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<ol>{\begin{enumerate}} +\SGMLdef</ol>{\end{enumerate}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<li>{\item} +\SGMLdef</li>{} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<dl>{% + \let\do\dldo + \let\doimplied\dlimplied + \begin{description}\the\toks@} +\SGMLdef</dl>{\end{description}} +% \end{macrocode} +% +% \begin{macrocode} +\def\dldo#1#2{% + \def\@tempa{compact}\def\@tempb{#1}% + \ifx\@tempa\@tempb + \itemsep\z@ + \advance\@totalleftmargin-\leftmargin + \advance\linewidth\leftmargin + \itemindent-\labelsep + \leftmargin\z@ + \parshape \@ne \@totalleftmargin \linewidth + \fi} +\def\dlimplied#1{\dldo{#1}\relax} +% \end{macrocode} +% +% \begin{macrocode} +\def\itx#1{\item[#1]} +\SGMLdef<dt>{\begin{lrbox}\z@\bfseries\let\maybeenddt\enddt} +\SGMLdef</dt>{\maybeenddt} +\SGMLdef<dd>{\maybeenddt} +\SGMLdef</dd>{} +\def\enddt{\end{lrbox}\item[\unhbox\z@]} +\let\maybeenddt\relax +% \end{macrocode} +% +% \changes{v0.07}{1996/03/15}{hyperref support (SPQR)} +% \begin{macrocode} +\SGMLdef<a>{\SGMLgrabber{a}\HTML@anchor} +% \end{macrocode} +% +% \begin{macro}{\HTML@anchor} +% This handles the A tag. +% \changes{v0.04}{1996/03/09}{macro added} +% \begin{macrocode} +\def\HTML@anchor#1{{% + \let\@tempa\@gobble + \def\_{\string_}% + \let\do\ado + \the\toks@ + \@tempa{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ado} +% Thanks to SPQR for first pass at integrating \textsf{hyperref}. +% \begin{macrocode} +\def\ado#1#2{% + \def\@tempb{name}\def\@tempc{#1}% + \ifx\@tempb\@tempc + \let\@tempa\@firstofone + \def\@tempa{\HTML@doname{#2}}% + \else + \def\@tempa{\HTML@dosrc{#2}}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \changes{v0.03}{1996/03/08}{pre is alltt not verbatim} +% \begin{macrocode} +\SGMLdef<pre>{% + \par + \begingroup + \parindent\z@ + \obeylines\verbatim@font\@noligs + \frenchspacing\@vobeyspaces} +% \end{macrocode} +% +% +% \begin{macrocode} +\SGMLdef</pre>{\endgroup} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<tt>{\SGMLgrabber{tt}\texttt} +\SGMLdef<b>{\SGMLgrabber{b}\textbf} +\SGMLdef<i>{\SGMLgrabber{i}\textit} +\SGMLdef<em>{\SGMLgrabber{em}\emph} +\SGMLdef<strong>{\SGMLgrabber{strong}\textbf} +\SGMLdef<code>{\SGMLgrabber{code}\texttt} +\SGMLdef<samp>{\SGMLgrabber{samp}\textsf} +\SGMLdef<kbd>{\SGMLgrabber{kbd}\texttt} +\SGMLdef<var>{\SGMLgrabber{var}\textit} +\SGMLdef<cite>{\SGMLgrabber{cite}\textit} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<form>{\par\medskip} +\SGMLdef</form>{\par\medskip} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<select>{% + \let\do\selectdo + \the\toks@\par + \begin{tabular}{|l|}% + \hline\@tempc\\\hline + \let\tabularnewline\relax + \ignorespaces} +% \end{macrocode} +% +% \begin{macrocode} +\def\selectdo#1#2{% + \def\@tempa{name}\def\@tempb{#1}% + \ifx\@tempa\@tempb\def\@tempc{#2}\fi} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef</select>{\\\hline\end{tabular}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<option>{% + \gdef\optionbul{\phantom{$\bullet$}}% + \let\do\optiondo + \let\doimplied\optionimplied + \the\toks@ + \tabularnewline + \let\tabularnewline\\% + \optionbul\space\ignorespaces} +\SGMLdef</option>{} +% \end{macrocode} +% +% \begin{macro}{\optiondo} +% Handle attributes to the OPTION element. +% \begin{macrocode} +\def\optiondo#1#2{% + \def\@tempa{selected}\def\@tempb{#1}% + \ifx\@tempa\@tempb\gdef\optionbul{$\bullet$}\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\optionimplied} +% Handle the case where just the attribute value is given. +% \begin{macrocode} +\def\optionimplied#1{% + \def\@tempa{selected}\def\@tempb{#1}% + \ifx\@tempa\@tempb\gdef\optionbul{$\bullet$}\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\SGMLdef<input>{} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<img>{{% + \let\do\imgdo + \def\@tempa{\doimage}% + \the\toks@ + \@tempa}} +% \end{macrocode} +% +% \begin{macrocode} +\def\doimage{\textsf{[image]}} +% \end{macrocode} +% +% \begin{macro}{\imgdo} +% Handle IMG attributes (not very usefully) +% \begin{macrocode} +\def\imgdo#1{\csname img=#1\endcsname} +\expandafter\def\csname img=align\endcsname#1{% + \SGML@w{align=#1 ignored}} +\expandafter\def\csname img=src\endcsname#1{% + \SGML@w{src=#1 ignored}} +\expandafter\def\csname img=height\endcsname#1{% + \SGML@w{height=#1 ignored}} +\expandafter\def\csname img=alt\endcsname#1{% + \def\doimage{#1}} +% \end{macrocode} +% \end{macro} +% +% Horizontal rules and line breaks. +% \changes{v0.12}{1997/11/29}{BR in vertical mode allowed.} +% \begin{macrocode} +\SGMLdef<hr>{\par\smallskip\hrule\smallskip} +\SGMLdef<br>{\leavevmode\\} +% \end{macrocode} +% +% These are obsolete in HTML3 but do them anyway. +% \changes{v0.10}{1996/03/25}{XMP and LISTING and PLAINTEXT added} +% \begin{macrocode} +\SGMLdef<xmp>{% + \SGML@pre + \def\@tempb{/xmp}% + \let\SGMLopen\HTML@xmptest} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<listing>{% + \SGML@xmp + \def\@tempb{/listing}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<plaintext>{% + \SGML@xmp + \def\@tempb{/plaintext}}% +% \end{macrocode} +% +% \begin{macro}{\HTML@xmptest} +% \begin{macrocode} +\def\HTML@xmptest#1>{% + \lowercase{\def\@tempa{#1}}% + \ifx\@tempa\@tempb + \endgroup + \else + \SGMLafterfi + <#1>% + \fi} +% \end{macrocode} +% \end{macro} +% +% +% SGML syntax Character entities. +% \begin{macrocode} +\SGMLentity{amp}{\&} +\SGMLentity{lt}{\ensuremath{<}} +\SGMLentity{gt}{\ensuremath{>}} +% \end{macrocode} +% +% ISO Latin-1 Character entities. +% \begin{macrocode} +\SGMLentity{aacute}{\'a} +\SGMLentity{Aacute}\'A{} +\SGMLentity{acirc}{\^a} +\SGMLentity{Acirc}{\^A} +\SGMLentity{agrave}{\`a} +\SGMLentity{Agrave}{\`A} +\SGMLentity{aring}{\r a} +\SGMLentity{Aring}{\r A} +\SGMLentity{atilde}{\~a} +\SGMLentity{Atilde}{\~A} +\SGMLentity{auml}{\"a} +\SGMLentity{Auml}{\"A} +\SGMLentity{aelig}{\ae} +\SGMLentity{AElig}{\AE} +\SGMLentity{ccedil}{\c c} +\SGMLentity{Ccedil}{\c C} +\SGMLentity{eth}{\dh} +\SGMLentity{ETH}{\DH} +\SGMLentity{eacute}{\'e} +\SGMLentity{Eacute}{\`E} +\SGMLentity{ecirc}{\^e} +\SGMLentity{Ecirc}{\^E} +\SGMLentity{egrave}{\`e} +\SGMLentity{Egrave}{\`E} +\SGMLentity{euml}{\"e} +\SGMLentity{Euml}{\"E} +\SGMLentity{iacute}{\'\i} +\SGMLentity{Iacute}{\'I} +\SGMLentity{icirc}{\^\i} +\SGMLentity{Icirc}{\^I} +\SGMLentity{igrave}{\`\i} +\SGMLentity{Igrave}{\`I} +\SGMLentity{iuml}{\"\i} +\SGMLentity{Iuml}{\"I} +\SGMLentity{ntilde}{\~n} +\SGMLentity{Ntilde}{\~N} +\SGMLentity{oacute}{\'o} +\SGMLentity{Oacute}{\'O} +\SGMLentity{ocirc}{\^o} +\SGMLentity{Ocirc}{\^O} +\SGMLentity{ograve}{\`o} +\SGMLentity{Ograve}{\`O} +\SGMLentity{oslash}{\oe} +\SGMLentity{Oslash}{\OE} +\SGMLentity{otilde}{\~o} +\SGMLentity{Otilde}{\~O} +\SGMLentity{ouml}{\"o} +\SGMLentity{Ouml}{\"O} +\SGMLentity{szlig}{\ss} +\SGMLentity{thorn}{\th} +\SGMLentity{THORN}{\TH} +\SGMLentity{uacute}{\'u} +\SGMLentity{Uacute}{\'U} +\SGMLentity{ucirc}{\^u} +\SGMLentity{Ucirc}{\^U} +\SGMLentity{ugrave}{\`u} +\SGMLentity{Ugrave}{\`U} +\SGMLentity{uuml}{\"u} +\SGMLentity{Uuml}{\"U} +\SGMLentity{yacute}{\'y} +\SGMLentity{Yacute}{\'Y} +\SGMLentity{yuml}{\"y} +% \end{macrocode} +% +% \subsection{Netscape Non-HTML tags} +% +% Netscape allows certain tags that do not correspond to HTML elements. +% These are \emph{Bad Thing}. Originally the documentation of this +% package stated that such `extensions' would not be supported, however +% as a request came from \ldots\ldots\footnote{Name withheld to +% protect the guilty} who also supplied most of the code in this +% section (and also the table section), I have added some support +% which is enabled if the \texttt{netscape} option is used. +% \begin{macrocode} +\ifx\HTML@not\@undefined\else +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Do something with bad reprehensible nonstandard tags +% that have the annoying habit of turning up often in html files that +% I want to print. [mjd,1996/03/20] +% +% |\HTML@not| is defined above in the netscape option: +% Naughty Nonstandard Extension Warning for things like +% |<center>| and |<font>|. (I thought these were +% Netscape-specific but the technical notes at Spyglass's web site +% showed that I was wrong. [mjd,1996/03/20]) +% \begin{macrocode} +\SGMLdef<center>{\HTML@not{center}\begin{center}} +\SGMLdef</center>{\end{center}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<blink>{\SGMLgrabber{blink}\textbf} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<font>{\HTML@not{font}\begingroup + \let\do\fontdo\the\toks@} +\SGMLdef</font>{\endgroup} +% \end{macrocode} +% |\fontdo| must look at the first character of the `size, value to see +% if it is a relative size change (|+| or |-|). Otherwise it is an +% absolute size change. +% \begin{macrocode} +\def\fontdo#1#2{% + \def\@tempa{size}\def\@tempb{#1}% + \ifx\@tempa\@tempb + \font@switch#2\relax\@nil + \fi} +% \end{macrocode} +% +% Let's hack a nice little hook into |\@setfontsize| (tsk tsk). +% If we can set the current font size number there, it makes the rest +% of the job much easier. +% \begin{macrocode} +\toks@\expandafter{\set@fontsize{#1}{#2}{#3}} +\edef\@tempa{% + \def\noexpand\set@fontsize##1##2##3{\the\toks@\noexpand\set@fontnum}} +\@tempa +% \end{macrocode} +% +% Take |\f@size| which is a real number, convert it to an integer, +% and normalize to the desired range. +% \begin{macrocode} +\def\set@fontnum{\dimen@\f@size\p@ + \dimen@\mul@ptsize\dimen@ + \count@\dimen@ \divide\count@\p@ + \advance\count@ -5\relax + \edef\@fontnum{\number\count@}} +% \end{macrocode} +% +% Nice consistent naming conventions as always. +% multiplier if 11pt or 12pt documentclass option is used +% \begin{macrocode} +\def\mul@ptsize{}% +% \end{macrocode} +% +% 5 = |\normalsize| I think +% \begin{macrocode} +\def\@fontnum{5} +% \end{macrocode} +% +% Initialize |\mul@ptsize| +% \begin{macrocode} +\ifcase 0\@ptsize\relax + \global\let\mul@ptsize\@empty% case 0, ptsize = 10 + \or\gdef\mul@ptsize{.9091}% case 1, ptsize = 11 + \else\gdef\mul@ptsize{.8333}% case 2, ptsize = 12 +\fi +% \end{macrocode} +% +% |\font@switch| looks for |+| or |-| and selects a suitable fontsize +% command. +% \begin{macrocode} +\def\font@switch#1#2\@nil{\count@\@fontnum\relax + \ifx +#1\advance\else\ifx -#1\advance\fi\fi + \count@#1#2\relax + \ifcase\count@ \tiny\or \tiny\or \scriptsize + \or\footnotesize \or\small \or\normalsize \or\large + \or\Large \or\LARGE \or\huge \else\Huge \fi} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% +% \subsection{The HTML3 DTD} +% +% |\HTML@two@stop| is |\endinput| (and so the package stops here) +% unless the HTML3 option is given. +% \begin{macrocode} +\HTML@two@stop +\SGML@w{HTML3 support not finished yet} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<math>{\SGMLgrabber{math}\domath} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<sup>{^\bgroup\HTMLscriptmap} +\SGMLdef</sup>{\egroup} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<sub>{_\bgroup\HTMLscriptmap} +\SGMLdef</sub>{\egroup} +% \end{macrocode} +% +% GRUMBLE! GRUMBLE! GRUMBLE! Possibly the worst feature of \TeX's math +% markup is the nature of the infix operators for fractions and the +% like. And here it is faithfully (or actually not very faithfully) +% reconstructed here\ldots +% \begin{macrocode} +\SGMLdef<box>{\SGMLgrabber{box}\dobox} +% \end{macrocode} +% +% \begin{macrocode} +\begingroup +\catcode`\<=\active +\catcode`\>=\active +\catcode`\&=\active +\catcode`\_=\active +\catcode`\^=\active +\catcode`\"=\active +% \end{macrocode} +% +% \begin{macro}{\domath} +% Handle the MATH element. The body is pre-expanded one level to +% replace |{ }| by BOX elements, and to replace any SGML entitity +% references by single \TeX\ tokens so they can be recognised more +% easily. Then start math mode with |\[| (which may have been +% redefined locally if the BOX attribute was used) set up the +% shorteref map. +% \begin{macrocode} +\gdef\domath#1{% + {{\def&{\expandafter\expandafter\expandafter\noexpand\SGMLent@@}% + \let<\relax\let>\relax\let_\relax\let^\relax\let"\relax + \def\{{<box>}\def\}{</box>}% + \xdef\@gtempa{#1}}% + \let\do\mathdo + \let\doimplied\mathimplied + \the\toks@ + \[% + \m@th\nulldelimiterspace\z@ + \def^{<sup>}% + \def_{<sub>}% + \@gtempa\]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HTMLscriptmap} +% Set up the shortref map used in super and subscripts. +% \begin{macrocode} +\gdef\HTMLscriptmap{% + \def^{</sup>}% + \def_{</sub>}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dobox} +% Handle the BOX element. +% First deal with the attributes, then set up the shortref map. Then +% start looking for a LEFT tag. +% \begin{macrocode} +\gdef\dobox#1{% + {\let\do\boxdo + \let\bigstrut\relax + \the\toks@ + \def^{<sup>}% + \def_{<sub>}% + \lookleft@#1<left>\@nil}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lookleft@} +% See whether this BOX element contains a LEFT tag. Supply a `null +% delimiter' if not one supplied. +% \begin{macrocode} +\gdef\lookleft@#1<left>#2\@nil{% + \if$#2$% + {\left.\bgroup#1\mayberight}% + \else + \lookbox@#1<box>\@nil#2\@nil + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lookbox@} +% Having found a LEFT tag, need to check it isn't inside a nested BOX. +% The following code looks for an explicit |<BOX>| (which includes a +% |{| shortref as that will have been expanded by now, however it will +% fail if nested boxes have attributes, so it may need some further +% modifications later. +% \begin{macrocode} +\gdef\lookbox@#1<box>#2\@nil#3<left>\@nil{% + \if$#2$% + {\maybeleft#1\@nil#3\mayberight} + \else + {#1 \boxtofront#2 <left> #3}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boxtofront} +% After all that messing around need to put the BOX tag back where we +% found it. +% \begin{macrocode} +\gdef\boxtofront#1<box>{<box>#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\endgroup +% \end{macrocode} +% +% \begin{macro}{\mathdo} +% \changes{v0.04}{1996/03/10}{Support math attributes} +% \begin{macrocode} +\def\mathdo#1#2{% + \def\@tempa{class-chem}\def\@tempb{#1-#2}% + \ifx\@tempa\@tempb + \everymath{\fam\z@}\everydisplay{\fam\z@}% + \fi} +\def\mathimplied#1{% + \def\@tempa{box}\def\@tempb{#1}% + \ifx\@tempa\@tempb + \def\[{\center\setbox\z@\hbox\bgroup$\displaystyle}% + \def\]{$\egroup\fbox{\box\z@}\endcenter}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boxdo} +% \changes{v0.04}{1996/03/09}{Support box size attribute} +% \begin{macrocode} +\def\boxdo#1#2{% + \def\@tempa{size}\def\@tempb{#1}% + \ifx\@tempa\@tempb + \def\@tempb{#2} + \def\@tempa{normal}\ifx\@tempa\@tempb\def\@tempc{1}\fi + \def\@tempa{medium}\ifx\@tempa\@tempb\def\@tempc{2}\fi + \def\@tempa{large}\ifx\@tempa\@tempb\def\@tempc{3}\fi + \def\@tempa{huge}\ifx\@tempa\@tempb\def\@tempc{4}\fi + \edef\bigstrut{\vrule\@height\@tempc\ht\strutbox\@width\z@} + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SGML@left} +% \begin{macrocode} +\SGMLdef<left>{\left.\bgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mayberight} +% \begin{macrocode} +\def\mayberight{\egroup\bigstrut\right.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\maybeleft} +% \changes{v0.04}{1996/03/09}{macro added} +% \begin{macrocode} +\def\maybeleft#1#2\@nil{% + \in@{#1}{()[]\SGML@E@rbrace\SGML@E@lbrace}% + \ifin@ + \left#1\bgroup#2% + \else + \let\SGML@E@int\HTML@bigint + #1#2\left.\bgroup\let\SGML@E@int\int + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\righttest} +% \changes{v0.04}{1996/03/09}{macro added} +% \begin{macrocode} +\def\righttest#1{% + \in@{#1}{()[]\SGML@E@rbrace\SGML@E@lbrace}% + \ifin@ + \right#1\let\mayberight\relax + \else + \right.\let\mayberight\relax\expandafter#1% + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{`Big int' processing} +% I am not sure that stretchy integral signs are good idea in general, +% and certainly they do not fit well with the Computer Modern style of +% sloping integral sign as opposed to the more vertical style of, say, +% Lucida. However\ldots +% +% \begin{macro}{\HTML@int} +% \changes{v0.04}{1996/03/010}{macro added} +% \begin{macrocode} +\ifx\HTML@int\@undefined +% \end{macrocode} +% +% \begin{macro}{\HTML@bigint} +% Normally just use the standard |\int|. +% \begin{macrocode} +\let\HTML@bigint\int +% \end{macrocode} +% +% \begin{macrocode} +\else +% \end{macrocode} +% +% With the |bigint| option . +% The original |\int| (in a big font) together with any saved limits +% (in the normal font). +% \begin{macrocode} +\def\HTML@int{\int^{\box\tw@}_{\box4}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HTML@bigint} +% \begin{macrocode} +\def\HTML@bigint#1\left.\bgroup{% + \def\@tempa{#1}% + \setbox\z@\hbox\bgroup + \aftergroup\HTMLafterbigint$\displaystyle\bgroup + \aftergroup$\aftergroup\egroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HTMLafterbigint} +% \begin{macrocode} +\def\HTMLafterbigint{% + \dimen@.5\ht\z@ + \advance\dimen@.5\dp\z@ + {\SGMLdef<sup>{\setbox\tw@\hbox\bgroup\HTMLscriptmap$\scriptstyle}% + \SGMLdef<sub>{\setbox4\hbox\bgroup\HTMLscriptmap$\scriptstyle}% + \SGMLdef</sup>{$\egroup}% + \SGMLdef</sub>{$\egroup}% + \setbox\tw@\box\voidb@x + \setbox4\box\voidb@x + \@tempa + \ifdim\dimen@>\f@size\p@ +% \end{macrocode} +% At this point, could do |\fontsize\dimen@\z@\selectfont| but that +% would load \emph{all} the math fonnts at a strange size, so instead +% just load the extension font, and then subvert NFSS to drop that +% into the math expression. The NFSS interface is still used to +% declare the font so that a size substitution is done on the loading +% (otherwise every integral may use up a new font). +% \changes{v0.08}{1996/03/16}{Use \cs{DeclareFixedFont}} +% \begin{macrocode} + \mathop{\hbox{\DeclareFixedFont\@tempa{OMX}{cmex}{m}{n}\dimen@ + $\displaystyle\textfont\thr@@\@tempa\HTML@int$}}% + \else + \HTML@int + \fi + }\left.\box\z@} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% +% +% See above grumble. The HTML3 DTD comments specifically refer to +% these as `\LaTeX\ commands' but they are no such thing. They are in +% plain and survive into \LaTeX\ under protest! The AMS \LaTeX\ +% documentation contains a much longer diatribe against these infix +% commands, and they are \emph{disabled} in the AMS \LaTeX\ styles. +% \begin{macrocode} +\SGMLdef<over>{\over} +\SGMLdef<atop>{\atop} +\SGMLdef<choose>{\choose} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<right>{\egroup\bigstrut\righttest} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<above>{\SGMLgrabber{above}% + {\let\@tempc\overlineop + \let\do\abovedo + \the\toks@ + \@tempc}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<below>{\SGMLgrabber{below}% + {\let\@tempc\underlineop + \let\do\abovedo + \the\toks@ + \@tempc}} +% \end{macrocode} +% +% \begin{macrocode} +\def\overlineop#1{\mathop{\overline{#1}}} +\def\underlineop#1{\mathop{\underline{#1}}} +% \end{macrocode} +% +% \begin{macrocode} +\def\abovedo#1#2{% + \def\@tempa{sym}\def\@tempb{#1}% + \ifx\@tempa\@tempb\def\@tempc{\csname#2\endcsname}\fi} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<vec>{\SGMLgrabber{vec}\vec} +\SGMLdef<bar>{\SGMLgrabber{bar}\bar} +\SGMLdef<dot>{\SGMLgrabber{dot}\dot} +\SGMLdef<ddot>{\SGMLgrabber{ddot}\ddot} +\SGMLdef<hat>{\SGMLgrabber{hat}\hat} +\SGMLdef<tilde>{\SGMLgrabber{tilde}\tilde} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<t>{\SGMLgrabber{t}\mathrm} +\SGMLdef<bt>{\SGMLgrabber{bt}\mathbf} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<text>{\SGMLgrabber{text}\textnormal}%%%%% not in the dtd???? +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<root>{\rootfudge} +\def\rootfudge#1{% + \setbox\rootbox\hbox\bgroup$\m@th\scriptscriptstyle\bgroup#1} +% \end{macrocode} +% +% I think the HTML3 DTD is wrong here\footnote +% {Since confirmed by Dave Raggett, the HTML3 author}, +% it allows the OF element to +% take content, which is at variance with the description in the text. +% \begin{macrocode} +\SGMLdef<of>{\egroup$\egroup\SGMLgrabber{root}\offudge} +\SGMLdef</of>{} +\def\offudge#1{\mathpalette\r@@t{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<sqrt>{\SGMLgrabber{sqrt}\sqrt} +% \end{macrocode} +% +% \changes{v0.08}{1996/03/16}{Add basic support for array element} +% +% Hate allocating registers, so this will probably go, but for now +% give myself four (global) count registers to play with. +% \begin{macrocode} +\newcount\HTMLrow +\newcount\HTMLcol +\newcount\HTMLrowspan +\newcount\HTMLcolspan +% \end{macrocode} +% +% The HTML array element. Support for ALIGN, COLSPAN, ROWSPAN +% LABELS, LDELIM and RDELIM. However not all combinations of alignment +% and labels do `the right thing'. +% +% \changes{v0.09}{1996/03/21}{COLSPEC support for ARRAY} +% +% Uses a \TeX\ primitive |\halign| construction, rather than use the +% \LaTeX\ |array| environment directly. +% \begin{macrocode} +\SGMLdef<array>{{\ifnum`}=0\fi + \let\do\arraydo + \let\doimplied\arrayimplied + \let\HTMLal.% + \let\HTMLar.% + \global\HTMLrow\z@ + \let\HTMLabox\vcenter + \the\toks@ + \setbox\z@\vbox\bgroup\halign\bgroup + \strut\span\HTMLacolspec\cr\nocr} +% \end{macrocode} +% +% \begin{macro}{\HTMLacolspec} +% \changes{v0.09}{1996/03/21}{macro added} +% \begin{macrocode} +\def\HTMLacolspec{##&&##} +% \end{macrocode} +% \end{macro} +% + +% \begin{macro}{\HTMLamakepream} +% \changes{v0.09}{1996/03/21}{macro added} +% \begin{macrocode} +\def\HTMLamakepream#1{% + \let\HTMLacolspec\@empty + \let\@sharp\relax + \lowercase{\@tfor\@tempc:=#1}\do{% + \if\@tempc l% + \edef\HTMLacolspec{\HTMLacolspec\@sharp\hfill&}% + \else + \if\@tempc c% + \edef\HTMLacolspec{\HTMLacolspec\hfill\@sharp\hfill&}% + \else + \if\@tempc r% + \edef\HTMLacolspec{\HTMLacolspec\hfill\@sharp&}% + \else + \if\@tempc +% + \edef\HTMLacolspec{\HTMLacolspec$+$}% + \else + \if\@tempc -% + \edef\HTMLacolspec{\HTMLacolspec$-$}% + \else + \if\@tempc =% + \edef\HTMLacolspec{\HTMLacolspec$=$}% + \fi + \fi + \fi + \fi + \fi + \fi}% + \def\@sharp{########}% + \edef\HTMLacolspec{\HTMLacolspec&\@sharp}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\SGMLdef</array>{\HTMLendarray} +% \end{macrocode} +% +% \begin{macrocode} +\let\HTMLcr\cr +% \end{macrocode} +% +% \begin{macro}{\HTMLendarray} +% Non LABELS ending +% \begin{macrocode} +\def\HTMLendarray{% + \endi\crcr\egroup\egroup + \ifx\HTMLabox\vtop + \setbox\z@\vtop{\unvbox\z@}% + \else + \ifx\HTMLabox\vcenter + \dimen@\ht\z@ + \advance\dimen@\dp\z@ + \divide\dimen@\tw@ + \advance\dimen@-\ht\z@ + \setbox\z@\hbox{\raise\dimen@\box\z@}% + \fi + \fi + \dimen@=\ht\z@ + \setbox\z@ +\hbox{$\left\HTMLal\kern-1em\vcenter{\box\z@}\kern-1em\right\HTMLar$}% + \advance\dimen@-\ht\z@ + \raise\dimen@\box\z@ + \ifnum`{=0\fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HTMLendarraylabels} +% LABELS ending +% \begin{macrocode} +\def\HTMLendarraylabels{% + \endi\crcr\strut\cr\egroup\egroup + \setbox2=\vsplit\z@ to \baselineskip + \setbox\z@\vbox{\unvbox\z@\global\setbox\@ne\lastbox}% + \setbox4\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}% + \vcenter{% + \box2 + \hbox{$\kern\wd\@ne + \left\HTMLal\kern-\wd\@ne + \vcenter{\box\z@}% + \right\HTMLar$}}% + \ifnum`{=0\fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\nocr{\relax\iffalse{\fi\let\HTMLcr\relax\iffalse}\fi} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<row>{% + \endi\HTMLcr + \global\advance\HTMLrow\@ne + \global\HTMLcol\z@} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef</row>{} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLdef<item>{% + \let\do\itemdo + \gdef\@gtempa{\global\advance\HTMLcol\@ne}% + \gdef\@gtempb{}% + \gdef\@gtempc{}% + \global\HTMLcolspan\@ne + \the\toks@ + \endi% + \@gtempc + \@gtempa +% \end{macrocode} +% +% If an earlier row contained an entry spanning down to this point, +% need to jump across to the next column (and perhaps further). +% \begin{macrocode} + \spanifneeded +% \end{macrocode} +% +% |\@gtempb| is normally empty but will be defined if the item had an +% ALIGN attribute. +% \begin{macrocode} + \@gtempb +% \end{macrocode} +% First box each entry which allows measuring needed (but not yet +% done) for vertical spanning. +% \begin{macrocode} + \setbox\z@\hbox\bgroup$% + \def\endi{\unskip$\egroup% + \quad\HTMLaleft\box\z@\HTMLaright\quad&}% + \ignorespaces} +% \end{macrocode} +% +% \begin{macro}{\spanifneeded} +% If the current row/column is in the list of spanned entries, jump to +% next column and look again. +% \begin{macrocode} +\def\spanifneeded{% + \edef\@tempa{\noexpand\in@{,\the\HTMLrow/\the\HTMLcol,}{\spanitems}}% + \@tempa + \ifin@ + \@firstofone{&}\global\advance\HTMLcol\@ne + \expandafter\spanifneeded + \fi} +% \end{macrocode} +% \end{macro} +% +% As usual handle end tags that may be omitted by making them +% translate to empty. +% \begin{macrocode} +\SGMLdef</item>{} +% \end{macrocode} +% +% \begin{macro}{\HTMLaleft} +% \begin{macro}{\HTMLaright} +% Default stuff to put around the entries. Locally redefined by an +% ALIGN attribute. +% \begin{macrocode} +\let\HTMLaleft\hfil +\let\HTMLaright\hfil +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\endi} +% Code to end an item. Extra indirection used to handle omitted tags. +% \begin{macrocode} +\let\endi\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\arraydo} +% \changes{v0.09}{1996/03/21}{COLSPEC added} +% Handle ARRAY attributes. +% \begin{macrocode} +\def\arraydo#1#2{% + \def\@tempa{#1}\def\@tempb{#2}% + \def\@tempc{align}% + \ifx\@tempa\@tempc + \def\@tempc{top}% + \ifx\@tempb\@tempc + \let\HTMLabox\vtop + \else + \def\@tempc{bottom}% + \ifx\@tempb\@tempc + \let\HTMLabox\vbox + \fi + \fi + \else + \def\@tempc{ldelim}% + \ifx\@tempa\@tempc + \let\HTMLal\@tempb + \else + \def\@tempc{rdelim}% + \ifx\@tempa\@tempc + \let\HTMLar\@tempb + \else + \def\@tempc{labels}% + \ifx\@tempa\@tempc + \let\HTMLendarray\HTMLendarraylabels + \else + \def\@tempc{colspec}% + \ifx\@tempa\@tempc + \HTMLamakepream{#2}% + \fi + \fi + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\arrayimplied} +\def\arrayimplied#1{% + \def\@tempa{labels}\def\@tempb{#1}% + \ifx\@tempa\@tempb + \let\HTMLendarray\HTMLendarraylabels + \fi} +% \end{macro} +% +% \begin{macro}{\itemdo} +% Handle ITEM attributes +% \begin{macrocode} +\def\itemdo#1#2{% + \def\@tempa{#1}\def\@tempb{#2}% + \def\@tempc{colspan}% + \ifx\@tempa\@tempc + \global\HTMLcolspan#2\relax + \gdef\@gtempa{\@multispan#2\relax\global\advance\HTMLcol#2\relax}% + \else + \def\@tempc{align}% + \ifx\@tempa\@tempc + \def\@tempc{left}% + \ifx\@tempb\@tempc + \gdef\@gtempb{\let\HTMLaleft\relax}% + \else + \def\@tempc{right}% + \ifx\@tempb\@tempc + \gdef\@gtempb{\let\HTMLaright\relax}% + \fi + \fi + \else + \def\@tempc{rowspan}% + \ifx\@tempa\@tempc + \global\HTMLrowspan#2\relax + \gdef\@gtempc{% + \@tempcnta=\HTMLrow + \advance\@tempcnta\HTMLrowspan +% \end{macrocode} +% +% Double loop adds all the entries below this a ROWSPAN entry +% to |\spanitems| list. +% \begin{macrocode} + \loop + \@tempcntb=\HTMLcol + \advance\@tempcntb\HTMLcolspan + \advance\@tempcnta\m@ne + \ifnum\@tempcnta>\HTMLrow + {\loop + \xdef\spanitems{% + \spanitems\the\@tempcnta/\the\@tempcntb,}% + \advance\@tempcntb\m@ne + \ifnum\@tempcntb>\HTMLcol + \repeat}% + \repeat}% + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\spanitems} +% Initial value for list of spanned entries. +% \begin{macrocode} +\def\spanitems{,} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\SGMLentity{thinsp}{\,} +\SGMLentity{emsp}{\quad} +% \end{macrocode} +% +% Far from final list of math symbol entity names\ldots +% \begin{macrocode} +\SGMLentity{alpha}{\alpha} +\SGMLentity{beta}{\beta} +\SGMLentity{gamma}{\gamma} +\SGMLentity{Gamma}{\Gamma} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLentity{int}{\int} +\SGMLentity{sum}{\sum} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLentity{lbrace}{\lbrace} +\SGMLentity{rbrace}{\rbrace} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLentity{times}{\times} +\SGMLentity{cup}{\cup} +\SGMLentity{cap}{\cap} +\SGMLentity{vee}{\vee} +\SGMLentity{wedge}{\wedge} +\SGMLentity{infty}{\infty} +\SGMLentity{oplus}{\oplus} +\SGMLentity{ominus}{\ominus} +\SGMLentity{otimes}{\otimes} +% \end{macrocode} +% +% \begin{macrocode} +\SGMLentity{sin}{\sin} +\SGMLentity{cos}{\cos} +\SGMLentity{tan}{\tan} +% \end{macrocode} +% +% \section{HTML3 Tables} +% \changes{v0.09}{1996/03/21}{TABLE added (mjd)} +% Not done yet, but here is a start\ldots +% +% Final version will probably need primitive |\halign| coding +% as for (but hopefully better than) array stuff above. Also +% will need to be lontable-like. +% +% This is all very slapdash and temporary [mjd,1996/03/20]. +% Don't expect good-looking results, just results, occasionally. +% +% \begin{macrocode} +\SGMLdef<table>{\begin{table}[htp]\centering\begin{tabular}{*{10}c}} +\SGMLdef</table>{\end{tabular}\end{table}} +\SGMLdef<tr>{\ifhmode\expandafter\\\fi\relax} +\SGMLdef</tr>{\\\relax} +\SGMLdef<td>{\ifvmode\else\expandafter\hiddenamp\fi} +\def\hiddenamp{&} +% \end{macrocode} +% if |<td>| is present for each cell, then |</td>| doesn't +% need to do anything +% \begin{macrocode} +\SGMLdef</td>{} +% \end{macrocode} +% +% Whoa, if I'm to define caption properly I'd have to look up +% how/where it's used. Who, lazy old me? +% +% \begin{macrocode} +\SGMLdef<caption>{\end{tabular}\begingroup\bfseries} +\SGMLdef</caption>{\endgroup\par\smallskip\begin{tabular}{*{10}{c}}} +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/carlisle/typehtml.ins b/Master/texmf-dist/source/latex/carlisle/typehtml.ins new file mode 100644 index 00000000000..77fefef3fe3 --- /dev/null +++ b/Master/texmf-dist/source/latex/carlisle/typehtml.ins @@ -0,0 +1,3 @@ +\def\batchfile{typehtml.ins} +\input docstrip +\generateFile{typehtml.sty}{f}{\from{typehtml.dtx}{package}} -- cgit v1.2.3