diff options
Diffstat (limited to 'support/classpack')
-rw-r--r-- | support/classpack/MANIFEST | 17 | ||||
-rw-r--r-- | support/classpack/README | 129 | ||||
-rw-r--r-- | support/classpack/classpack.dtx | 3028 | ||||
-rw-r--r-- | support/classpack/classpack.ins | 42 | ||||
-rw-r--r-- | support/classpack/classpack.pdf | bin | 0 -> 310003 bytes | |||
-rw-r--r-- | support/classpack/classpack.sty | 46 | ||||
-rw-r--r-- | support/classpack/db2bibtex.xsl | 592 | ||||
-rw-r--r-- | support/classpack/db2dtx.xsl | 5378 | ||||
-rw-r--r-- | support/classpack/db2plaintext.xsl | 513 | ||||
-rw-r--r-- | support/classpack/decommentbbl.awk | 37 | ||||
-rw-r--r-- | support/classpack/doctexbook.dtd | 63 | ||||
-rw-r--r-- | support/classpack/lppl.xml | 541 | ||||
-rw-r--r-- | support/classpack/prepost.xml | 648 | ||||
-rw-r--r-- | support/classpack/readme.xml | 166 |
14 files changed, 11200 insertions, 0 deletions
diff --git a/support/classpack/MANIFEST b/support/classpack/MANIFEST new file mode 100644 index 0000000000..20b8b2d153 --- /dev/null +++ b/support/classpack/MANIFEST @@ -0,0 +1,17 @@ +README +MANIFEST +classpack.dtx +classpack.ins +classpack.pdf +classpack.sty +doctexbook.dtd +getgis.sh +test.sh +../db2dtx.xsl +../db2bibtex.xsl +../db2plaintext.xsl +../decommentbbl.awk +doctexbook.dtd +lppl.xml +../prepost.xml +../readme.xml diff --git a/support/classpack/README b/support/classpack/README new file mode 100644 index 0000000000..99d3d81e45 --- /dev/null +++ b/support/classpack/README @@ -0,0 +1,129 @@ +README +This is the README file for the classpack package. +1 Summary +LaTeX document classes and packages are normally created, maintained, +and distributed in .dtx format using the ltxdoc class, which provides +facilities for modular or fragmentary coding combined with interleaved +documentation. However, the accurate construction of these files is +technically challenging. +ClassPack allows a developer to create an XML document containing user +documentation and annotated code, based on the DocBook vocabulary (with +some minor abuses). An XSLT2 script then generates the .dtx and .ins +files, ensuring that all the relevant pieces are emitted in the correct +order and in the correct syntax. +This is experimental software, and is incomplete. It has been +successfully used in-house by the author since 2008 for several +institutional and commercial packages and classes. There are some known +deficiencies which remain to be corrected, and some legacy code +(originally included for one specific package) which needs to be removed +to an external file. +A paper describing the system has been accepted for the Balisage markup +conference 2013 in Montréal. + +2 Normal installation +This package is distributed as a .tds.zip file (TDS is the TeX Directory +Structure, the standard layout for a modern TeX installation). Install +it on any personal TDS-compliant TeX system by unzipping it into your +personal TeX directory (folder). This will put all the files into the +right places, so you can start using them immediately. +If you haven't yet created a personal TeX directory, see below for +details of what one is, and how to create it. +On a shared (multiuser) system like a server, unzip it into the +$TEXMFLOCAL directory instead (see below), and run your TeX +directory-indexing program (eg texhash, mktexlsr, Update FNDB, etc) so +that everyone can use it. +If you are using an old non-TDS-compliant system, see below under Manual +Installation. +2.1 Your personal TeX directory +This is a directory (folder) on single-user systems like desktops and +laptops where you put all your local manual modifications, updates, and +additions such as classes, packages, and fonts. The name and location +are fixed: + Apple Mac OS X + ~/Library/texmf + Unix and GNU/Linux + ~/texmf + MS-Windows 95/XP + C:\texmf + MS-Windows 2007 and above + Computer\System\YOURNAME\texmf +Create that folder if it does not already exist. + WARNING: If you are a Windows user running MiKTeX + ! + ! When you create the folder, you must add it to MiKTeX's list of + ! supported folders. Run the MiKTeX Maintenance/Settings program, + ! select the Roots tab, and add the folder. You only have to do this + ! once. + ! + ! Each time you add or remove software in your personal TeX folder, + ! you MUST also click on the Update FNDB button in the General tab. + +Unix (Mac and GNU/Linux) users do not need to (indeed, should not) run +their filename database indexer (mktexlsr or texhash) for files put in +your personal TeX directory. +2.2 Installation on shared systems +On multi-user systems (Unix-based), identify the shared local directory +tree with the command + kpsewhich -expand-var '$TEXMFLOCAL' + +This will give you the location of the shared texmf directory into which +you must install these files. +Do not forget to run the texhash or mktexlsr (filename indexer) program +after installation, otherwise the files will not be found by LaTeX and +nothing will work! + +3 Manual installation (non-TDS systems) +To install this software manually, unzip the zip file into a temporary +directory and move the classpack.sty file from the tex/latex/classpack +directory to a location (directory/folder) where LaTeX will find it on +your system. This referred to in some documentation as "the TEXINPUTS +directory", although it may be called something else on your system. +IT IS YOUR RESPONSIBILITY TO KNOW WHERE THIS LOCATION IS. See the +question in the TeX FAQ at +http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf for more +information. If you do not know, or cannot find it, or do not have +access to it, your TeX system may be out of date need replacing. +3.1 Last resort +In an emergency, and as a last resort on unmanageable systems, it is +possible simply to put the classpack.sty file in your current working +directory (the same folder as your .tex file[s]). +While this may work, it is not supported, and may lead to other +resources (packages, fonts, etc) not being found. + +4 Usage +Make this the first line of your LaTeX document: + \usepackage[options]{classpack} + +Read the documentation for the options available. The documentation is +distributed as a PDF document in the zip file. You can also regenerate +it by typesetting the classpack.dtx file with LaTeX (and BiBTeX and +makeindex) in the normal way. + +5 Bugs and TODO +No outstanding reported bugs at the time of this version, but there are +many facilities and features unimplemented, and the documentation is +incomplete. + +6 Copyright +The following statement is included in the source code: +% Extracted from classpack.xml +% classpack.sty is copyright © 2012-2013 by Peter Flynn <peter@silmaril.ie> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The current maintainer of this work is Peter Flynn <peter@silmaril.ie> +% +% This work consists of the files classpack.dtx and classpack.ins, +% the derived file classpack.sty, and any ancillary files listed +% in the MANIFEST. + diff --git a/support/classpack/classpack.dtx b/support/classpack/classpack.dtx new file mode 100644 index 0000000000..39c95c16fb --- /dev/null +++ b/support/classpack/classpack.dtx @@ -0,0 +1,3028 @@ +% \iffalse meta-comment +% +% Extracted from classpack.xml +% classpack.dtx is copyright © 2012-2013 by Peter Flynn <peter@silmaril.ie> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The current maintainer of this work is Peter Flynn <peter@silmaril.ie> +% +% This work consists of the files classpack.dtx and classpack.ins, +% the derived file classpack.sty, and any ancillary files listed +% in the MANIFEST. +% +% \fi +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[2011/06/27] +%<package>\ProvidesPackage{classpack}[2013/05/28 v0.77 +%<package> XML mastering for LaTeX classes and packages] +%<*driver> +\PassOptionsToPackage{svgnames}{xcolor} +\documentclass[12pt]{ltxdoc} +%% +%% Packages added automatically +%% +\let\SavedShow\show +\usepackage[utf8x]{inputenc}% was detected. +\AtBeginDocument{\let\show\SavedShow} +\DeclareUnicodeCharacter{9251}{\textvisiblespace} +\usepackage[T1]{fontenc}% was detected. +\usepackage{lmodern}% was detected. +\usepackage{mflogo}% was detected. +\usepackage{array}% tgroup was detected. +\usepackage{calc}% was detected. +\usepackage[inline]{enumitem}% orderedlist/@spacing='compact' was detected. +\setlist[description]{style=unboxed} +\usepackage{fancybox}% guibutton was detected. +\usepackage{fancyvrb}% programlisting was detected. +\usepackage{fmtcount}% xref/@linkend='varlistentry' was detected. +\usepackage[textwidth=150mm,textheight=8.5in]{geometry}% was detected. +\usepackage{listings}% programlisting was detected. +\lstdefinelanguage[DocBook]{XML} {morekeywords={abstract,address,affiliation,annotation,arg,author, book,chapter,classname,cmdsynopsis,command,constraintdef,contrib, copyright,cover,date,email,emphasis,envar,filename,firstname, footnote,guibutton,guilabel,guimenu,guimenuitem,guisubmenu, holder,info,itemizedlist,listitem,literal,member,option, orderedlist,orgdiv,orgname,package,para,parameter,part, personname,phrase,procedure,productname,programlisting,quote, refsection,remark,constructorsynopsis,methodparan,modifier, funcparams,olink,bibliography,biblioentry,biblioset,subtitle, artpagenums,volumenum,issuenum, releaseinfo,replaceable,revdescription,revhistory,revision, sect1,sect2,sect3,sect4,seg,seglistitem,segmentedlist,segtitle, simplelist,step,surname,systemitem,tag,term,title,uri,userinput, variablelist,varlistentry,wordasword,xref,year,xml:id,xlink:href},} +\lstdefinelanguage[TEI]{XML} {morekeywords={TEI.2,teiHeader,div2,head,p,num,val,xml:id}, }[keywords,comments,strings] +\lstloadlanguages{[LaTeX]TeX,[DocBook]XML,XSLT,bash,R} +\lstset{basicstyle=\small\color{Black}\ttfamily, literate= {Ö}{{\"O}}1 {Ä}{{\"A}}1 {Ü}{{\"U}}1 {ß}{{\ss}}2 {ü}{{\"u}}1 {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 {ä}{{\"a}}1 {ö}{{\"o}}1, keywordstyle=\color{DarkGreen}\bfseries, commentstyle=\color{Gray}\upshape, stringstyle=\color{DarkRed}\upshape, emphstyle=\color{MediumBlue}\itshape, showstringspaces=false, columns=fullflexible, keepspaces=true} +\usepackage{makeidx}% was detected. +\makeindex +\usepackage{nicefrac}% was detected. +\def\textonehalf{\ensuremath{\nicefrac12}} +\usepackage{parskip}% was detected. +\usepackage{url}% uri was detected. +\usepackage{varioref}% xref was detected. +\vrefwarning +\labelformat{chapter}{Chapter~#1} +\makeatletter +\labelformat{chapter}{\@chapapp~#1} +\makeatother +\labelformat{section}{section~#1} +\labelformat{subsection}{section~#1} +\labelformat{subsubsection}{section~#1} +\labelformat{paragraph}{section~#1} +\labelformat{figure}{Figure~#1} +\labelformat{table}{Table~#1} +\labelformat{item}{item~#1} +\renewcommand{\reftextcurrent}{elsewhere on this page} +\def\reftextafter{on the \reftextvario{next}{following} page} +\usepackage[svgnames]{xcolor}% was detected. +\makeatletter +\@ifundefined{T}{\newcommand{\T}[2]{{\fontencoding{T1}\selectfont#2}}}{} +\makeatother +\usepackage{dox}% was detected. +\doxitem{Attribute}{attribute}{attributes} +\doxitem{AttributeValue}{attributevalue}{attribute values} +\doxitem{Class}{class}{classes} +\doxitem{Colour}{colour}{colours} +\doxitem{Counter}{counter}{counters} +\doxitem{DTD}{dtd}{DTDs/Schemas} +\doxitem{Element}{element}{element types} +\doxitem{Entity}{entity}{entities} +\doxitem{Error}{error}{errors} +\doxitem{Function}{function}{functions} +\doxitem[macrolike]{Length}{length}{lengths} +\doxitem{Mode}{mode}{mode} +\doxitem{Option}{option}{options} +\doxitem{Package}{package}{packages} +\doxitem{Template}{template}{templates} +\newcommand{\LabelFont}[2][\relax]{\strut {\fontencoding\encodingdefault \fontfamily{lmtt}\fontseries{lc}\selectfont#1#2}\space} +\makeatletter +\def\PrintDescribeAttribute#1{\LabelFont{@#1}} +\makeatother +\def\PrintDescribeAttributeValue#1{\LabelFont[\itshape]{#1}} +\def\PrintDescribeClass#1{\LabelFont{#1}} +\def\PrintDescribeColour#1{\LabelFont[\color{#1}]{#1}} +\def\PrintDescribeCounter#1{\LabelFont{#1}} +\def\PrintDescribeDTD#1{\LabelFont{#1}} +\def\PrintDescribeElement#1{\LabelFont{<#1>}} +\def\PrintDescribeEntity#1{\LabelFont{\}} +\def\PrintDescribeError#1{\LabelFont[\color{Red}!]{#1}} +\def\PrintDescribeFunction#1{\LabelFont{#1}} +\def\PrintDescribeLength#1{\LabelFont{#1}} +\def\PrintDescribeMode#1{\LabelFont[\sffamily]{\textlangle#1\textrangle}} +\def\PrintDescribeOption#1{\LabelFont[\itshape]{#1}} +\def\PrintDescribePackage#1{\LabelFont{#1}} +\def\PrintDescribeTemplate#1{\LabelFont[\fontfamily{lmss}\fontseries{sbc}\selectfont]{#1}} +\usepackage{apacite} +%% +%% Packages added by author +%% +\usepackage{dejavu} +\usepackage{textgreek} +\usepackage{classpack} +%% +%% Settings for docstrip and latexdoc +%% +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\newlength{\revmarg} +\setlength{\revmarg}{1in} +\newcommand{\vstrut}{\vrule height1.2em depth.6667ex width0pt} +\newcommand{\prestrut}{\vrule height1em width0pt} +\newcommand{\poststrut}{\vrule depth.5ex width0pt} +\begin{document}\raggedright\hyphenation{ele-ment attri-bute-value} + \DocInput{classpack.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{45} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \changes{v0.77}{2013/05/28}{Removed unwanted definitions: classorpackage.} +% \changes{v0.76}{2013/05/05}{Modified documentation: Started working on Makefile.} +% \changes{v0.75}{2013/03/14}{Added secondary files: Secondary output files possible; reversed usage of role attribute on keywords;.} +% \changes{v0.74}{2013/02/21}{Added experimental autopackage: This implements automated package inclusion based on the markup used by the author..} +% \changes{v0.73}{2012/06/19}{Added readme.xml and db2plaintext.xsl: This implements dynamic README generation..} +% \changes{v0.72}{2012/02/11}{Wrote internal documentation: Created the classpack.xml template as an example..} +% \changes{v0.71}{2012/02/08}{First time this was used to document itself: The title element and subtitle element are now subsumed beneath the generated title in the output..} +% +% \GetFileInfo{classpack.dtx} +% +% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty} +% \DoNotIndex{\@flushglue,\@gobble,\@input} +% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle} +% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa} +% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue} +% \DoNotIndex{\@thanks,\@thefnmark,\@topnum} +% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin} +% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces} +% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup} +% \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef} +% \DoNotIndex{\egroup} +% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist} +% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global} +% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn} +% \DoNotIndex{\ifcase} +% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item} +% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower} +% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing} +% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc} +% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut} +% \DoNotIndex{\strutbox} +% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt} +% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@} +% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim} +% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary} +% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle} +% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode} +% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip} +% \DoNotIndex{\nopagebreak} +% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle} +% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb} +% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar} +% \DoNotIndex{\[,\{,\},\]} +% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode} +% \DoNotIndex{\baselineskip,\begin,\tw@} +% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q} +% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H} +% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z} +% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0} +% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_} +% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother} +% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment} +% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined} +% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc} +% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar} +% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode} +% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting} +% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf} +% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse} +% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault} +% \DoNotIndex{\bfdefault,\DeclareRobustCommand} +% \DoNotIndex{\varname} +% \DoNotIndex{\section} +% \DoNotIndex{\subsection} +% \DoNotIndex{\raggedright} +% \DoNotIndex{\sffamily} +% \DoNotIndex{\usepackage} +% \DoNotIndex{\title} +% \DoNotIndex{\author} +% \DoNotIndex{\abstractname} +% \DoNotIndex{\changes} +% \DoNotIndex{\RequirePackage} +% \DoNotIndex{\LoadPackage} +% \DoNotIndex{\makeindex} +% \DoNotIndex{\makeatletter} +% \DoNotIndex{\makeatother} +% \DoNotIndex{\def} +% \DoNotIndex{\newwrite} +% \DoNotIndex{\classorpackage} +% \DoNotIndex{\@@doxdescribe} +% \DoNotIndex{\build} +% \DoNotIndex{\label} +% \DoNotIndex{\small} +% \DoNotIndex{\ttfamily} +% \DoNotIndex{\cite} +% \DoNotIndex{\citefield} +% \DoNotIndex{\url} +% \DoNotIndex{\ref} +% \DoNotIndex{\parskip} +% \DoNotIndex{\java} +% \DoNotIndex{\./build} +% \setcounter{secnumdepth}{5} +% \setcounter{tocdepth}{5} +% \setcounter{IndexColumns}{2} +% \setlength{\columnsep}{3pc} +% +% \def\fileversion{0.77} +% \def\filedate{2013/05/28} +% \title{The \textsf{classpack} \LaTeXe\ package\thanks{% +% This document corresponds to \textsf{classpack} +% \textit{v.}\ \fileversion, dated \filedate.}\enspace\thanks{% +% Development has been supported by UCC Electronic Publishing Unit.} +% \\[1em]\Large +% XML mastering for \LaTeX{} classes and packages} +% \author{Peter Flynn\\\normalsize Silmaril Consultants\\[-.25ex]\normalsize Textual Therapy Division\\\normalsize(\url{peter@silmaril.ie})} +% \maketitle +% \renewcommand{\abstractname}{Summary}\thispagestyle{empty} +% \begin{abstract} +% \parskip=0.5\baselineskip +% \advance\parskip by 0pt plus 2pt +% \parindent=0pt% \noindent +% \LaTeX{} document classes and packages are normally +% created, maintained, and distributed in +% {\ttfamily{}.dtx} format using the +% \textsf{ltxdoc} class, which provides facilities for +% modular or fragmentary coding combined with interleaved +% documentation. However, the accurate construction of these +% files is technically challenging.\par +% \emph{ClassPack} allows a developer to +% create an XML document containing user documentation and +% annotated code, based on the +% \emph{DocBook} vocabulary (with some minor +% abuses). An XSLT2 script then generates the +% {\ttfamily{}.dtx} and {\ttfamily{}.ins} files, +% ensuring that all the relevant pieces are emitted in the +% correct order and in the correct syntax.\par +% This is experimental software, and is incomplete. It has +% been successfully used in-house by the author since 2008 for +% several institutional and commercial packages and classes. +% There are some known deficiencies which remain to be +% corrected, and some legacy code (originally included for one +% specific package) which needs to be removed to an external +% file.\par +% A paper describing the system has been accepted for the +% Balisage markup conference 2013 in Montréal.\par +% \end{abstract} +% \clearpage +% \tableofcontents +% \clearpage +% \section{Introduction} +% \LaTeX{} document classes (templates) and packages (styles) +% are traditionally distributed as pairs of +% {\ttfamily{}.dtx} and{\ttfamily{}.ins} files, +% written to the specifications and recommendations of the +% \textsf{doc}, \textsf{ltxdoc}, and +% \textsf{clsguide} packages.\par +% \begin{itemize} +% \item The {\ttfamily{}.dtx} (Doc\TeX{}) file is a +% literate-programming document, containing modular code and +% annotations interleaved in such a way that each fragment +% of code and its explanation are adjacent; +% \item The {\ttfamily{}.ins} file is an installer: +% when run through \LaTeX{}, it extracts the code from the +% {\ttfamily{}.dtx} file into the relevant class +% ({\ttfamily{}.cls}), package +% ({\ttfamily{}.sty}), and other files; +% \item Running \LaTeX{} on the {\ttfamily{}.dtx} file +% itself extracts and typesets the documentation. +% \end{itemize} +% The construction of a {\ttfamily{}.dtx} document +% is quite complex, with a special set of tags and conventions +% to allow documentation to be separately identifiable to code. +% The file format relies on the documentation being shielded by +% a leading percent-space (\verb|%␣|) armour +% on each line to prevent it being interpreted as part of the +% code; and the environment tags surrounding the code itself +% must be shielded by four such spaces +% (\verb|%␣␣␣␣|). Apart from the +% documentation, the treatment of the code and control +% statements resembles more a data specification (which in some +% ways it is) than a conventional text document.\par +% XML, particularly in its traditional +% `document' mode, as distinct from its +% use as a data exchange format, offers many similar features to +% \LaTeX{} (for example, the named identification of document +% components), but with a rigid and invariable syntax that can +% be checked programmatically by any validating XML processor. +% By contrast, a \LaTeX{} document (and more specifically, a +% {\ttfamily{}.dtx} document) can only be proved by +% running it through \LaTeX{} itself: there is no equivalent to +% the `pre-flight' type of standalone parsing or +% validating available with XML.\par +% The \emph{DocBook} vocabulary of XML +% is designed for technical documentation in computing. It +% provides markup both for textual documentation +% \emph{and} for data-like structures that occur +% in computer documentation, making it a viable candidate for +% describing a literate-programming type of document such as +% Doc\TeX{}.\par +% The \emph{ClassPack} system is an +% experiment in using \emph{DocBook} XML as +% the storage format for \LaTeX{} class and package source code, +% using the XLST2 language to transform the XML into pairs of +% {\ttfamily{}.dtx} and {\ttfamily{}.ins} files. +% There are a number of advantages to this approach:\par +% \begin{itemize} +% \item XML's syntax and document construction is extremely +% robust, and the design of the language means that an XML +% file can be machine-checked for errors of syntax and +% construction; +% \item XML markup is traditionally self-descriptive, with +% element types being named according to what they are +% intended to contain. For example, a variable name can be +% marked up as +% \verb|<varname>foo</varname>|.\par +% While it is perfectly possible to create a +% {\ttfamily{}\textbackslash{}varname} control sequence (macro) to do +% the same in \LaTeX{}, it is rarely done. Instead, authors +% have typically preferred to use visual formatting like +% \verb|\textit{foo}| for italics or +% \verb|\verb+foo+| for monospace type. +% This method means the variable reference is not +% immediately identifiable as containing a variable +% name~--- it could be anything; +% \item Given suitably-descriptive markup, sharing document +% fragments between applications can be done +% programmatically, so a fragment implementing a \LaTeX{} +% feature (with its associated documentation) can be re-used +% in other class and package applications at the XML level +% (eg with XInclude, or as an external entity) without the +% need for manual cutting and pasting; +% \item \label{xmltools}There is a very wide range of software (editors and +% processors, both free and non-free) available to handle +% XML documents, including a lot of useful tools for +% document management and information extraction. +% \end{itemize} +% Everything comes at a cost. The drawbacks of using XML for +% this include:\par +% \begin{itemize} +% \item It's another language to learn. Despite being so +% widespread, it's not yet a common skill. In particular, +% programmers dislike XML because it's a markup language, +% not a programming language, and the syntax is different +% from that of programming languages; +% \item Although there is plenty of software for editing XML, +% it is not well-developed for text documents in synchronous +% typographic form (often called +% `WYSIWYG'); even the best or most +% expensive editors are designed for XML experts, not for +% the average user. +% \end{itemize} +% \subsection{Contents} +% The \emph{ClassPack} framework is +% enabled by two principal software components:\par +% \begin{enumerate} +% \item An XML vocabulary (the +% \emph{DocBook}~{\small DTD}\index{DTD} +% or Schema) used for naming the component parts of +% documentation and code, and specifying where they belong +% and how they fit together; +% \item An XSLT2 script to implement the logic of +% combination and separation needed to create the +% {\ttfamily{}.dtx} and {\ttfamily{}.ins} +% files. +% \end{enumerate} +% The XML vocabulary used is +% \emph{DocBook}, which is in widespread +% use for the documentation of computer systems, and is +% well-supported on all platforms. The current system uses +% version 5. Although it is highly modular and easily adapted +% for many purposes, only a few minor changes have been made +% for its use here, but a number of element types have been +% put to uses not envisaged by the developers.\par +% This habit of using (some say, abusing) XML markup for +% different purposes is very common, and often deprecated +% because it is usually undocumented. This document explains +% what has been [ab]used and for what reasons. Once this +% system settles down, a more formal expression of the +% vocabulary can be made from the RNG source, removing the +% parts that are not required, and making it simpler to edit +% with.\par +% The adaptation of \emph{DocBook} in +% this version subsists mainly in the addition of some +% attributes and entity declarations to allow the conversion +% to \LaTeX{} of special characters and other features that +% would otherwise involve extensive re-parsing of the +% character data content (text). The changes also implement a +% few modifications to the way the \LaTeX{} code is output by +% the XSLT2 program for typographical purposes.\par +% As an example, the entity defining the em rule character +% \texttt{\—} is declared as a \LaTeX{} +% tie (non-breaking space) followed by an em rule followed by +% a normal space (\verb|~---␣|), so that it +% can be used between words~--- like this~--- without the +% need to worry about special spacing in the XML, or the +% inadvertent breaking of a line before the rule:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XML] +can be used between words—like this—without the +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% If a +% document style requires the use of unspaced dashes, all that +% needs changing is the entity declaration, not the whole +% document.\par +% The current driver in Document Type +% Definition~(\textsc{dtd})\index{Document Type Definition|see{DTD}}\index{DTD|textbf} format is listed in \vref{savedtd}, and is distributed as file +% {\ttfamily{}doctexbook.dtd} so that it can be +% referenced as such in a document without having to copy and +% paste the declarations into every document.\par +% \subsection{Invocation}\label{invocation} +% To create or edit a \emph{ClassPack} +% XML document you must have the +% \emph{ClassPack} DTD +% \emph{and} the DocBook DTD installed and known +% to your XML editor. The DTD customisation file, +% {\ttfamily{}docbooktex.dtd} is distributed with this +% package; an RNG schema version will be available in the +% future.\par +% With the DTD, the standard procedure is to specify it in +% the first line of your XML document. Your class or package +% documents must therefore start with a Document Type +% Declaration. This can specify the Formal +% Public Identifier~(\textsc{fpi})\index{Formal Public Identifier|see{FPI}}\index{FPI|textbf} and the filename of the +% DTD:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XML] +<?xml version="1.0"?> +<!DOCTYPE book PUBLIC + "+//Silmaril//DTD DocBook 5.0 for DocTeX//EN" + "doctexbook.dtd"> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% or +% you can omit the {\small FPI}\index{FPI} and specify the DTD as a \texttt{SYSTEM} keyword instead:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XML] +<?xml version="1.0"?> +<!DOCTYPE book SYSTEM "doctexbook.dtd"> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% The DTD file {\ttfamily{}doctexbook.dtd} can be +% anywhere on your system: in these examples it is assumed to +% be in the same directory as your document. If you store it +% elsewhere, just give the full filepath, for example:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XML] +<?xml version="1.0"?> +<!DOCTYPE book SYSTEM "/usr/local/lib/xml/dtds/doctexbook.dtd"> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% When you open a document starting like this, a +% conformant XML editor will look for +% {\ttfamily{}doctexbook.dtd} and read it, so that it +% then knows the names of all the element types that you can +% use, and how they fit together into a document.\par +% \subsection{Document structure} +% Every XML document must have one outermost enclosing +% element (the `root' element) which +% holds everything else. The root element type used in a +% ClassPack document is \texttt{book}, as described in +% detail in \vref{setup}.\par +% Within the \texttt{book} element, the +% \emph{metadata} (information about the +% document) is held in an \texttt{info} element, the +% \emph{user documentation} in a \texttt{part} +% element with the ID of \texttt{doc}, and the +% \emph{annotated code} in a second +% \texttt{part} element, with the ID of +% \texttt{code}.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<?xml version="1.0"?> +<!DOCTYPE book SYSTEM "doctexbook.dtd"> +<book> + <info>...</info> + <part xml:id="doc">...</part> + <part xml:id="code">...</part> + <part xml:id="files">...</part> +</book> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% An optional third \texttt{part} with the ID of +% \texttt{files} can be used to include ancillary files that +% are to be recreated as-is, without separate annotation or +% display, such as sample data or example documents (see \vref{ancfiles}).\par +% Ancillary files that require annotating must go in the +% \texttt{code} part as described in +% \vref{secfiles}.\par +% \subsubsection{User documentation} +% The documentation for the end user is descriptive text +% which explains how to use the package or class. The main +% division within a ClassPack \texttt{part} is the +% \texttt{chapter}, which can contain \texttt{sect1} +% sections, which can contain \texttt{sect2} subsections, +% and so on, as described in +% \vref{hierarchy}. User documentation must go in +% a \texttt{chapter} and its sub-elements: it must not be +% directly in the \texttt{part}.\par +% (Because the \textsf{latexdoc} package is +% based on the \textsf{article} package, the +% ClassPack \texttt{chapter}\thinspace{}s become +% \textsf{latexdoc}~{\ttfamily{}\textbackslash{}section}s; +% the ClassPack \texttt{sect1}\thinspace{}s become +% \textsf{latexdoc}~{\ttfamily{}\textbackslash{}subsection}s, +% and so on.)\par +% \paragraph{Structure} +% Your document can use most of the conventional +% structural features of any DocBook document: paragraphs, +% lists, figures, tables, and examples of code (both +% illustrative and for extraction) as described in \vref{pool}. Most of the specialist constructs of +% DocBook are not implemented in ClassPack except for a +% few used in the \texttt{info} section for setup +% purposes. You should refer to the list of markup in +% \vref{pool} for exactly which element types +% do what.\par +% \paragraph{Inline markup} +% Within the text you can use much of the conventional +% semantic markup provided in +% \emph{DocBook} as described in \vref{flow}.\par +% \subsubsection{Annotated code} +% In the \texttt{code} Part, you annotate the inner +% workings of your package or class. The use of the +% \texttt{chapter} and \texttt{sect1} divisional +% structure is also mandated here: everything within the +% chapters is regarded as the package or class.\par +% Your code can be explained in fragments, either as +% alternating \texttt{para} and \texttt{programlisting} +% elements, or as \texttt{annotation} elements, each one +% describing a single macro or environment or other object, +% and containing \texttt{para} and +% \texttt{programlisting} (this makes it indexable). See +% the examples in \vref{pool}.\par +% \subsubsection{Ancillary files}\label{ancfiles} +% There are two types of extractable ancillary +% file:\par +% \begin{itemize} +% \item Ancillary files to be annotated and extracted +% along with the class or package file must each go in +% their own \texttt{appendix} element immediately +% after the last of the \texttt{chapter} element of +% the package or class in the \texttt{code} +% Part +% \item Ancillary files which just need to be extracted +% whole, and do not have any separate documentation must +% go in the \texttt{files} Part as described in \vref{ancfiles}. +% \end{itemize} +% \subsection{Tooling up} +% You need the following tools:\par +% \begin{itemize} +% \item an XML editor: I use +% \emph{Emacs} with +% \emph{psgml-mode} and +% \emph{xxml-mode}, but any competent +% XML editor will do +% \item an XSLT2 processor: I use +% \emph{Saxon} (this also means I +% installed \emph{Java}) +% \item a full installation of \LaTeX{} +% \item a PDF reader +% \item XML tools: I find the +% \emph{LTxml2} toolkit from Edinburgh +% University invaluable for ad-hoc querying of +% documents. +% \end{itemize} +% \clearpage +% \section{Setting up a ClassPack document} +% Using \emph{ClassPack} to create and +% maintain \LaTeX{} classes and packages requires the following +% initial steps. These are only done once, at the start of a new +% class or package. A few items need periodic updating, such as +% the version number, when it changes; the revision history; and +% the list of packages, as and when needed.\par +% \begin{enumerate} +% \item setting up the configuration (see \vref{setup}) +% to specify the name, date, version, type, audience, status, +% and other key metadata; +% \item setting up the documentary metadata (see \vref{metadata}) such as the title, author, contact +% details, abstract, and the initial entry in the revision +% history; +% \item setting up the list of packages (see \vref{constraints}) required for +% \begin{enumerate*}[label=\emph{\alph*})] +% \item the documentation (see \vref{docpax}) +% and +% \item the class or package itself (see \vref{classtypax}) +% \end{enumerate*}, plus any additional initialization +% commands needed for the documentation. +% \end{enumerate} +% \emph{Note particularly that the list of packages +% required by the class or package itself is +% \emph{not} stored inline to the code of the +% class or package. It is stored separately for reasons that +% are explained in detail in \vref{constraints}.}\par +% \subsection{Configuration and setup}\label{setup} +% The \texttt{book} element is the outermost container +% for the document. It is used to carry the configuration +% information in attributes, for example:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<book xml:id="classpack" arch="class" version="0" revision="71" + status="beta" conformance="LaTeX2e" condition="2011-06-27" + os="all" audience="lppl" security="0" vendor="Silmaril" + xml:base="tex/latex" xlink:role="xxx" userlevel="cls" + annotations="\raggedright" remap="a4paper,12pt"> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \begin{description}[style=unboxed] +% \item[\texttt{xml:id}\thinspace:]\label{rootid}This \textsc{must} be the +% name of the class or package. It will be used as the +% \LaTeX{} filename (with {\ttfamily{}.cls} or +% {\ttfamily{}.sty} and +% {\ttfamily{}.ins} added automatically), so it +% \textsc{should} be all lowercase +% and \textsc{must} consist of +% letters, digits, and hyphens only, starting with a +% letter.\par +% The XML rules for IDs require this restriction, +% which currently makes it impossible to use ClassPack +% to maintain a class or packages whose name begins with +% a digit. +% \item[\texttt{arch}\thinspace:]\label{arch}The `architecture' of the +% document, which defines the type of file you are going +% to produce; this must be either \texttt{"class"} or \texttt{"package"}, corresponding +% exactly with the value of the \texttt{userlevel} +% attribute below. +% \item[\texttt{userlevel}\thinspace:]\label{userlevel}The file type of the class or package document; +% this must be either {\ttfamily{}cls} or +% {\ttfamily{}sty}, corresponding +% exactly with the value of the \texttt{arch} +% attribute above. +% \item[\texttt{version}\thinspace:]The major version of the class or package. +% Conventionally, development (α) or pre-release +% (β) versions of software start at version +% zero. +% \item[\texttt{revision}\thinspace:]\label{revno}The sub-version or release of your class or +% package. This is combined with the major version +% number, separated by a dot, to produce the complete +% version number.\par +% The most recent revision history entry gets tested +% against this when the file is processed, and an error +% message is displayed if the version numbers do not +% match, as a warning that you have updated one without +% updating the other, and may therefore have forgotten +% to document a change (see the \texttt{revision} +% element in +% `\textbf{\texttt{revhistory}}', the last item in the list in \vref{revhist}). +% \item[\texttt{status}\thinspace:]The development status of the class or package, eg +% \texttt{"alpha"}, \texttt{"beta"}, \texttt{"candidate"}, \texttt{"draft"}, \texttt{"final"}, etc. +% \item[\texttt{conformance}\thinspace:]The \TeX{} format required to process the +% {\ttfamily{}.dtx} document. Only the value +% \texttt{"LaTeX2e"} is supported at +% the moment. +% \item[\texttt{condition}\thinspace:]The version of the format identified in \texttt{conformance}, expressed as an +% ISO date (\texttt{"yyyy-mm-dd"}).\par +% Note that this is \emph{not} in the +% \LaTeX{} format +% ({\ttfamily{}yyyy/mm/dd}). +% \item[\texttt{os}\thinspace:]The operating system[s] for which the class or +% package is relevant. Currently, only the value \texttt{"all"} is supported. +% \item[\texttt{audience}\thinspace:]The licence under which the class or package is +% made available. For normal publicly-available \LaTeX{} +% classes or packages which will be uploaded to CTAN, +% use the value \texttt{"lppl"} +% (\LaTeX{} Project Public Licence).\par +% A copy of the LPPL is distributed with ClassPack +% in a file called {\ttfamily{}lppl.xml}, which +% must be copied or soft-linked (aliased) to each +% directory in which you process ClassPack +% documents.\par +% Classes or packages for private or commercial use +% will probably need to use another value, but it is +% used as a filename, so a {\ttfamily{}.xml} +% file with that name must exist in the directory in +% which your ClassPack document is processed. It must +% contain a +% \emph{DocBook}~\texttt{chapter} +% element containing the text of the licence, which will +% be included at the end of the documentation. +% \item[\texttt{security}\thinspace:]The checksum value emitted by +% \textsf{ltxdoc} when it processes your class +% or package to format your documentation. See the +% documentation for the \textsf{ltxdoc} package for details.\par +% Setting this to zero avoids the \LaTeX{} error +% message during early development, when every edit +% would change the checksum. As with the version values, +% you must update this value, if non-zero, to match the +% one that \textsf{ltxdoc} reports. +% \item[\texttt{vendor}\thinspace:]Your name, or the name of the organisation +% responsible for the work on this class or package. +% \item[\texttt{remap}\thinspace:]Any options to pass to the +% \textsf{ltxdoc} package, such as +% \textbf{\texttt{a4paper}}, \textbf{\texttt{12pt}}, +% etc.\par +% This, and the following \texttt{annotations} +% attribute, make it easier to change the global +% formatting of the documentation. +% \item[\texttt{annotations}\thinspace:]Any \LaTeX{} commands required for global +% application at the start of the documentation that +% cannot easily be included anywhere else (eg +% {\ttfamily{}\textbackslash{}raggedright}, +% {\ttfamily{}\textbackslash{}sffamily}, etc). +% \item[\texttt{xml:base}\thinspace:]The name of the \emph{subdirectory} +% where the resulting {\ttfamily{}.cls} or +% {\ttfamily{}.sty} file should be installed in +% a TDS-compliant \TeX{} installation, relative to the +% {\ttfamily{}texmf/tex/latex} directory of the +% tree. For most packages, this means the name of the +% directory you want created by the installation +% {\ttfamily{}.tds.zip} file, in which the +% {\ttfamily{}.cls} or {\ttfamily{}.sty} +% file will be put. +% \item[\texttt{xlink:role}\thinspace:]\label{selfspec}\textsc{Optional}. If this +% is set to a value, then the package being written will +% be included in the setup for the documentation +% (perhaps so that it can be used in examples), with the +% value of this attribute being used as the optional +% argument to the generated +% {\ttfamily{}\textbackslash{}usepackage} command.\par +% If the package is required with no options, use +% this attribute but set it to null (\texttt{""}). The date constraint is +% added automatically, using the current package date as +% defined by the most recent entry in the +% \texttt{revhistory}.\par +% Note that this only works for packages, not +% classes. Classes cannot not be documented using +% themselves. +% \end{description} +% It is essential to get these values correct, otherwise +% subsequent processing will produce unexpected +% results, or no results at all.\par +% \subsection{Metadata}\label{metadata} +% The titling, specification of packages (separately for +% the documentation and for the class or package itself), +% revision history, abstract, copyright, and availability are +% all kept at the top of the document in an element called +% \texttt{info}, immediately after the \texttt{book} start-tag:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<info> + <cover>...</cover> + <!-- THE METADATA STARTS HERE --> + <title>XML mastering for &LaTeX; document classes... + <author>... + <copyright>... + <releaseinfo>http://latex.silmaril.ie/software</releaseinfo> + <annotation>... + <abstract>... + <revhistory>... +</info> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Of these, the \texttt{cover} element is the most +% complex, as it is [ab]used to hold all the details of +% packages and settings required for the class or package +% \emph{and} for the production of the +% documentation. It therefore gets the whole of +% \vref{constraints} to itself.\par +% The other metadata element types are more obvious, and +% largely use the \emph{DocBook} markup as +% intended.\par +% \begin{description}[style=unboxed] +% \item[\texttt{title}\thinspace:]This contains the title of the class or package in +% natural language. This is \emph{not} the +% content of the {\ttfamily{}\textbackslash{}title} command in +% \LaTeX{} terms, in the {\ttfamily{}.dtx} file, +% which is automatically preset to the phrase +% `The \textsf{{\itshape name}} +% \LaTeXe{} document class' (or +% `package'; where +% {\itshape name} is the name of your +% class or package as specified in the \texttt{xml:id} attribute of the +% \texttt{book} root element).\par +% The title you give in +% \emph{this}~\texttt{title} +% element is the explanatory subtitle which appears +% \emph{under} the automatically-generated +% one on the first page of the typeset +% documentation. +% \item[\texttt{author}\thinspace:]The \texttt{author} element provides identity +% markup for the author[s], using a +% \texttt{personname} element for each author, +% containing subelements for firstname, surname, and +% other forms of naming; optionally followed by an +% \texttt{affiliation} element, where you can identify +% employer or other status; address; email; and URI, as +% in the following example. The name, affiliation, and +% email address are used in the +% {\ttfamily{}\textbackslash{}author} command of the +% {\ttfamily{}.dtx} file.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<author role="maintainer"> + <personname> + <firstname>Peter</firstname> + <surname>Flynn</surname> + </personname> + <affiliation> + <orgname>Silmaril Consultants</orgname> + <orgdiv>Textual Therapy Division</orgdiv> + </affiliation> + <address>Cork, Ireland</address> + <email>peter@silmaril.ie</email> + <uri>http://blogs.silmaril.ie/peter</uri> + <contrib role="sponsor">UCC</contrib> +</author> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% For multiple authors, you must enclose multiple +% \texttt{author} elements (one per author) in an +% outer \texttt{authorgroup} container element. One of +% the authors must be identified as the maintainer of +% the package or class, by adding the \texttt{role} +% attribute with the value +% {\ttfamily{}maintainer}.\par +% A \texttt{contrib} element with a \texttt{role} attribute set to \texttt{"sponsor"} can be added in an +% \texttt{author} block, to give the +% name of an organisation sponsoring the development of +% the class or package. +% \item[\texttt{copyright}\thinspace:]This element lets you identify the \texttt{year} +% and the name of the \texttt{holder} (you, your +% employer, or some other entity). +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<copyright> + <year>2012</year> + <holder>Silmaril Consultants</holder> +</copyright> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \item[\texttt{releaseinfo}\thinspace:]In the absence of other ways of identifying where +% to find your class or package (assuming it will +% eventually find its way onto CTAN), this element can +% be used to hold the URI of a location where it can be +% downloaded, such as your personal or business web +% site. +% \item[\texttt{annotation}\thinspace:]This element is used for a warning or notice you +% want placed in the Preamble of the +% {\ttfamily{}.ins} file, which is used for +% extracting your class or package from the +% {\ttfamily{}.dtx} file, where it will be seen +% by users installing the software. +% \item[\texttt{abstract}\thinspace:]The Abstract is formatted on the front page of +% your documentation. Like any abstract, it should +% summarise what the class or package does, and who might +% want to use it.\par +% The \texttt{abstract} element may start with an +% optional \texttt{title} element, which (if present) +% will be used to change the value of the +% {\ttfamily{}\textbackslash{}abstractname} in the +% {\ttfamily{}.dtx} file +% (`Summary' is a common +% choice).\par +% The rest of the abstract is just paragraphs; note +% that lists, block quotations, figures, tables, etc are +% not allowed in an Abstract. +% \item[\texttt{revhistory}\thinspace:]\label{revhist}This holds the top-level information about each +% major and minor revision, outlining the main changes. +% The version number of the most recent revision, as +% identified by the latest value of the \texttt{conformance} attribute of the +% \texttt{date} element, must match the version number +% composed from the major version and the revision in +% the \texttt{book} root element (see `\textbf{\texttt{revision}}', the \ordinalstringnum{5} item in the list in \vref{revno}).\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<revision version="0.72"> + <date conformance="2012-02-11"/> + <revdescription> + <itemizedlist> + <title>Wrote internal documentation</title> + <listitem> + <para>Created the classpack.xml template + as an example.</para> + </listitem> + </itemizedlist> + </revdescription> +</revision> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Comments on individual changes to the code should +% be documented \emph{at the code +% location}, using the \texttt{remark} +% element (see \vref{maintenance}), eg\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<remark version="0.70" revision="2010-05-29">Added + timestamp</remark> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% These \texttt{remark} elements get collated as +% {\ttfamily{}\textbackslash{}changes} commands, and gathered +% together in the changelog by \textsf{ltxdoc} +% during processing. +% \end{description} +% \subsection{Packages and related commands}\label{constraints} +% As mentioned above, the \texttt{cover} element is used +% to provide a place where packages and other \LaTeX{} +% preliminaries can be specified. Using this structure means +% each entry is separately editable, and the same structure is +% used both for packages for the documentation +% \emph{and} packages for the class or package +% itself.\par +% It would of course have been possible just to allow a +% slab of \LaTeX{} code at these points, but that would have made +% commenting and documentation harder, and would also have +% made it more difficult to perform an XML +% element-copy--element-paste or an XInclude when using +% one package or class's settings as the basis for another.\par +% The most important reason is that specifying package +% lists as separately-identifiable blocks makes it possible to +% automate the invocation of frequently-used packages, +% parameters, options, or settings which you may store +% separately for re-use (see \vref{autospec}) by +% adding your own modifications that you like to have included +% whenever you use a particular package.\par +% In particular, the +% \emph{autopackage} feature added to +% ClassPack in v0.74 means that most packages needed for +% documentation are now detected automatically on the basis of +% features you use in your documentation, making it +% unnecessary to specify them by hand. For example, if you use +% compact lists, ClassPack will detect this and add the +% \textsf{enumitem} package for you.\par +% The XSLT2 program also uses this markup in order to +% modify the behaviour of the \LaTeX{} code at several points +% (such as fixing the broken abstract formatting when the +% \textsf{parskip} package is used).\par +% There are at least two, possibly four, sections in the +% \texttt{cover} element where the packages, commands, and +% other data can be defined:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<constraintdef xml:id="docpackages"> + ...packages for the user documentation are defined here... +</constraintdef> + +<constraintdef xml:id="startdoc"> + ...special commands for the user documentation go here... +</constraintdef> + +<constraintdef xml:id="clspackages" linkend="options"> + ...packages needed for the class or package are defined here... +</constraintdef> + +<constraintdef xml:id="manifest"> + ...files to add to the MANIFEST/zip file are listed here... +</constraintdef> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% These exact \texttt{xml:id} values +% are mandatory when the relevant \texttt{constraintdef} +% elements are used, as they are referenced from elsewhere in +% the document by the XSLT2 program. The only variation is +% that when writing a package ({\ttfamily{}.sty} +% file), the \texttt{"clspackages"} must read +% \texttt{"stypackages"} instead. The first +% three letters are used to match the three-letter filetype +% used as the value of the \texttt{arch} +% attribute that you specified on the \texttt{book} root +% element (see `\textbf{\texttt{arch}}', the \ordinalstringnum{2} item in the list in \vref{arch}).\par +% Each \texttt{constraintdef} element can +% hold one or (in some circumstances, more) of the following +% element types:\par +% \begin{itemize} +% \item \texttt{segmentedlist} (in a +% \texttt{docpackages}, \texttt{clspackages}, or +% \texttt{stypackages} type of \texttt{constraintdef}\emph{only}), a list structure used to +% specify the packages required: see \vref{packspec}; +% \item \label{cmdsynopsis}\texttt{cmdsynopsis}, used for defining +% \emph{user documentation} setup commands +% to be placed \emph{in} the Preamble. This +% is only meaningful in the \texttt{"docpackages"} type of +% \texttt{constraintdef}: see \vref{cmdspec}; +% \item \texttt{procedure}, used for holding blocks of +% \emph{user documentation} setup commands +% to be placed \emph{after} the Preamble +% (that is, at the start of the document body, after the +% \verb|\begin{document}| command). This is +% only meaningful in the \texttt{"docpackages"} type of +% \texttt{constraintdef}.\par +% Note that this is distinct from commands to be +% placed \emph{in} the Preamble, which are +% held in a more structured manner in the +% \texttt{cmdsynopsis} element deacribed above: see +% \vref{addcmds}; +% \item \texttt{simplelist}, a list whose +% \texttt{member} elements are used to name additional +% files to be included in the distribution zip file +% ({\ttfamily{}MANIFEST}). This is only meaningful +% in a \texttt{manifest} type of +% \texttt{constraintdef}: see +% \vref{manifestfiles}. +% \end{itemize} +% \subsubsection{Specifying packages}\label{packspec} +% There are three parts to using +% \texttt{constraintdef} for this:\par +% \begin{enumerate}[noitemsep] +% \item specifying packages for your user documentation (see +% \vref{docpax}); +% \item specifying packages for the class or package you +% are writing (see \vref{classtypax}); +% \item automating the inclusion of extra settings to be +% used whenever you specify a particular package (see +% \vref{autospec}). +% \end{enumerate} +% For the first two, the \texttt{segmentedlist} +% element is used. This contains a sequence of +% \texttt{seglistitem}\thinspace{}s, one per package, each containing a +% \texttt{seg} element holding the package name. An +% optional \texttt{segtitle} element may start the list, +% and if present, is used as a comment (for the +% documentation packages) or a subheading (class or package +% packages).\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<segmentedlist> + <segtitle>Packages required for documentation</segtitle> + <seglistitem role="Use the Charter typeface for documentation."> + <seg version="2005-04-12">charter</seg> + </seglistitem> + <seglistitem role="Use Helvetica as the sans-serif, but scale it + to fit"> + <seg role="scaled=0.8333">helvet</seg> + </seglistitem> + ... +</segmentedlist> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Each \texttt{seglistitem} provides for +% a documentary comment about why this package is required, +% using the \texttt{role} +% attribute. In the case of the packages for your own class +% or package, this comment is reproduced in the +% documentation of the code.\par +% The package itself is specified as the content of the +% \texttt{seg} element in each item.\par +% Any options for the package being loaded must be +% supplied in the \texttt{role} attribute +% of the \texttt{seg} element. If the +% package must conform to a specific version, the date must +% be provided (in ISO format) in the \texttt{version} attribute.\par +% \paragraph{Declaring packages needed for your documentation}\label{docpax} +% Packages required for your documentation must be +% included in the type of list described above, in the +% \texttt{constraintdef} element that has the \texttt{xml:id} value of \texttt{"docpackages"}. Note that some +% packages are automatically when certain types of +% formatting are implied: see \vref{autopackage} for details.\par +% The relevant {\ttfamily{}\textbackslash{}usepackage} commands +% get included in the {\ttfamily{}.dtx} file right +% after the \verb|\begin{document}| +% command.\par +% If you also want the package you are maintaining to +% be included in the documentation (perhaps so you can use +% it for examples), remember to set the \texttt{xlink:role} attribute on the +% \texttt{book} root element as described in `\textbf{\texttt{xlink:role}}', the last item in the list in \vref{selfspec}.\par +% See \vref{autospec} for details of how to +% specify package command settings that you want included +% by default every time you specify a particular +% package.\par +% \paragraph{Declaring packages needed by the class or package +% itself}\label{classtypax} +% All the packages required for the class or package +% being written must be included in the type of list +% described above, in the \texttt{constraintdef} element +% that has the \texttt{xml:id} value +% of \texttt{"clspackages"} (for classes) +% or \texttt{"stypackages"} (for +% packages).\par +% \subparagraph{Specifying where in the {\ttfamily{}.dtx} +% file to output them\thinspace:} +% Because your class or package design may include +% preliminary commands needed before packages are +% included, the relevant {\ttfamily{}\textbackslash{}RequirePackage} +% commands must be added to the {\ttfamily{}.dtx} +% file \emph{in a location that you must specify +% yourself}. This is done by giving the \texttt{linkend} attribute on the +% enclosing \texttt{constraintdef} element the value +% of an \texttt{xml:id} which you +% have assigned to a chapter or section in your +% annotated code.\par +% \emph{There is no default: you must specify +% this link yourself, otherwise the list of required +% packages will not be output.}\par +% The reason is that you may need to write some of +% your class or package code (option declarations, for +% example, or a {\ttfamily{}\textbackslash{}LoadPackage} command), +% \emph{before} the specified packages are +% loaded.\par +% \begin{itemize} +% \item If the chapter or section you have specified +% has content (text) in it, the +% {\ttfamily{}\textbackslash{}RequirePackage} commands are +% output as the content of a new chapter or section +% immediately preceding or following it, as +% specified by the value of the \texttt{role} +% attribute (`before' or +% `after'). +% \item If the chapter or section you have specified +% is (deliberately) empty, the +% {\ttfamily{}\textbackslash{}RequirePackage} commands are +% output as the content of that chapter or +% section. +% \end{itemize} +% As an example, let us say you specify the +% \texttt{constraintdef} with\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<constraintdef xml:id="clspackages" linkend="options" role="after">... +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% You must then have a chapter or section in your +% documented code with the \texttt{xml:id} value of \texttt{"options"}. If +% it is empty (no character data content) like this:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<sect1 xml:id="options"> + <title/> + <para/> +</sect1> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% then the list of {\ttfamily{}\textbackslash{}RequirePackage} commands will +% be output in its place.\par +% If, on the other hand, the specified section +% has text and code of its own:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<sect1 xml:id="options"> + <title>Options</title> + <para>text...</para> + <programlisting> +\some{code} + </programlisting> +</sect1> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% then the list of {\ttfamily{}\textbackslash{}RequirePackage} +% commands will be output immediately after it, as a new +% section at the same level.\par +% In both cases, the \texttt{segtitle} of the +% \texttt{segmentedlist} will be used as the title of +% the section.\par +% \subsubsection{Automated settings for declared packages}\label{autospec} +% There are several reasons for automating package setup:\par +% \begin{itemize} +% \item Many \LaTeX{} authors and designers have +% `favourite' settings that they +% like to use every time they specify a particular +% package. +% \item Some options have now become the \emph{de +% facto} convention for their package, +% (for example, the \textbf{\texttt{T1}} option on the +% \textsf{fontenc} package). +% \item There are commands that need to be used whenever a +% particular package is invoked (for example, the +% \textsf{makeidx} package means you need to +% add the {\ttfamily{}\textbackslash{}makeindex} command to the +% Preamble). +% \item Some packages are only needed in the documentation +% if a particular formatting feature is used (for +% example compact list spacing requires the +% \textsf{enumitem} package). This avoids you +% having to remember to include a specific package when +% you use such a feature; and to remove it if you cease +% to use the feature. +% \end{itemize} +% To help automate these, an ancillary (lookup) file +% called {\ttfamily{}prepost.xml} is used, which +% is a \emph{DocBook} document with a +% \texttt{refsection} root element type containing two +% \texttt{procedure} elements, shown below.\par +% The {\ttfamily{}prepost.xml} file must be in +% the directory specified by your setting of the +% {\ttfamily{}repo} runtime parameter.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<refsection> + <title>Commands to use before and after packages</title> + <procedure xml:id="prepackage"> + ...steps... + </procedure> + <procedure xml:id="postpackage"> + ...steps... + </procedure> +</refsection> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% The \texttt{"prepackage"} procedure +% is for material which needs to go +% \emph{before} a package is invoked. The \texttt{"postpackage"} procedure is for +% material which needs to go \emph{after} a +% package is invoked.\par +% \paragraph{Identifying each package} +% Within these procedures, each package is identified in +% a \texttt{step} element.\par +% \begin{itemize}[noitemsep] +% \item the \texttt{remap} attribute +% holds the package name; +% \item the \texttt{condition} +% attribute holds the type[s] of output it is intended +% to be effective for, \texttt{"doc"}, \texttt{"cls"}, or \texttt{"sty"} (space-separated if +% more than one); +% \item the \texttt{role} attribute +% holds any default options (comma-separated); +% \item an optional \texttt{para} element holds a +% textual description of the package and its use. This +% is only meaningful for packages marked in the \texttt{condition} attribute for +% use in the class or package. If present, this gets +% output to the code documentation. +% \end{itemize} +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<step role="utf8x" remap="inputenc" condition="cls sty"> + <para>UTF-8 is the default character set, to allow for use of + any character in any writing system. Some characters + are not specified for all fonts, so may have to be + specified manually.</para> +</step> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% In this example, specifying +% \textsf{inputenc} in the document, in a +% \texttt{seg} element as described in \vref{packspec}, results in the package being +% added with {\ttfamily{}\textbackslash{}RequirePackage} to the +% class or package code.\par +% \paragraph{Automating inclusion}\label{autopackage} +% Each \texttt{step} may contain one +% or more \texttt{constructorsynopsis} elements which +% specify the condition[s] under which the package will +% automatically be included \emph{without it needing +% to be specified} in a \texttt{seg} element +% as described in \vref{packspec}\par +% \begin{itemize}[noitemsep] +% \item the \texttt{condition} +% attribute holds the name of an element type which, +% if present in the documentation, will cause the +% package to be included automatically; +% \item one or more \texttt{methodparam} subelements +% can be used to specify attribute conditions on the +% element type named in the \texttt{condition} +% attribute: +% \begin{itemize}[noitemsep] +% \item the \texttt{parameter} element specifies +% the name of an attribute. If no +% \texttt{modifier} element is present, the +% specified attribute is simply tested for +% presence (Boolean test) +% \item a +% \texttt{modifier} element is used to +% specify a value for which the attribute is tested +% \end{itemize} +% \end{itemize} +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<step remap="dcolumn" condition="doc"> + <constructorsynopsis condition="colspec"> + <methodparam> + <parameter>align</parameter> + <modifier>char</modifier> + </methodparam> + </constructorsynopsis> +</step> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% In the example above, a \texttt{colspec} element +% anywhere in the document with an \texttt{align} attribute equal to \texttt{"char"} will cause the +% \textsf{dcolumn} package to be included +% automatically (the package handles decimal-column +% alignment).\par +% A special case involves the use of the \texttt{funcparams} subelement instead of +% the \texttt{parameter} attribute, to +% specify that an IDREF attribute must be checked for the +% \emph{type} of element it refers to.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<step condition="doc" remap="fmtcount"> + <constructorsynopsis condition="xref"> + <methodparam> + <funcparams>linkend</funcparams> + <modifier>varlistentry</modifier> + </methodparam> + <methodparam> + <funcparams>linkend</funcparams> + <modifier>listitem</modifier> + </methodparam> + </constructorsynopsis> +</step> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% In this example, the \textsf{fmtcount} +% package will be included if there is an \texttt{xref} +% element anywhere in the documentation with a \texttt{linkend} attribute which points +% at a \texttt{varlistentry} or \texttt{listitem} +% element~--- that is, the \texttt{xml:id} attribute whose value +% matches the \texttt{linkend} value +% is on such an element type (the +% \textsf{fmtcount} package enables ordinal +% counting, needed when making a reference to an item in a +% list that is not numbered).\par +% \paragraph{Adding extra code before or after a package} +% Each \texttt{step} may also contain +% one or more \texttt{constraintdef} elements containing +% \texttt{cmdsynopsis} elements containing +% \texttt{command} elements to hold \LaTeX{} code to be +% inserted, in exactly the same format as shown in \vref{constraints}.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<step remap="apacite" condition="doc"> + <constraintdef> + <cmdsynopsis> + <command>\AtBeginDocument{\edef\ApaciteRestoreAtCode% + {\catcode`@=\the\catcode`@\relax}}</command> + </cmdsynopsis> + </constraintdef> +</step> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% If this step is given in the \texttt{"prepackage"} section, the code is +% inserted \emph{before} the package is +% included; if the step is given in the \texttt{"postpackage"} section, the code +% is inserted \emph{after} the package is +% included.\par +% A package listed in this file can be given default +% options by specifying them in the \texttt{role} attribute of the +% \texttt{step} element. It is then unnecessary to specify +% them additionally in the main document (although it won't +% matter, as they are checked for duplication).\par +% \subsubsection{Defining commands required for documentation setup}\label{cmdspec} +% Documenting classes or packages will often require +% additional commands to be defined in order to set up special +% counters or lengths, establish conditions, or create new +% macros to be used in your documentation.\par +% \emph{This is quite different from needing to +% issue standard \LaTeX{} commands in order to +% set existing standard \LaTeX{} values, such as }\verb|\setlength{\parskip}{5mm}|. +% \emph{That kind of adjustment is dealt with in \vref{addcmds}.}\par +% Commands to be defined for the documentation to work +% must go in \texttt{cmysynopsis} elements in the +% \texttt{constraintdef} element that has the \texttt{xml:id} value of \texttt{"docpackages"}, +% \emph{after} the end of the +% \texttt{segmentedlist} of packages.\par +% The commands are specified with the command name +% (control sequence) or environment name +% \emph{separately} from the definition: this +% allows a structure to be imposed which enables the +% identification and re-use of these specifications.\par +% In giving the commands (control sequences) that you +% define, you specify just the names, with no backslash; and +% the definitions you give must not have the outermost set +% of curly braces. Both the backslash and the curly braces +% are added by the XSLT2 program when writing the +% {\ttfamily{}.dtx} file.\par +% Commands containing an `at' +% sign ({\ttfamily{}@}) in their name or +% definition are automatically enclosed in +% {\ttfamily{}\textbackslash{}makeatletter} and +% {\ttfamily{}\textbackslash{}makeatother} commands.\par +% There are several attributes which specify what you +% are defining, so that the data is output to the +% {\ttfamily{}.dtx} file correctly:\par +% \begin{description}[style=unboxed] +% \item[Simple commands\thinspace:]A simple new \LaTeX{} command with a textual +% expansion is defined with the \texttt{command} +% element holding the name of the command being +% defined, and an \texttt{arg} element holding the +% definition.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command>LyX</command> + <arg>L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX</arg> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition: +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\newcommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \item[Renewed commands\thinspace:]If the command is a renewal of an existing +% command, use a \texttt{role} +% attribute of \texttt{"renew"} on +% the \texttt{command} element.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command role="renew">vstrut</command> + <arg>\vrule height1.2em depth.6667ex width0pt</arg> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition: +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\renewcommand{\vstrut}{\vrule height1.2em depth.6667ex width0pt} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \item[Plain \TeX{} commands\thinspace:]A {\ttfamily{}\textbackslash{}def} command in Plain \TeX{} +% syntax can be specified with the attribute \texttt{xml:lang} set to \texttt{"TeX"} on the +% \texttt{command} element.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis xml:lang="TeX"> + <command>hline</command> + <arg>\noalign{\ifnum0=`}\fi + \@ifnextchar[{\@@hline}{\@@hline[\arrayrulewidth]}</arg> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition: +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\def\hline{\noalign{\ifnum0=`}\fi + \@ifnextchar[{\@@hline}{\@@hline[\arrayrulewidth]} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \item[Commands with arguments\thinspace:]If a defined command needs arguments, specify +% the number of arguments in the \texttt{wordsize} attribute of the +% \texttt{arg} element:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command>componentbox</command> + <arg wordsize="2">\begin{tabular}[m]{@{}|c|@{}}\hline + \cellcolor{#1}\hbox to1em{\hss%\vrule height1em width0pt + \raisebox{.2ex}{\ttfamily\tiny#2}\hss}\\\hline + \end{tabular}</arg> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\newcommand{\componentbox}[2]{\begin{tabular}[m]{@{}|c|@{}}\hline + \cellcolor{#1}\hbox to1em{\hss%\vrule height1em width0pt + \raisebox{.2ex}{\ttfamily\tiny#2}\hss}\\\hline + \end{tabular} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% If a default first argument is required, the +% value must be provided in the \texttt{condition} attribute of the +% \texttt{command} element.\par +% There is no provision in this version of the +% software for the specification of the extended argument array +% provided by the \textsf{xargs} package. +% \item[Counters, lengths, and \texttt{\textbackslash{}newwrite}s\thinspace:]Counters, lengths, and +% {\ttfamily{}\textbackslash{}newwrite} commands can be defined +% by using the \texttt{remap} +% attribute set to the value \texttt{"counter"}, \texttt{"length"} or \texttt{"newwrite"} as appropriate. in +% this case, no \texttt{arg} element is +% required unless a counter or length is to be +% assigned a default value.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command remap="newwrite">fnotes</command></cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\newwrite\fnotes +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% However, if the length or counter needs an +% initial value, give it in an \texttt{arg} element.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command remap="length">revmarg</command> + <arg>3cm</arg> +</cmdsynopsis> +<cmdsynopsis> + <command remap="counter">cards</command> + <arg>42</arg> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition: +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\newlength{\revmarg}\setlength{\revmarg}{3cm} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \item[References to attributes\thinspace:]One specialist use is predefined: assigning the +% type of document (class or package) to a command:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command>classorpackage</command> + <arg remap="arch"/> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\newcommand{\classorpackage}{...} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% where [\dots{}] is the type of the current +% document. The \texttt{arch} element in this case +% has no content, but uses the \texttt{remap} attribute to specify +% the name of an attribute (here, \texttt{arch}) on the +% \texttt{book} root element. This results in the +% command {\ttfamily{}\textbackslash{}classorpackage} being set +% equal to \texttt{"class"} or \texttt{"package"}; this value is used +% to provide a value for the entity \texttt{\&doctype;}. This entity can +% then be used in shared XML documentation to refer to +% the current document by type, knowing that it will +% be correctly translated to the type of document when +% the {\ttfamily{}.dtx} file is +% created. +% \item[Environments\thinspace:]The same principle applies to environments as to +% commands, but there are two arguments: one for the +% `before' and one for the +% `after':\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<cmdsynopsis> + <command remap="environment">panel</command> + <arg wordsize="1" condition="\relax">\begin{Sbox}% + \begin{minipage}{3in}% + \if#1\relax\else\subsubsection*{#1}\fi</arg> + <arg>\end{minipage}\end{Sbox}% + \begin{center}\fbox{\theSbox}\end{center}%</arg> +</cmdsynopsis> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This creates the definition:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +\newenvironment{panel}{% + \begin{Sbox}% + \begin{minipage}{3in}% + \if#1\relax\else\subsubsection*{#1}\fi +}{% + \end{minipage}\end{Sbox}% + \begin{center}\fbox{\theSbox}\end{center}% +} +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% The controls for the number of arguments and any +% default argument must go on the first \texttt{arg} +% element. The same rule about setting the \texttt{role} attribute to \texttt{"renew"} applies as for +% generating commands. +% \end{description} +% \subsubsection{Additional setup commands}\label{addcmds} +% Quite separately from the business of defining new +% commands (or redefining existing ones) dealt with in \vref{cmdspec}, there is also usually a need to issue +% commands that establish or reset a value needed for the +% documentation.\par +% Commands that you want implemented every time you use +% a particular package should go in your +% {\ttfamily{}prepost.xml} file, as described in +% \vref{autospec}. This section is for commands or +% settings that only refer to the documentation for the +% current class or package being written.\par +% These commands go in the third of the types of +% \texttt{constraintdef} element, with the \texttt{xml:id} value of \texttt{"startdoc"} because they are output +% at the start of the documentation +% (\emph{after} the +% \verb|\begin{document}|).\par +% They follow exactly the same syntax as those in the +% {\ttfamily{}prepost.xml} file:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<constraintdef xml:id="startdoc"> + <procedure> + <step> + <cmdsynopsis> + <command>\setcounter{tocdepth}{5}</command> + <command>\setcounter{secnumdepth}{5}</command> + <command>\def\@@doxdescribe#1#2{\endgroup + \ifdox@noprint\else\marginpar{\raggedleft + \textcolor{DarkRed}{\@nameuse{PrintDescribe#1}{#2}}}\fi + \ifdox@noindex\else\@nameuse{Special#1Index}{#2}\fi + \endgroup\@esphack\ignorespaces}</command> + </cmdsynopsis> + </step> + </procedure> +</constraintdef> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% The {\ttfamily{}\textbackslash{}@@doxdescribe} command is an +% oddity here: it appears not to work if placed in the +% {\ttfamily{}prepost.xml} document, where it gets +% issued in the Preamble; instead it goes here, where it +% gets issued after the +% \verb|\begin{document}|.\par +% \subsubsection{The Manifest}\label{manifestfiles} +% The fourth and last variant of the +% \texttt{constraintdef} element (with the \texttt{xml:id} attribute of \texttt{"manifest"}) is very simple. It is a +% list of the names of any separate files that you want +% included in the Zip file that the {\ttfamily{}build} command produces. This +% means anything other than the {\ttfamily{}.dtx}, +% {\ttfamily{}.ins}, and {\ttfamily{}.pdf} +% files that get included automatically.\par +% The content of this element is a +% \texttt{simplelist}, containing \texttt{member} +% elements, one per file:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<constraintdef xml:id="manifest"> + <simplelist> + <member>doctexbook.dtd</member> + <member>db2dtx.xsl</member> + <member>db2bibtex.xsl</member> + <member>prepost.xml</member> + <member>lppl.xml</member> + <member>decommentbbl.awk</member> + </simplelist> +</constraintdef> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \subsubsection{The README file}\label{readme} +% One additional output file is produced automatically +% by the XSLT2 program: the plaintext README file which +% accompanies all classes and packages, with a brief +% description of usage and installation, for the benefit of +% people who cannot or will not read the PDF +% documentation.\par +% This is generated automatically from the file +% {\ttfamily{}readme.xml}, which is a DocBook5 +% \texttt{chapter} document with some changes to the +% character entities to accommodate plain text. Note that +% this document does \emph{not} use the +% {\ttfamily{}doctexbook.dtd} used for your normal +% class or package {\small XML} document. A sample +% is included in the \textsf{classpack} +% distribution.\par +% The {\ttfamily{}readme.xml} file uses the +% \texttt{olink} element type to act as a placeholder for +% transcluded atomic information from the main document +% (pending implementation of the proposed DocBook +% Transclusions method). This element must have a +% \texttt{targetptr} and a \texttt{type} attribute +% specifying (respectively) the name of the element type and +% the relevant attribute in the main document. For example, +% to include the name of the class or package, we +% use:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +<olink targetptr="book" type="xml:id"/> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Two other element types have also had +% \texttt{targetptr} and \texttt{type} attributes +% added: \texttt{sect1} and \texttt{anchor}. These are +% used to specify the inclusion of whole sections or +% fragments of the main document, such as the Abstract or +% the Copyright.\par +% The text is reformatted in plain text, omitting all +% markup. Only a few element types have been implemented for +% this in this version: see the ancillary XSLT2 routines in +% {\ttfamily{}db2plaintext.xsl} for details.\par +% The resulting {\ttfamily{}README} file +% includes the Abstract from your class or package +% {\small XML} document as the first section. The +% {\ttfamily{}db2plaintext.xsl} program uses a +% template called \DescribeTemplate{normtext}\texttt{normtext} to +% reformat text. This handles the conversion of entities +% which occur in your Abstract (those declared in +% {\ttfamily{}doctexbook.dtd}): by default, \texttt{\&TeX;}, \texttt{\&LaTeX;}, and \texttt{\ } are catered for, but if +% you use any others, you must modify the code in this +% template to deal with them, using a nested +% \DescribeFunction{replace()}\texttt{replace()} function.\par +% \clearpage +% \section{Using \emph{ClassPack}}\label{content} +% The body of your docmentation is held in a \texttt{part} +% element with the \texttt{xml:id} attribute +% set to \texttt{"doc"}.\par +% The tag-set of \emph{DocBook} is very +% large, and only a part of it is needed for this purpose, +% although support for additional elements is easily added in +% the XSLT2 program.\par +% The following sections describe the elements that are +% currently supported, for the hierarchical structure (chapters, +% sections, subsections, etc); the block-level structure +% (tables, figures, lists, etc; what +% \emph{DocBook} refers to as the +% `pool') and for the inline markup (element types +% in mixed content, used mostly in paragraph-like +% situations).\par +% \subsection{Hierarchical markup}\label{hierarchy} +% The outline top-level structure is described in \vref{invocation} and \vref{setup}.\par +% The \texttt{part}\thinspace{}s do not have any title or direct +% textual content themselves: they just act as containers to +% keep the user documentation separate from the documented +% code and any other files that may be stored and +% extracted.\par +% Within a \texttt{part}, the major subdivision is the +% \texttt{chapter}, which translates to a +% {\ttfamily{}\textbackslash{}section} in the {\ttfamily{}.dtx} +% file. You should use the \texttt{chapter} element as your +% major structural division. Each part (user documentation, +% documented code, and additional files) must have at least +% one chapter.\par +% Within chapters, the sections, subsections, and lower +% structural divisions are identified with \texttt{sect1}, +% \texttt{sect2}, and so on. You can use as many or as few +% of these as you feel you need to organise your writing. In +% the documented code, it is a good idea to modularise the +% class or package, so that you can describe each part of it +% in a logical and consistent manner.\par +% The nested arrangement of chapters containing sections +% conaining subsections should already be familiar to \LaTeX{} +% users, although \LaTeX{} itself only uses headings as +% separators, and has no physical +% `containment' of the hierarchical +% divisions of a document in the way that it does for the +% block-level structures (environments).\par +% Each of these hierarchical divisions must have a +% \texttt{title} element (see `\textbf{\texttt{title}}', the first item in the list in \vref{title}), +% and can also have an \texttt{xml:id} +% attribute to act as a target (like a \LaTeX{} +% {\ttfamily{}\textbackslash{}label}) for cross-referencing (see `\textbf{\texttt{xref}}', the last item in the list in \vref{xref}).\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<part xml:id="doc">... + <chapter xml:id="ui"> + <title>User interface</title> + ... + <sect1> + <title>Font selection</title> + ... + </sect1> + <sect1 xml:id="margins"> + <title>Margins and spacing</title> + ... + </sect1> + </chapter> + ... +</part> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% \subsection{Structural markup (block-level elements)}\label{pool} +% Within chapters, sections, subsections, etc, you can +% have any arrangement or mixture of paragraphs, tables, +% lists, figures, quotations, code samples, and other +% conventional structures that will be familiar to you from +% \LaTeX{} environments.\par +% The only requirement is that each hierarchical division +% must start with a title, and must contain at least one other +% structural component. Supported element types are:\par +% \begin{description}[style=unboxed] +% \item[\texttt{title}\thinspace:]\label{title}a title, used in all chapters, [sub]sections, +% figures, and tables (where it equates to a caption); +% and also optionally in lists, sidebars, and other +% block-level element types. +% \item[\texttt{para}\thinspace:]for normal paragraphs. +% \item[\texttt{itemizedlist}\thinspace:]for bulleted lists, containing +% \texttt{listitem}\thinspace{}s which contain paragraphs. +% \item[\texttt{orderedlist}\thinspace:]for numbered lists; the structure is identical to +% an \texttt{itemizedlist}. +% \item[\texttt{variablelist}\thinspace:]for description lists like this one (the +% \texttt{term} element in each +% \texttt{varlistentry} holds the reference term; the +% descriptive part is in the same \texttt{listitem} +% structure as for itemized and bulleted lists. +% \item[\texttt{simplelist}\thinspace:]for plain unnumbered, unbulleted lists; each item +% goes in a \texttt{member} element. +% \item[\texttt{programlisting}\thinspace:]for listings of code: use without attributes in +% the Code section. In the Documentation section, the +% basic style is in {\ttfamily{}\textbackslash{}small} type, +% black, {\ttfamily{}\textbackslash{}ttfamily}, and the following +% attributes control the appearance: +% \par\medskip{\sffamily\small +% \begingroup +% \centering +% \begin{tabular}{@{}% +% >{\ttfamily\prestrut\arraybackslash}l<{\poststrut\arraybackslash}% +% >{\raggedright{}\prestrut\arraybackslash}p{9cm}<{\poststrut\arraybackslash}% +% @{}} +% \hline +% \vstrut +% wordsize&either a size command or a +% pointsize/baseline like +% {\ttfamily{}8/9}\\ +% language&{\ttfamily{}LaTeX} (default), +% {\ttfamily{}DocBook}, +% {\ttfamily{}bash}, or another +% language supported by the +% \textsf{listings} package\\ +% arch&{\ttfamily{}framed} will box +% the listing\\ +% remap&\LaTeX{} styling commands for tokens to +% emphasise\\ +% annotations&comma-separated list of tokens to +% emphasise\\[2pt]\hline +% \end{tabular} +% \par\endgroup +% } +% \item[\texttt{figure}\thinspace:]for Figures, containing a \texttt{caption} and a +% \texttt{media} element. +% \item[\texttt{table}\thinspace:]for Tables; the structure is explained in detail +% in \vref{table}. +% \item[\texttt{sidebar}\thinspace:]for sidebars. +% \item[\texttt{warning}\thinspace:]for warnings. +% \end{description} +% \subsubsection{Ancillary files documented inline}\label{secfiles} +% These are files which you want extracted at +% installation time, which you describe +% \emph{and} show in the user documentation +% (the \texttt{doc} part).\par +% \emph{Files which you want extracted which are +% \emph{not} documented or shown in the user +% documentation must go in the \texttt{files} part (see +% \vref{ancfiles}).}\par +% \subsubsection{Bibliography}\label{bibs} +% If bibliographic citations and reference is required, +% the references themselves must be stored in a +% \texttt{bibliography} element immediately after the last +% \texttt{chapter} element in \emph{either} +% the `doc' part +% \emph{or} the `code' +% part. This must contain a \texttt{biblioentry} element +% for each entry you wish to cite (for how to cite, see +% `\textbf{\texttt{biblioref}}', the first item in the list in \vref{bibrefs}).\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[DocBook]XML}] +<bibliography xreflabel="apacite" label="apacite"> + <biblioentry xml:id="tb97" xreflabel="article"> + <biblioset> + <author> + <personname> + <surname>Flynn</surname> + <firstname>Peter</firstname> + </personname> + </author> + <title>Typographers' Inn</title> + <subtitle>Where have all the flowers gone?</subtitle> + </biblioset> + <artpagenums>21-22</artpagenums> + <title>TUGboat</title> + <volumenum>31</volumenum> + <issuenum>1</issuenum> + <date YYYY-MM-DD="2010"/> + </biblioentry> +</bibliography> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% The \texttt{bibliography} element +% \textsc{must} have a \texttt{label} attribute giving the name +% of the \BibTeX{} style file to use (without the +% {\ttfamily{}.bst} filetype). The +% \textsf{apacite} style is recommended.\par +% If the specified style requires a \LaTeX{} style +% package for formatting (often called by the same name, eg +% \textsf{apacite}, \textsf{natbib}, +% \textsf{chicago}, etc), this +% \textsc{must} be given in an \texttt{xreflabel} attribute (without the +% {\ttfamily{}.sty} filetype).\par +% There \textsc{may} also be an +% \texttt{xlink:href} attribute giving +% the name of the \BibTeX{} file (without the +% {\ttfamily{}.bib} filetype) to which the +% references should be written: the default is the name of +% the class or package itself (as defined in `\textbf{\texttt{xml:id}}', the first item in the list in \vref{rootid}).\par +% Each \texttt{biblioentry} element +% \textsc{must} have both an \texttt{xml:id} attribute by which it can +% be cited with the \texttt{biblioref} element; and a \texttt{type} attribute classifying it +% with one of the standard \BibTeX{} document types (article, +% book, incollection, etc)\par +% \subsection{Inline markup (elements in mixed content)}\label{flow} +% \par +% \begin{description}[style=unboxed] +% \item[\texttt{biblioref}\thinspace:]\label{bibrefs}a citation (bibliographic reference) to an item in +% the Bibliography; the \texttt{linkend} attribute must be +% the value of the \texttt{xml:id} +% of a \texttt{biblioentry} element (see \vref{bibs}); this value is passed to a +% {\ttfamily{}\textbackslash{}cite} command. +% \item[\texttt{citetitle}\thinspace:]the title of a document being mentioned; usually +% formatted in italics or quotes; may be empty, with a \texttt{linkend} attribute pointing to +% an entry in the Bibliography (as for +% \texttt{biblioref}), in which case the title is +% automatically extracted and formatted, or passed to a +% {\ttfamily{}\textbackslash{}citefield} command. +% \item[\texttt{code}\thinspace:]a fragment of computer or data code, formatted in +% monospace type. +% \item[\texttt{emphasis}\thinspace:]emphasis according to style, usually italics. +% \item[\texttt{exceptionname}\thinspace:]used for the keywords of RFC2119 in formal admonishments. +% \item[\texttt{filename}\thinspace:]name of a file, a full filepath, or just a part of +% the name (eg a filetype). +% \item[\texttt{firstterm}\thinspace:]the defining instance of a specialist term; this +% may or may not actually be the first occurrence. +% \item[\texttt{footnote}\thinspace:]a footnote; contains a paragraph. +% \item[\texttt{foreignphrase}\thinspace:]for foreign-language expressions; identify the +% language with the \texttt{xml:lang} attribute if the +% phrase is long enough to need the +% \textsf{babel} package. +% \item[\texttt{guibutton}\thinspace:]represents a GUI {\fboxsep2pt\ovalbox{\sffamily Button}}. +% \item[\texttt{guilabel}\thinspace:]represents a GUI +% {\fboxsep2pt\fbox{\sffamily Label}}. +% \item[\texttt{guimenu}\thinspace:]represents a GUI +% \textsf{\bfseries Menu}. +% \item[\texttt{guimenuitem}\thinspace:]represents a GUI +% \textsf{\itshape Menu item}. +% \item[\texttt{guisubmenu}\thinspace:]represents a GUI +% \textsf{Sub-menu item}. +% \item[\texttt{literal}\thinspace:]marks a {\ttfamily{}literal string} on which +% no interpretation is to be performed (markup characters +% like backslashes and curly braces will +% not be escaped; the \texttt{xml:lang} attribute can be set to +% the name of the language (eg \texttt{"TeX"}, \texttt{"LaTeX"}, etc. +% \item[\texttt{phrase}\thinspace:]marks a phrase used as-is (ie not a quote from +% anyone in particular) by enclosing it in quotation marks. +% \item[\texttt{productname}\thinspace:]marks a product or program name, eg +% \emph{Emacs}. +% \item[\texttt{quote}\thinspace:]marks a quote from someone by putting it in +% quotation marks. +% \item[\texttt{replaceable}\thinspace:]identifies text, commands, or keywords to be +% typed, for which the user must substitute a meaningful +% value, eg {\itshape password} (in +% italics). +% \item[\texttt{systemitem}\thinspace:]identifies generic computer-related strings such +% as system commands, hostnames, Regular Expressions, etc +% which need to be printed in monospace to eliminate any +% confusion over 1/l/I, 0/1/I, etc. +% \item[\texttt{type}\thinspace:]marks a span for which special typographical +% treatment is needed. The \texttt{role} attribute must be set +% to `font' and the \texttt{remap} attribute must be set +% to the NFSS2e three-character +% \textsf{fontname}. +% \item[\texttt{uri}\thinspace:]marks a URI (formats it with the +% {\ttfamily{}\textbackslash{}url} macro). +% \item[\texttt{wordasword}\thinspace:]marks a word that is being used as itself (usually +% for purposes of clarification), so it goes in quotation +% marks. +% \item[\texttt{xref}\thinspace:]\label{xref}a cross-reference using the \texttt{linkend} attribute to point +% at some other part of the document, which must have +% the matching \texttt{xml:id} +% value; the mechanism is identical to \LaTeX{}'s +% {\ttfamily{}\textbackslash{}label}\dots{}{\ttfamily{}\textbackslash{}ref}. +% \end{description} +% In addition, there are six special-purpose element types +% used for functional documentation, that create the special +% \textsf{dox} package commands for adding \LaTeX{} +% (and XML) terms to the index, and highlighting them in the +% left-hand margin:\par +% \begin{description}[style=unboxed] +% \item[\texttt{classname}\thinspace:]a \LaTeX{} document class name like +% \textsf{article} +% \item[\texttt{command}\thinspace:]a \LaTeX{} or other computer command, such as +% {\ttfamily{}\textbackslash{}parskip}; the backslash is added +% automatically for the default case of \LaTeX{}; other +% languages require the \texttt{xml:lang} attribute giving +% the name of the language +% \item[\texttt{envar}\thinspace:]a \LaTeX{} environment name like +% \texttt{enumerate} +% \item[\texttt{option}\thinspace:]a \LaTeX{} option to a class, package, or command, +% like \textbf{\texttt{a4paper}} +% \item[\texttt{package}\thinspace:]a \LaTeX{} package name like +% \textsf{fancybox} +% \item[\texttt{tag}\thinspace:]an XML element, attribute, attribute value, or +% entity name: the type is specified in the \texttt{class} attribute and is one +% of the predetermined list provided automatically by +% \emph{DocBook} (so your XML editor +% will guide you) +% \end{description} +% \subsection{Producing your class or package}\label{production} +% The XSLT2 program generates a number of output files, +% principally the {\ttfamily{}.dtx} and +% {\ttfamily{}.ins} files which are the package or +% class itself. A third output is a {\ttfamily{}build} +% file, which is a \emph{bash} shell +% script customised for the production of the class or package +% you are writing. A fourth is the +% {\ttfamily{}MANIFEST} file, used for zipping +% everything up for distribution,\par +% You should therefore keep each class or package +% development in a separate directory, otherwise the +% {\ttfamily{}build} file generated by one will +% overwrite that generated by others.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=bash] +#! /bin/bash +# +# Bourne shell script to build the class file and documentation +# Note the following line is wrapped here to fit the width +java -jar /usr/local/saxon/saxon9he.jar \ + -o:classpack.dtx classpack.xml \ + /home/peter/texmf/dev/db2dtx.xsl \ + processor=/usr/local/saxon/saxon9he.jar \ + appdir=/home/peter/texmf/dev \ + cpdir=/home/peter/texmf/dev +yes|latex classpack.ins +pdflatex classpack.dtx +bibtex classpack +awk -f /home/peter/texmf/dev/decommentbbl.awk classpack.bbl >classpack.bdc +mv classpack.bdc classpack.bbl +pdflatex classpack.dtx +makeindex -s gind.ist -o classpack.ind classpack.idx +makeindex -s gglo.ist -o classpack.gls classpack.glo +pdflatex classpack.dtx +echo Copying files into dev tree... +mkdir -p doc/latex/classpack +mkdir -p source/latex/classpack +mkdir -p tex/latex/classpack +cp README MANIFEST classpack.pdf doc/latex/classpack +cp classpack.dtx classpack.ins source/latex/classpack +cp classpack.cls tex/latex/classpack +cp db2bibtex.xsl source/latex/classpack +cp db2dtx.xsl source/latex/classpack +cp db2plaintext.xsl source/latex/classpack +cp decommentbbl.awk source/latex/classpack +cp doctexbook.dtd source/latex/classpack +cp lppl.xml source/latex/classpack +cp prepost.xml source/latex/classpack +cp readme.xml source/latex/classpack +echo Zipping up files from dev tree... +zip -r --exclude=*.svn* --exclude=*.DS_Store* \ + classpack-0.73.tds.zip doc/latex/classpack \ + source/latex/classpack tex/latex/classpack +echo Installing working copy... +unzip -o -d ~/texmf classpack-0.73.tds.zip +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Because this file will not exist the very first time you +% process a new class or package, you will need to type that +% first ({\ttfamily{}java}) command by +% hand. The arguments are:\par +% \begin{enumerate} +% \item \marg{jar} the location of +% your copy of the Saxon XSLT2 processor, a +% {\ttfamily{}.jar} file; +% \item \textbf{\texttt{-o:}} the name of the +% {\ttfamily{}.dtx} file you are producing; +% \item the name of the XML file you are processing; +% \item the full path to the DB2DTX program; +% \item the location of your copy of the Saxon XSLT2 +% processor (again) as the +% {\ttfamily{}processor} parameter; +% \item the directory you use for this class or package as +% the {\ttfamily{}appdir}; +% \item the directory where your copy of the XSLT2 program +% is stored as the +% {\ttfamily{}cpdir} parameter (along with the DTD, +% {\ttfamily{}prepost.xml}, +% {\ttfamily{}readme.xml}, +% {\ttfamily{}db2plaintext.xsl}, and +% {\ttfamily{}lppl.xml} files) . +% \end{enumerate} +% For subsequent runs, you just type {\ttfamily{}./build} and the values and +% parameters will be re-used automatically. If you ever need +% to run the XSLT2 process by itself, use the command +% \verb+grep java build | bash+\par +% The remainder of the {\ttfamily{}build} tests +% the extraction of the class or package, and compiles the +% full documentation in the standard sequence, including any +% bibliography, index, or glossary.\par +% The use of the {\ttfamily{}decommentbbl.awk} +% script on the \BibTeX{} output is to defeat the use of +% terminal percent comment characters, which upset the +% \textsf{ltxdoc} package because of the special use +% of that character there.\par +% The final stage is to create a Zip file of +% the class or package, which is placed in the current working +% directory and then unzipped into your personal \TeX{} tree.\par +% \subsection{Maintaining your class or package}\label{maintenance} +% The things to control each time you make an update are:\par +% \begin{enumerate} +% \item on the \texttt{book} root element, update the \texttt{version} and \texttt{revision} attributes +% \item add a new \texttt{revision} element in the +% Revision History, setting the \texttt{version} attribute to the +% compound of the version and revision specified above, +% and setting the \texttt{date} subelement's \texttt{conformance} attribute to +% today's date in ISO format +% \item after processing the document once, set the +% \texttt{book} root element's \texttt{security} attribute to the +% checksum displayed by \LaTeX{} +% \item process the document again (run the +% {\ttfamily{}build} script again)~--- the +% security checksum should now match +% \end{enumerate} +% \clearpage +% \section{The \emph{db2dtx} program}\label{db2dtx} +% While the core of your class or package is the +% \emph{DocBook} XML document, the core of +% the \emph{classpack} system is the program +% that turns your XML into {\ttfamily{}.dtx} and +% {\ttfamily{}.ins} files for distribution as combined +% code and documentation.\par +% The \emph{db2dtx} program is written +% in XSLT2, a declarative language for processing XML. It +% consists of a set of templates, each of which matches a +% pattern in the XML document, usually an element type, or an +% element type in a particular position or with a particular +% attribute value or subelement.\par +% For example, there is a template which matches the +% \texttt{biblioref} element whenever it occurs. This puts three +% things into the output:\par +% \begin{enumerate} +% \item the command \verb|\cite{| with its +% opening curly brace; +% \item the value of the link to the bibliographic +% entry; +% \item the closing \verb|}| curly +% brace. +% \end{enumerate} +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XSLT] +<xsl:template match="db:biblioref"> + <xsl:text>\cite{</xsl:text> + <xsl:value-of select="@linkend"/> + <xsl:text>}</xsl:text> +</xsl:template> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% The advantage of using a declarative language is that you +% don't need to know when and where each element will occur: +% XSLT2 will find them as they come up in processing, and apply +% the template when it happens. It's basically a case of +% `when you see one of \emph{these}, do +% \emph{this}'.\par +% The next few sections of this document describe each part +% of the program and how it produces your class or package +% files.\par +% \subsection{XML Declaration and Namespace declarations} +% The program starts in the usual way with the XML +% Declaration and the \texttt{xsl:stylesheet} start-tag with +% the Namespace declarations.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XSLT] +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:db="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="2.0"> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Note that this is an XSLT2 program and requires an XSLT2 +% processor.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XSLT] + <!-- db2dtx.xsl + XSL script to transform DocBook5 documentation and code of a + LaTeX package or class file into a DocTeX (.dtx and .ins) + distribution. + Full processing command chain is output to file 'build' + Note this requires an XSLT2 processor (eg Saxon9 or above) + --> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% We identify the version of the program, output methods, +% parameters, and the single \texttt{xsl:include} file: the +% {\ttfamily{}db2bibtex.xsl} module for handling +% bibliographic formatting.\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language=XSLT] + <xsl:variable name="thisversion"> + <xsl:text>14.7</xsl:text> + </xsl:variable> + + <xsl:output method="text"/> + <xsl:output method="text" name="textFormat"/> + + <xsl:include href="db2bibtex.xsl"/> + <xsl:include href="db2plaintext.xsl"/> +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% This is incomplete: the remainder of the program is not +% yet included here.\par +% \StopEventually{\label{endcode} +% \clearpage +% \newgeometry{left=3cm} +% \addcontentsline{toc}{section}{Change History} +% \label{} +% \PrintChanges +% \clearpage +% \label{codeindex} +% \addcontentsline{toc}{section}{Index} +% \PrintIndex} +% \setlength{\revmarg}{1in} +% \addtolength{\revmarg}{\widthof{\MacroFont{IndexColumns}}} +% \newgeometry{left=\revmarg} +% \iffalse +%<*package> +% \fi +% \clearpage +% \section{Service commands} +% \iffalse +%% +%% SERVICE COMMANDS +% \fi +% As ClassPack itself is not a document class or package +% \emph{per se}, there is no operating +% code.\par +% \iffalse +%% +%% As ClassPack itself is not a document class or package per se, there +%% is no operating code. +% \fi +% However, there are some ancillary commands commonly used +% in documentation which should be expected by authors of +% classes and packages using ClassPack.\par +% \iffalse +%% +%% However, there are some ancillary commands commonly used in +%% documentation which should be expected by authors of classes and +%% packages using ClassPack. +% \fi +% This section therefore implements +% {\ttfamily{}classpack.sty}, which gets invoked +% automatically via its entry in +% {\ttfamily{}prepost.xml}.\par +% \iffalse +%% +%% This section therefore implements classpack.sty, which gets invoked +%% automatically via its entry in prepost.xml. +% \fi +% \begin{counter}{IndexColumns} +% The \textsf{doctex} package uses a default +% three-column index, which is too narrow for most purposes. We +% therefore make the index in two columns, and space them +% slightly farther apart.\par +% \iffalse +%% +%% The doctex package uses a default three-column index, which is too +%% narrow for most purposes. We therefore make the index in two columns, +%% and space them slightly farther apart. +% \fi +% \begin{macrocode} +\setcounter{IndexColumns}{2} +\setlength{\columnsep}{3pc} +% \end{macrocode} +% \end{counter} +% \subsection{\TeX{} and other logos} +% \iffalse +%% +%% 1 TeX and other logos +% \fi +% \TeX{} and \LaTeX{} are defined in the \LaTeX{} kernel, but +% most of the others are not. The following definitions are +% taken from the \textsf{ltugboat} package, used for +% typesetting the TUGboat journal.\par +% \iffalse +%% +%% TeX and LaTeX are defined in the LaTeX kernel, but most of the others +%% are not. The following definitions are taken from the ltugboat +%% package, used for typesetting the TUGboat journal. +% \fi +% \begin{macro}{\ConTeXt} +% \ConTeXt{} is a typography and typesetting system meant +% to provide users easy and consistent access to advanced +% typographical control \cite{wp-context}.\par +% \iffalse +%% +%% \ConTeXt{} is a typography and typesetting system meant to provide +%% users easy and consistent access to advanced typographical control (, +%% ). +% \fi +% \begin{macrocode} +\def\ConTeXt{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt} +% \end{macrocode} +% \end{macro} +% \iffalse +%</package> +% \fi +% \clearpage +% \raggedright +% \bibliography{classpack} +% \bibliographystyle{apacite} +% \begin{VerbatimOut}{classpack.bib} +%<*ignore> +@article{wp-context, +author = {Anon}, +shortauthor = {Anon}, +title = {{\ConTeXt{}}}, +journal = {{Wikipedia}}, +url = {http://en.wikipedia.org/wiki/ConTeXt}, +lastchecked = {27 March 2013} +} +%</ignore> +% \end{VerbatimOut} +% \appendix +% \iffalse +%<*savedtd> +% \fi +% \clearpage +% \section{The XML vocabulary}\label{savedtd} +% \iffalse +%% +%% The XML vocabulary +% \fi +% There are currently no changes to the +% \emph{DocBook} element structure.\par +% \iffalse +%% +%% There are currently no changes to the DocBook element structure. +% \fi +% \begin{dtd}{book} +% The DTD is a driver implementing a number of entity +% declarations to ease the transformation to \LaTeX{}.\par +% \iffalse +%% +%% The DTD is a driver implementing a number of entity declarations to +%% ease the transformation to LaTeX. +% \fi +% \begin{macrocode} +<!ENTITY % db5dtd SYSTEM "/dtds/docbook/docbook-5.0/dtd/docbook.dtd"> +<!ATTLIST date YYYY-MM-DD CDATA #IMPLIED> +<!ATTLIST blockquote units CDATA #IMPLIED + begin CDATA #IMPLIED + end CDATA #IMPLIED> +<!ATTLIST quote units CDATA #IMPLIED + begin CDATA #IMPLIED + end CDATA #IMPLIED> +<!ELEMENT html:form EMPTY> +<!ENTITY ampers "\&#38;"> +<!ENTITY BiBTeX "\BibTeX{}"> +<!ENTITY BibTeX "\BibTeX{}"> +<!ENTITY BIBTeX "\BibTeX{}"> +<!ENTITY ConTeXt "\ConTeXt{}"> +<!ENTITY LaTeX "\LaTeX{}"> +<!ENTITY LaTeX2e "\LaTeXe{}"> +<!ENTITY XeTeX "\XeTeX{}"> +<!ENTITY LyX "\LyX{}"> +<!ENTITY METAFONT "\MF{}"> +<!ENTITY METAPOST "\MP{}"> +<!ENTITY TeX "\TeX{}"> +<!ENTITY bsol "{\texttt{\textbackslash}}"> +<!ENTITY date "\filedate{}"> +<!ENTITY degree "\textdegree{}"> +<!ENTITY doctype "\classorpackage{}"> +<!ENTITY filler "\hfil{}"> +<!ENTITY frac12 "\nicefrac12"> +<!ENTITY frac13 "\nicefrac13"> +<!ENTITY frac23 "\nicefrac23"> +<!ENTITY hellip "\dots{}"> +<!ENTITY mdash "~--- "> +<!ENTITY mldr "\dotfill{}"> +<!ENTITY nbsp "~"> +<!ENTITY ndash "--"> +<!ENTITY percnt "\%"> +<!ENTITY square "\raisebox{-1pt}{\Square}"> +<!ENTITY thinsp "\thinspace{}"> +<!ENTITY times "×"> +<!ENTITY specialUuml '{\normalfont\"{\fontfamily{cdr}\selectfont U}}'> +<!ENTITY verbar "\menusep{}"> +<!ENTITY version "\fileversion{}"> +<!-- call the main DTD --> %db5dtd; +% \end{macrocode} +% \end{dtd} +% \iffalse +%</savedtd> +% \fi +% \iffalse +%<*lxp> +% \fi +% \clearpage +% \section{Reusable XML}\label{lxp} +% \iffalse +%% +%% Reusable XML +% \fi +% In the last item in the list in \vref{xmltools}, I said that one of the +% benefits of using XML for software generation and +% documentation was the re-usability of the data. Here are a +% couple of simple examples.\par +% \iffalse +%% +%% In , I said that one of the benefits of using XML for software +%% generation and documentation was the re-usability of the data. Here +%% are a couple of simple examples. +% \fi +% \begin{macrocode} +$ lxprintf -e productname "%s\n" . classpack.xml |\ + sort | uniq -c | sort -k 1nr +% \end{macrocode} +% Checking that all element types have been described!\par +% \iffalse +%% +%% Checking that all element types have been described! +% \fi +% \iffalse +%</lxp> +% \fi +% \newgeometry{left=3cm} +% \clearpage +% \section{The \LaTeX{} Project Public License}\label{LPPL:LPPL} +% \begin{quotation}\small\noindent +% Everyone is allowed to distribute verbatim copies of this +% license document, but modification of it is not allowed. +% \end{quotation} +% \subsection{Preamble}\label{LPPL:Preamble} +% The \LaTeX{} Project Public License ({\small LPPL}) +% is the primary license under which the \LaTeX{} kernel and the +% base \LaTeX{} packages are distributed.\par +% You may use this license for any work of which you hold the +% copyright and which you wish to distribute. This license may be +% particularly suitable if your work is \TeX{}-related (such as a +% \LaTeX{} package), but it is written in such a way that you can +% use it even if your work is unrelated to \TeX{}.\par +% The section \emph{Whether and How to Distribute Works under This +% License}, below, gives instructions, examples, and +% recommendations for authors who are considering distributing +% their works under this license.\par +% This license gives conditions under which a work may be +% distributed and modified, as well as conditions under which +% modified versions of that work may be distributed.\par +% We, the \LaTeX{3} Project, believe that the conditions below +% give you the freedom to make and distribute modified versions of +% your work that conform with whatever technical specifications +% you wish while maintaining the availability, integrity, and +% reliability of that work. If you do not see how to achieve your +% goal while meeting these conditions, then read the document +% {\ttfamily{}cfgguide.tex} and {\ttfamily{}modguide.tex} in the base \LaTeX{} +% distribution for suggestions.\par +% \subsection{Definitions}\label{LPPL:Definitions} +% In this license document the following terms are used:\par +% \begin{description}[style=unboxed] +% \item[Work\thinspace:]Any work being distributed under this License. +% \item[Derived Work\thinspace:]Any work that under any applicable law is derived from +% the Work. +% \item[Modification\thinspace:]Any procedure that produces a Derived Work under any +% applicable law~--- for example, the production of a file +% containing an original file associated with the Work or a +% significant portion of such a file, either verbatim or +% with modifications and/or translated into another +% language. +% \item[Modify\thinspace:]To apply any procedure that produces a Derived Work +% under any applicable law. +% \item[Distribution\thinspace:]Making copies of the Work available from one person to +% another, in whole or in part. Distribution includes (but +% is not limited to) making any electronic components of the +% Work accessible by file transfer protocols such as +% {\small FTP} or {\small HTTP} or by +% shared file systems such as Sun's Network File System +% ({\small NFS}). +% \item[Compiled Work\thinspace:]A version of the Work that has been processed into a +% form where it is directly usable on a computer system. +% This processing may include using installation facilities +% provided by the Work, transformations of the Work, copying +% of components of the Work, or other activities. Note that +% modification of any installation facilities provided by +% the Work constitutes modification of the Work. +% \item[Current Maintainer\thinspace:]A person or persons nominated as such within the Work. +% If there is no such explicit nomination then it is the +% `Copyright Holder' under any applicable +% law. +% \item[Base Interpreter\thinspace:]A program or process that is normally needed for +% running or interpreting a part or the whole of the +% Work.\par +% A Base Interpreter may depend on external components +% but these are not considered part of the Base Interpreter +% provided that each external component clearly identifies +% itself whenever it is used interactively. Unless +% explicitly specified when applying the license to the +% Work, the only applicable Base Interpreter is a +% `\LaTeX{}-Format' or in the case of files +% belonging to the `\LaTeX{}-format' a program +% implementing the `\TeX{} language'. +% \end{description} +% \subsection{Conditions on Distribution and Modification}\label{LPPL:Conditions} +% \begin{enumerate} +% \item Activities other than distribution and/or modification +% of the Work are not covered by this license; they are +% outside its scope. In particular, the act of running the +% Work is not restricted and no requirements are made +% concerning any offers of support for the Work. +% \item \label{LPPL:item:distribute}You may distribute a complete, unmodified copy of the +% Work as you received it. Distribution of only part of the +% Work is considered modification of the Work, and no right to +% distribute such a Derived Work may be assumed under the +% terms of this clause. +% \item You may distribute a Compiled Work that has been +% generated from a complete, unmodified copy of the Work as +% distributed under Clause~item~\ref{LPPL:item:distribute} above above, as +% long as that Compiled Work is distributed in such a way that +% the recipients may install the Compiled Work on their system +% exactly as it would have been installed if they generated a +% Compiled Work directly from the Work. +% \item \label{LPPL:item:currmaint}If you are the Current Maintainer of the Work, you may, +% without restriction, modify the Work, thus creating a +% Derived Work. You may also distribute the Derived Work +% without restriction, including Compiled Works generated from +% the Derived Work. Derived Works distributed in this manner +% by the Current Maintainer are considered to be updated +% versions of the Work. +% \item If you are not the Current Maintainer of the Work, you +% may modify your copy of the Work, thus creating a Derived +% Work based on the Work, and compile this Derived Work, thus +% creating a Compiled Work based on the Derived Work. +% \item \label{LPPL:item:conditions}If you are not the Current Maintainer of the Work, you +% may distribute a Derived Work provided the following +% conditions are met for every component of the Work unless +% that component clearly states in the copyright notice that +% it is exempt from that condition. Only the Current +% Maintainer is allowed to add such statements of exemption to +% a component of the Work. +% \begin{enumerate} +% \item If a component of this Derived Work can be a direct +% replacement for a component of the Work when that +% component is used with the Base Interpreter, then, +% wherever this component of the Work identifies itself to +% the user when used interactively with that Base +% Interpreter, the replacement component of this Derived +% Work clearly and unambiguously identifies itself as a +% modified version of this component to the user when used +% interactively with that Base Interpreter. +% \item Every component of the Derived Work contains +% prominent notices detailing the nature of the changes to +% that component, or a prominent reference to another file +% that is distributed as part of the Derived Work and that +% contains a complete and accurate log of the +% changes. +% \item No information in the Derived Work implies that any +% persons, including (but not limited to) the authors of +% the original version of the Work, provide any support, +% including (but not limited to) the reporting and +% handling of errors, to recipients of the Derived Work +% unless those persons have stated explicitly that they do +% provide such support for the Derived Work. +% \item You distribute at least one of the following with +% the Derived Work: +% \begin{enumerate} +% \item A complete, unmodified copy of the Work; if your +% distribution of a modified component is made by +% offering access to copy the modified component from +% a designated place, then offering equivalent access +% to copy the Work from the same or some similar place +% meets this condition, even though third parties are +% not compelled to copy the Work along with the +% modified component; +% \item Information that is sufficient to obtain a +% complete, unmodified copy of the Work. +% \end{enumerate} +% \end{enumerate} +% \item If you are not the Current Maintainer of the Work, you +% may distribute a Compiled Work generated from a Derived +% Work, as long as the Derived Work is distributed to all +% recipients of the Compiled Work, and as long as the +% conditions of Clause~item~\ref{LPPL:item:conditions} above, above, are met +% with regard to the Derived Work. +% \item The conditions above are not intended to prohibit, and +% hence do not apply to, the modification, by any method, of +% any component so that it becomes identical to an updated +% version of that component of the Work as it is distributed +% by the Current Maintainer under Clause~item~\ref{LPPL:item:currmaint} above, above. +% \item Distribution of the Work or any Derived Work in an +% alternative format, where the Work or that Derived Work (in +% whole or in part) is then produced by applying some process +% to that format, does not relax or nullify any sections of +% this license as they pertain to the results of applying that +% process. +% \item % \begin{enumerate} +% \item A Derived Work may be distributed under a different +% license provided that license itself honors the +% conditions listed in Clause~item~\ref{LPPL:item:conditions} above above, in +% regard to the Work, though it does not have to honor the +% rest of the conditions in this license. +% \item If a Derived Work is distributed under a different +% license, that Derived Work must provide sufficient +% documentation as part of itself to allow each recipient +% of that Derived Work to honor the restrictions in +% Clause~item~\ref{LPPL:item:conditions} above above, concerning +% changes from the Work. +% \end{enumerate} +% \item This license places no restrictions on works that are +% unrelated to the Work, nor does this license place any +% restrictions on aggregating such works with the Work by any +% means. +% \item Nothing in this license is intended to, or may be used +% to, prevent complete compliance by all parties with all +% applicable laws. +% \end{enumerate} +% \subsection{No Warranty}\label{LPPL:Warranty} +% There is no warranty for the Work. Except when otherwise +% stated in writing, the Copyright Holder provides the Work +% `as is', without warranty of any kind, either +% expressed or implied, including, but not limited to, the implied +% warranties of merchantability and fitness for a particular +% purpose. The entire risk as to the quality and performance of +% the Work is with you. Should the Work prove defective, you +% assume the cost of all necessary servicing, repair, or +% correction.\par +% In no event unless required by applicable law or agreed to +% in writing will The Copyright Holder, or any author named in the +% components of the Work, or any other party who may distribute +% and/or modify the Work as permitted above, be liable to you for +% damages, including any general, special, incidental or +% consequential damages arising out of any use of the Work or out +% of inability to use the Work (including, but not limited to, +% loss of data, data being rendered inaccurate, or losses +% sustained by anyone as a result of any failure of the Work to +% operate with any other programs), even if the Copyright Holder +% or said author or said other party has been advised of the +% possibility of such damages.\par +% \subsection{Maintenance of The Work}\label{LPPL:Maintenance} +% The Work has the status `author-maintained' +% if the Copyright Holder explicitly and prominently states near +% the primary copyright notice in the Work that the Work can only +% be maintained by the Copyright Holder or simply that it is +% `author-maintained'.\par +% The Work has the status `maintained' if there +% is a Current Maintainer who has indicated in the Work that they +% are willing to receive error reports for the Work (for example, +% by supplying a valid e-mail address). It is not required for the +% Current Maintainer to acknowledge or act upon these error +% reports.\par +% The Work changes from status `maintained' to +% `unmaintained' if there is no Current Maintainer, +% or the person stated to be Current Maintainer of the work cannot +% be reached through the indicated means of communication for a +% period of six months, and there are no other significant signs +% of active maintenance.\par +% You can become the Current Maintainer of the Work by +% agreement with any existing Current Maintainer to take over this +% role.\par +% If the Work is unmaintained, you can become the Current +% Maintainer of the Work through the following steps:\par +% \begin{enumerate} +% \item Make a reasonable attempt to trace the Current +% Maintainer (and the Copyright Holder, if the two differ) +% through the means of an Internet or similar search. +% \item If this search is successful, then enquire whether the +% Work is still maintained. +% \begin{enumerate} +% \item If it is being maintained, then ask the Current +% Maintainer to update their communication data within one +% month. +% \item \label{LPPL:item:intention}If the search is unsuccessful or no action to resume +% active maintenance is taken by the Current Maintainer, +% then announce within the pertinent community your +% intention to take over maintenance. (If the Work is a +% \LaTeX{} work, this could be done, for example, by +% posting to \url{news:comp.text.tex}.) +% \end{enumerate} +% \item % \begin{enumerate} +% \item If the Current Maintainer is reachable and agrees to +% pass maintenance of the Work to you, then this takes +% effect immediately upon announcement. +% \item \label{LPPL:item:announce}If the Current Maintainer is not reachable and the +% Copyright Holder agrees that maintenance of the Work be +% passed to you, then this takes effect immediately upon +% announcement. +% \end{enumerate} +% \item \label{LPPL:item:change}If you make an `intention announcement' +% as described in~item~\ref{LPPL:item:intention} above above and after three +% months your intention is challenged neither by the Current +% Maintainer nor by the Copyright Holder nor by other people, +% then you may arrange for the Work to be changed so as to +% name you as the (new) Current Maintainer. +% \item If the previously unreachable Current Maintainer becomes +% reachable once more within three months of a change +% completed under the terms of~item~\ref{LPPL:item:announce} above +% or~item~\ref{LPPL:item:change} above, then that +% Current +% Maintainer must become or remain the Current Maintainer upon +% request provided they then update their communication data +% within one month. +% \end{enumerate} +% A change in the Current Maintainer does not, of itself, +% alter the fact that the Work is distributed under the +% {\small LPPL} license.\par +% If you become the Current Maintainer of the Work, you should +% immediately provide, within the Work, a prominent and +% unambiguous statement of your status as Current Maintainer. You +% should also announce your new status to the same pertinent +% community as in~item~\ref{LPPL:item:intention} above +% above.\par +% \subsection{Whether and How to Distribute Works under This +% License}\label{LPPL:Distribute} +% This section contains important instructions, examples, and +% recommendations for authors who are considering distributing +% their works under this license. These authors are addressed as +% `you' in this section.\par +% \subsubsection{Choosing This License or Another License}\label{LPPL:Choosing} +% If for any part of your work you want or need to use +% \emph{distribution} conditions that differ +% significantly from those in this license, then do not refer to +% this license anywhere in your work but, instead, distribute +% your work under a different license. You may use the text of +% this license as a model for your own license, but your license +% should not refer to the {\small LPPL} or otherwise +% give the impression that your work is distributed under the +% {\small LPPL}.\par +% The document {\ttfamily{}modguide.tex} in the base \LaTeX{} +% distribution explains the motivation behind the conditions of +% this license. It explains, for example, why distributing +% \LaTeX{} under the {\small GNU} General Public +% License ({\small GPL}) was considered inappropriate. +% Even if your work is unrelated to \LaTeX{}, the discussion in +% {\ttfamily{}modguide.tex} may still be +% relevant, and authors intending to distribute their works +% under any license are encouraged to read it.\par +% \subsubsection{A Recommendation on Modification Without +% Distribution}\label{LPPL:WithoutDistribution} +% It is wise never to modify a component of the Work, even +% for your own personal use, without also meeting the above +% conditions for distributing the modified component. While you +% might intend that such modifications will never be +% distributed, often this will happen by accident~--- you may +% forget that you have modified that component; or it may not +% occur to you when allowing others to access the modified +% version that you are thus distributing it and violating the +% conditions of this license in ways that could have legal +% implications and, worse, cause problems for the community. It +% is therefore usually in your best interest to keep your copy +% of the Work identical with the public one. Many works provide +% ways to control the behavior of that work without altering any +% of its licensed components.\par +% \subsubsection{How to Use This License}\label{LPPL:HowTo} +% To use this license, place in each of the components of +% your work both an explicit copyright notice including your +% name and the year the work was authored and/or last +% substantially modified. Include also a statement that the +% distribution and/or modification of that component is +% constrained by the conditions in this license.\par +% Here is an example of such a notice and statement:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +%%% pig.dtx +%%% Copyright 2005 M. Y. Name +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is M. Y. Name. +%% +%% This work consists of the files pig.dtx and pig.ins +%% and the derived file pig.sty. +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% Given such a notice and statement in a file, the +% conditions given in this license document would apply, with +% the `Work' referring to the three files +% {\ttfamily{}pig.dtx}, {\ttfamily{}pig.ins}, and {\ttfamily{}pig.sty} (the last being generated +% from {\ttfamily{}pig.dtx} using {\ttfamily{}pig.ins}), the `Base +% Interpreter' referring to any +% `\LaTeX{}-Format', and both `Copyright +% Holder' and `Current Maintainer' +% referring to the person +% M.~Y.~Name\index{!}.\par +% If you do not want the Maintenance section of +% {\small LPPL} to apply to your Work, change +% `maintained' above into +% `author-maintained'. However, we recommend that +% you use `maintained' as the Maintenance +% section was added in order to ensure that your Work remains +% useful to the community even when you can no longer maintain +% and support it yourself.\par +% \subsubsection{Derived Works That Are Not Replacements}\label{LPPL:NotReplacements} +% Several clauses of the {\small LPPL} specify +% means to provide reliability and stability for the user +% community. They therefore concern themselves with the case +% that a Derived Work is intended to be used as a (compatible or +% incompatible) replacement of the original Work. If this is not +% the case (e.g., if a few lines of code are reused for a +% completely different task), then clauses 6b and 6d shall not +% apply.\par +% \subsubsection{Important Recommendations}\label{LPPL:Recommendations} +% \paragraph{Defining What Constitutes the Work} +% The {\small LPPL} requires that distributions +% of the Work contain all the files of the Work. It is +% therefore important that you provide a way for the licensee +% to determine which files constitute the Work. This could, +% for example, be achieved by explicitly listing all the files +% of the Work near the copyright notice of each file or by +% using a line such as:\par +% \iffalse +%<*ignore> +% \fi +\begin{lstlisting}[language={[LaTeX]TeX}] +%% This work consists of all files listed in manifest.txt. +\end{lstlisting} +% \iffalse +%</ignore> +% \fi +% in that place. In the absence of an unequivocal list it +% might be impossible for the licensee to determine what is +% considered by you to comprise the Work and, in such a case, +% the licensee would be entitled to make reasonable +% conjectures as to which files comprise the Work.\par +% \iffalse +%<*testscript> +# This is a test script +echo Hello, World! + +%</testscript> +% \fi +% \Finale + diff --git a/support/classpack/classpack.ins b/support/classpack/classpack.ins new file mode 100644 index 0000000000..e87e315a03 --- /dev/null +++ b/support/classpack/classpack.ins @@ -0,0 +1,42 @@ +%% Extracted from classpack.xml +% classpack.ins is copyright © 2012-2013 by Peter Flynn <peter@silmaril.ie> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The current maintainer of this work is Peter Flynn <peter@silmaril.ie> +% +% This work consists of the files classpack.dtx and classpack.ins, +% the derived file classpack.sty, and any ancillary files listed +% in the MANIFEST. +% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/classpack} +\preamble +This file was generated from an XML master source. +Amendments and corrections should be notified to the +maintainer for inclusion in future versions. +\endpreamble +\generate{\file{classpack.sty}{\from{classpack.dtx}{package}}% + \file{doctexbook.dtd}{\from{classpack.dtx}{savedtd}}% + \file{getgis.sh}{\from{classpack.dtx}{lxp}}% + \usepreamble\empty\usepostamble\empty + \file{test.sh}{\from{classpack.dtx}{testscript}}% +} +\obeyspaces +\Msg{********************************************************} +\Msg{** **} +\Msg{** Read the documentation before using this package. **} +\Msg{** **} +\Msg{********************************************************} +\endbatchfile diff --git a/support/classpack/classpack.pdf b/support/classpack/classpack.pdf Binary files differnew file mode 100644 index 0000000000..881096d5d5 --- /dev/null +++ b/support/classpack/classpack.pdf diff --git a/support/classpack/classpack.sty b/support/classpack/classpack.sty new file mode 100644 index 0000000000..e55e53e9a2 --- /dev/null +++ b/support/classpack/classpack.sty @@ -0,0 +1,46 @@ +%% +%% This is file `classpack.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% classpack.dtx (with options: `package') +%% This file was generated from an XML master source. +%% Amendments and corrections should be notified to the +%% maintainer for inclusion in future versions. +\NeedsTeXFormat{LaTeX2e}[2011/06/27] +\ProvidesPackage{classpack}[2013/05/28 v0.77 + XML mastering for LaTeX classes and packages] +%% +%% SERVICE COMMANDS +%% +%% As ClassPack itself is not a document class or package per se, there +%% is no operating code. +%% +%% However, there are some ancillary commands commonly used in +%% documentation which should be expected by authors of classes and +%% packages using ClassPack. +%% +%% This section therefore implements classpack.sty, which gets invoked +%% automatically via its entry in prepost.xml. +%% +%% The doctex package uses a default three-column index, which is too +%% narrow for most purposes. We therefore make the index in two columns, +%% and space them slightly farther apart. +\setcounter{IndexColumns}{2} +\setlength{\columnsep}{3pc} +%% +%% 1 TeX and other logos +%% +%% TeX and LaTeX are defined in the LaTeX kernel, but most of the others +%% are not. The following definitions are taken from the ltugboat +%% package, used for typesetting the TUGboat journal. +%% +%% \ConTeXt{} is a typography and typesetting system meant to provide +%% users easy and consistent access to advanced typographical control (, +%% ). +\def\ConTeXt{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt} + +\endinput +%% +%% End of file `classpack.sty'. diff --git a/support/classpack/db2bibtex.xsl b/support/classpack/db2bibtex.xsl new file mode 100644 index 0000000000..0622766da0 --- /dev/null +++ b/support/classpack/db2bibtex.xsl @@ -0,0 +1,592 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:db="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="2.0"> + + <xsl:template match="db:bibliography"> + <xsl:if test="title"> + <xsl:text>% \renewcommand{\bibname}{</xsl:text> + <xsl:value-of select="title"/> + <xsl:text>}
</xsl:text> + </xsl:if> + <xsl:if test="count(//db:biblioref) + + count(//db:citetitle[@linkend]) + + count(//db:blockquote[@linkend])=0"> + <xsl:text>% \nocite{*}
</xsl:text> + </xsl:if> + <xsl:text>% \clearpage +% \raggedright +% \bibliography{</xsl:text> + <xsl:value-of select="/db:book/@xml:id"/> + <xsl:text>} +% \bibliographystyle{</xsl:text> + <xsl:value-of select="@label"/> + <xsl:text>} +% \begin{VerbatimOut}{</xsl:text> + <xsl:choose> + <xsl:when test="@xlink:href"> + <xsl:value-of select="@xlink:href"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="/db:book/@xml:id"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>.bib} +%<*ignore>
</xsl:text> + <xsl:apply-templates/> + <xsl:text>%</ignore> +% \end{VerbatimOut}
</xsl:text> + </xsl:template> + + <xsl:template match="db:biblioentry"> + <xsl:text>@</xsl:text> + <xsl:choose> + <xsl:when test="@xreflabel='standard' and @role"> + <xsl:text>techreport</xsl:text> + </xsl:when> + <xsl:when test="@xreflabel='patent'"> + <xsl:text>misc</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@xreflabel"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:apply-templates/> + <xsl:if test="@xreflabel='standard' and @role"> + <xsl:text>,
publisher 	 = {</xsl:text> + <xsl:value-of select="@role"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="@xreflabel='inproceedings' + and not(descendant::db:publisher) + and not(descendant::db:publishername) + and not(descendant::db:orgname) + and not(descendant::db:volumenum) + and not(descendant::db:issuenum)"> + <xsl:text>,
publisher 	 = {Unpublished}</xsl:text> + </xsl:if> + <xsl:if test="not(descendant::db:date) and descendant::db:confdates"> + <xsl:for-each select="descendant::db:confdates[1]"> + <xsl:call-template name="dodate"/> + </xsl:for-each> + </xsl:if> + <xsl:text>
}
</xsl:text> + </xsl:template> + + <xsl:template match="db:biblioentry/db:authorgroup"> + <xsl:apply-templates/> + <xsl:text>,
shortauthor 	 = {</xsl:text> + <xsl:value-of select="db:author[1]/db:personname/db:surname | + db:author[1]/db:orgname | + db:editor[1]/db:personname/db:surname"/> + <xsl:choose> + <xsl:when test="count(db:author)+count(db:editor)=2"> + <xsl:text> \& </xsl:text> + <xsl:value-of select="db:author[2]/db:personname/db:surname | + db:author[2]/db:orgname | + db:editor[2]/db:personname/db:surname"/> + </xsl:when> + <xsl:otherwise> + <xsl:text> \textit{et al.}</xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- + <xsl:if test="db:editor"> + <xsl:text> (Ed</xsl:text> + <xsl:if test="count(db:editor)>1"> + <xsl:text>s</xsl:text> + </xsl:if> + <xsl:text>)</xsl:text> + </xsl:if> + --> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:biblioentry//db:author | + db:biblioentry//db:editor | + db:biblioentry//db:authorgroup/db:author | + db:biblioentry//db:authorgroup/db:editor"> + <xsl:if test="count(preceding-sibling::*[name()=current()/name()])=0"> + <xsl:text>,
</xsl:text> + <xsl:value-of select="name()"/> + <xsl:text> 	 = {</xsl:text> + </xsl:if> + <xsl:if test="preceding-sibling::*[name()=current()/name()]"> + <xsl:text> and </xsl:text> + </xsl:if> + <!-- only one --> + <xsl:for-each select="db:personname | db:orgname"> + <xsl:if test="db:firstname"> + <xsl:choose> + <xsl:when test="db:firstname/@role='as-is'"> + <xsl:text>{</xsl:text> + <xsl:value-of select="db:firstname"/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="db:firstname"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="db:othername"> + <xsl:text> </xsl:text> + <xsl:value-of select="db:othername"/> + </xsl:if> + <xsl:choose> + <xsl:when test="local-name()='orgname'"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="contains(db:surname,' ')"> + <xsl:text>{</xsl:text> + <xsl:value-of select="db:surname"/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="db:surname"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="db:honorific"> + <xsl:text> </xsl:text> + <xsl:value-of select="db:honorific"/> + </xsl:if> + </xsl:for-each> + <xsl:if test="count(following-sibling::*[name()=current()/name()])=0"> + <xsl:text>}</xsl:text> + <!-- do shortauthor for solo authors/editors here --> + <xsl:if test="count(../*[name()=current()/name()]) = 1 + and not(parent::db:authorgroup)"> + <xsl:text>,
short</xsl:text> + <xsl:value-of select="name()"/> + <xsl:text> 	 = {</xsl:text> + <xsl:value-of select="db:personname/db:surname | db:orgname"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template match="db:biblioentry//db:corpauthor"> + <xsl:if test="count(preceding-sibling::db:author | + preceding-sibling::db:corpauthor)=0"> + <xsl:text>,
author 	 = {{</xsl:text> + </xsl:if> + <xsl:if test="preceding-sibling::db:author | + preceding-sibling::db:corpauthor"> + <xsl:text> and </xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="@remap"> + <xsl:value-of select="@remap"/> + </xsl:when> + <xsl:when test="not(@remap)"> + <xsl:text>{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="count(following-sibling::db:author | + following-sibling::db:corpauthor)=0"> + <xsl:text>}}</xsl:text> + <xsl:if test="count(preceding-sibling::db:author | + preceding-sibling::db:corpauthor)=0"> + <xsl:text>,
shortauthor 	 = {{</xsl:text> + <xsl:choose> + <xsl:when test="@remap"> + <xsl:value-of select="@remap"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="translate(normalize-space(.), + '.,;:-abcdefghijklmnopqrstuvwxyz ','')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}}</xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template match="db:biblioset"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:biblioentry//db:title"> + <xsl:text>,
</xsl:text> + <xsl:choose> + <!-- if field is hardwired, use it --> + <xsl:when test="@role"> + <xsl:value-of select="@role"/> + </xsl:when> + <!-- article titles are inside the biblioset --> + <xsl:when test="parent::db:biblioset"> + <xsl:text>title</xsl:text> + </xsl:when> + <!-- articles use this for the journal because the article + title was wrapped in a biblioset --> + <xsl:when test="parent::db:biblioentry/@xreflabel='article'"> + <xsl:text>journal</xsl:text> + </xsl:when> + <!-- books and collections and journals use it for the booktitle --> + <xsl:when test="parent::db:biblioentry/@xreflabel='inbook' or + parent::db:biblioentry/@xreflabel='incollection' or + parent::db:biblioentry/@xreflabel='inproceedings'"> + <xsl:text>booktitle</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>title</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> 	 = {{</xsl:text> + <xsl:apply-templates/> + <!-- if there is a matching subtitle, pick the right one --> + <xsl:for-each select="following-sibling::db:subtitle + [@role=current()/@role or + (not(@role) and not(current()/@role))]"> + <xsl:choose> + <xsl:when test="starts-with(.,'(')"> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>: </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates/> + </xsl:for-each> + <xsl:text>}}</xsl:text> + </xsl:template> + + <xsl:template match="db:biblioentry//db:subtitle"/> + + <xsl:template match="db:biblioid | db:bibliosource | + db:citebiblioid | db:isbn | db:issn"> + <!-- doi isbn isrn issn libraryofcongress pubsnumber uri other --> + <xsl:text>,
</xsl:text> + <xsl:choose> + <xsl:when test="@class='uri'"> + <xsl:text>url</xsl:text> + </xsl:when> + <xsl:when test="@class='doi'"> + <xsl:value-of select="@class"/> + </xsl:when> + <xsl:when test="local-name()='isbn' or + @class='isbn' or + ancestor::db:biblioentry/@xreflabel='book'"> + <xsl:text>isbn</xsl:text> + </xsl:when> + <xsl:when test="local-name()='issn' or + @class='issn' or + ancestor::db:biblioentry/@xreflabel='article'"> + <xsl:text>issn</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>number</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> 	 = {</xsl:text> + <xsl:choose> + <xsl:when test="@class='other' and @otherclass"> + <xsl:value-of select="@otherclass"/> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:when test="@class='libraryofcongress'"> + <xsl:text>LoC</xsl:text> + <xsl:text>: </xsl:text> + </xsl:when> + </xsl:choose> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + <xsl:choose> + <xsl:when test="@YYYY-MM-DD + and ancestor::db:bibliography/@label='apacite'"> + <xsl:text>,
lastchecked 	 = {</xsl:text> + <xsl:if test="string-length(@YYYY-MM-DD)>8"> + <xsl:value-of select="substring(@YYYY-MM-DD,9,2)"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="string-length(@YYYY-MM-DD)>5"> + <xsl:call-template name="months"> + <xsl:with-param name="month" + select="number(substring(@YYYY-MM-DD,6,2))"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="substring(@YYYY-MM-DD,1,4)"/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:when test="@YYYY-MM-DD and not(ancestor::db:biblioentry//db:date)"> + <xsl:text>,
year 	 = {</xsl:text> + <xsl:value-of select="substring(@YYYY-MM-DD,1,4)"/> + <xsl:text>}</xsl:text> + <xsl:if test="string-length(@YYYY-MM-DD)>5"> + <xsl:text>,
month 	 = {</xsl:text> + <xsl:call-template name="months"> + <xsl:with-param name="month" + select="number(substring(@YYYY-MM-DD,6,2))"/> + </xsl:call-template> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:titleabbrev"> + <xsl:text>,
shorttitle 	 = {{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}}</xsl:text> + </xsl:template> + + <xsl:template match="db:bibliocoverage"> + <xsl:text>,
</xsl:text> + <xsl:value-of select="@remap"/> + <xsl:text> 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:seriesvolnums"> + <xsl:text>,
number 	 = {</xsl:text> + <xsl:if test="@xreflabel"> + <xsl:value-of select="@xreflabel"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:collab"> + <xsl:text>,
note 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:publisher"> + <xsl:choose> + <xsl:when test="ancestor::db:biblioentry/@xreflabel='misc'"> + <xsl:text>,
howpublished 	 = {</xsl:text> + <xsl:apply-templates select="db:address/node()"/> + <xsl:text>: </xsl:text> + <xsl:apply-templates select="db:publishername/node()"/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:publishername"> + <xsl:text>,
</xsl:text> + <xsl:choose> + <xsl:when test="ancestor::db:biblioentry/@xreflabel='techreport' or + ancestor::db:biblioentry/@xreflabel='standard'"> + <xsl:text>institution</xsl:text> + </xsl:when> + <xsl:when test="ancestor::db:biblioentry/@xreflabel='phdthesis' or + ancestor::db:biblioentry/@xreflabel='mastersthesis'"> + <xsl:text>school</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>publisher</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:confgroup"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:conftitle"> + <xsl:text>,
series 	 = {{</xsl:text> + <xsl:apply-templates/> + <xsl:if test="../db:confdates"> + <xsl:text> (</xsl:text> + <xsl:apply-templates select="../db:confdates/node()"/> + <xsl:text>)</xsl:text> + </xsl:if> + <xsl:text>}}</xsl:text> + </xsl:template> + + <xsl:template match="db:confsponsor"> + <xsl:text>,
organization 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:confgroup/db:address"> + <xsl:text>,
address 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:confdates"/> + + <xsl:template match="db:confnum"> + <xsl:text>,
series 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:date"> + <xsl:call-template name="dodate"/> + </xsl:template> + + <xsl:template name="dodate"> + <xsl:text>,
year 	 = {</xsl:text> + <xsl:value-of select="substring(@YYYY-MM-DD,1,4)"/> + <xsl:text>}</xsl:text> + <xsl:if test="string-length(@YYYY-MM-DD)>=7"> + <xsl:text>,
month 	 = {</xsl:text> + <xsl:variable name="month"> + <xsl:call-template name="months"> + <xsl:with-param name="month" + select="number(substring(@YYYY-MM-DD,6,2))"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring($month,1,3)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="ancestor::db:biblioentry/@xreflabel='pc'"> + <xsl:text>,
howpublished 	 = {Pers.\ Comm.}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:productnumber"> + <xsl:text>,
number 	 = {</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:pagenums|db:artpagenums"> + <xsl:text>,
pages 	 = {</xsl:text> + <xsl:value-of select="translate(.,'–','-')"/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:volumenum"> + <xsl:text>,
volume 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:releaseinfo"> + <xsl:text>,
url 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:issuenum | db:invpartnumber"> + <xsl:text>,
number 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:publisher/db:address"> + <xsl:text>,
</xsl:text> + <xsl:choose> + <xsl:when test="starts-with(normalize-space(.),'http://') or + starts-with(normalize-space(.),'ftp://') or + starts-with(normalize-space(.),'mailto:') or + starts-with(normalize-space(.),'https://')"> + <xsl:text>url</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>address</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> 	 = {</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:edition"> + <xsl:text>,
edition 	 = {</xsl:text> + <xsl:choose> + <xsl:when test="not(number(.))"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + <xsl:choose> + <xsl:when test="substring(.,string-length(.))='1' and + substring(.,string-length(.)-1)!='11'"> + <xsl:text>st</xsl:text> + </xsl:when> + <xsl:when test="substring(.,string-length(.))='2' and + substring(.,string-length(.)-1)!='12'"> + <xsl:text>nd</xsl:text> + </xsl:when> + <xsl:when test="substring(.,string-length(.))='3' and + substring(.,string-length(.)-1)!='13'"> + <xsl:text>rd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>th</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template name="months"> + <xsl:param name="month"/> + <xsl:choose> + <xsl:when test="$month=1"> + <xsl:text>January</xsl:text> + </xsl:when> + <xsl:when test="$month=2"> + <xsl:text>February</xsl:text> + </xsl:when> + <xsl:when test="$month=3"> + <xsl:text>March</xsl:text> + </xsl:when> + <xsl:when test="$month=4"> + <xsl:text>April</xsl:text> + </xsl:when> + <xsl:when test="$month=5"> + <xsl:text>May</xsl:text> + </xsl:when> + <xsl:when test="$month=6"> + <xsl:text>June</xsl:text> + </xsl:when> + <xsl:when test="$month=7"> + <xsl:text>July</xsl:text> + </xsl:when> + <xsl:when test="$month=8"> + <xsl:text>August</xsl:text> + </xsl:when> + <xsl:when test="$month=9"> + <xsl:text>September</xsl:text> + </xsl:when> + <xsl:when test="$month=10"> + <xsl:text>October</xsl:text> + </xsl:when> + <xsl:when test="$month=11"> + <xsl:text>November</xsl:text> + </xsl:when> + <xsl:when test="$month=12"> + <xsl:text>December</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>Month must be a number from 1 to 12 in </xsl:text> + <xsl:value-of select="name()"/> + </xsl:message> + <xsl:text>NaN</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/support/classpack/db2dtx.xsl b/support/classpack/db2dtx.xsl new file mode 100644 index 0000000000..e74321cb7c --- /dev/null +++ b/support/classpack/db2dtx.xsl @@ -0,0 +1,5378 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:db="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="2.0"> + + <!-- db2dtx.xsl + XSL script to transform DocBook5 documentation and code of a + LaTeX package or class file into a DocTeX (.dtx and .ins) + distribution. + Full processing command chain is output to file 'build' + Note this requires an XSLT2 processor (eg Saxon9 or above) + --> + + <xsl:variable name="thisversion"> + <xsl:text>15.02 (autopackage with multifile)</xsl:text> + </xsl:variable> + + <xsl:output method="text"/> + <xsl:output method="text" name="textFormat"/> + + <xsl:include href="db2bibtex.xsl"/> + <xsl:include href="db2plaintext.xsl"/> + + <!-- path to the XSLT processor (eg Saxon) --> + <xsl:param name="processor"/> + <!-- path to the classpack directory --> + <xsl:param name="cpdir"/> + <!-- path to the project's app dev directory --> + <xsl:param name="appdir"/> + + <xsl:variable name="prepost" + select="document(concat($cpdir,'/prepost.xml'))/db:refsection"/> + <xsl:variable name="langs" + select="document(concat($cpdir,'/languages.xml'))/languages"/> + <xsl:variable name="readme" + select="document(concat($cpdir,'/readme.xml'))/db:chapter"/> + <xsl:variable name="licence" + select="document(concat($appdir,'/',/db:book/@audience,'.xml'))/db:chapter"/> + <xsl:variable name="thisdoc" select="/"/> + + <xsl:variable name="maxcodelen"> + <xsl:text>40</xsl:text> + </xsl:variable> + + <xsl:variable name="personaltree"> + <xsl:text>~/texmf</xsl:text> + </xsl:variable> + + <xsl:variable name="name" select="/db:book/@xml:id"/> + <xsl:variable name="doctype" select="/db:book/@arch"/> + <xsl:variable name="version" select="/db:book/@version"/> + <xsl:variable name="revision" select="/db:book/@revision"/> + <xsl:variable name="filetype" select="/db:book/@userlevel"/> + + <xsl:variable name="latestrevhist" + select="/db:book/db:info/db:revhistory/db:revision + [not(../db:revision/@version > @version)]/@version"/> + + <xsl:template match="/"> + <xsl:message> + <xsl:text>This is DB2DTX, Version </xsl:text> + <xsl:value-of select="$thisversion"/> + <xsl:text>.</xsl:text> + </xsl:message> + <!-- don't do anything if the version numbers don't accord --> + <xsl:choose> + <xsl:when test="concat($version,'.',$revision) != $latestrevhist"> + <xsl:message> + <xsl:text>! Declared version </xsl:text> + <xsl:value-of select="$version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$revision"/> + <xsl:text> does not match latest revision history </xsl:text> + <xsl:value-of select="$latestrevhist"/> + <xsl:text>
 I'm sorry, I can't go on until you fix this.</xsl:text> + </xsl:message> + </xsl:when> + <xsl:otherwise> + <!-- output the .ins file first --> + <xsl:apply-templates select="/db:book/db:info" mode="ins"/> + <!-- then the build file --> + <xsl:call-template name="build"/> + <!-- then the README --> + <xsl:call-template name="readme"/> + <!-- and then the MANIFEST --> + <xsl:call-template name="manifest"/> + <!-- and finally start creating the .dtx file --> + <xsl:text>% \iffalse meta-comment +% +</xsl:text> + <xsl:call-template name="copyright-statement"> + <xsl:with-param name="ftype"> + <xsl:text>dtx</xsl:text> + </xsl:with-param> + </xsl:call-template> + <xsl:text>% +% \fi +% \iffalse
</xsl:text> + <!-- special exception for classes: needs \ProvidesFile --> + <xsl:if test="$doctype='class'"> + <xsl:text>%<*driver> +\ProvidesFile{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx} +%</driver> +</xsl:text> + </xsl:if> + <!-- prefix with <class> or <package> as appropriate --> + <xsl:text>%<</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>>\NeedsTeXFormat{</xsl:text> + <xsl:value-of select="/db:book/@conformance"/> + <xsl:text>}[</xsl:text> + <xsl:value-of select="translate(/db:book/@condition,'-','/')"/> + <xsl:text>] +%<</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>>\Provides</xsl:text> + <xsl:value-of select="translate(substring($doctype,1,1), + 'abcdefghijklmn0pqrstuvwxyz', + 'ABCDEFGHIJKLMN0PQRSTUVWXYZ')"/> + <xsl:value-of select="substring($doctype,2)"/> + <xsl:text>{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>}</xsl:text> + <!-- used to be a newline and repeat tag here for classes --> + <xsl:text>[</xsl:text> + <!-- use the latest revision date as the distro date --> + <xsl:for-each select="//db:info/db:revhistory/db:revision"> + <xsl:sort select="@version" order="ascending"/> + <xsl:if test="position()=last()"> + <xsl:value-of + select="translate(db:date/@conformance,'-','/')"/> + </xsl:if> + </xsl:for-each> + <xsl:text> v</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>
%<</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>> </xsl:text> + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="//db:info/db:subtitle"> + <xsl:value-of select="normalize-space(//db:info/db:subtitle)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(//db:info/db:title)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="delogify"> + <xsl:with-param name="string" select="$title"/> + </xsl:call-template> + <!-- + <xsl:text> </xsl:text> + <xsl:value-of select="$doctype"/> + --> + <xsl:text>]
</xsl:text> + <!-- now add any packages needed for the class/package (only) + unless they are to be deferred to a later + section identified by an ID (in linkend) + This is done to allow declarations to wait until after options. + --> + <xsl:if test="/db:book/db:info/db:cover + /db:constraintdef[@xml:id=concat($filetype,'packages')] + [not(@linkend)] + /db:segmentedlist/db:seglistitem[db:seg!='']"> + <xsl:text>%% +%% Packages that need to be invoked at the start +%%
</xsl:text> + <xsl:for-each + select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id=concat($filetype,'packages')] + [not(@linkend)] + /db:segmentedlist/db:seglistitem[db:seg!='']"> + <xsl:call-template name="packages"> + <xsl:with-param name="pkg" select="."/> + <xsl:with-param name="dest" select="$filetype"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <!-- then start on the documentation --> + <xsl:text>%<*driver>
</xsl:text> + <!-- special action to preload xcolor options --> + <!-- \PassOptionsToPackage{svgnames}{xcolor} --> + <xsl:text>\PassOptionsToPackage{svgnames}{xcolor}
</xsl:text> + <xsl:text>\documentclass</xsl:text> + <xsl:if test="/db:book/@remap"> + <xsl:text>[</xsl:text> + <xsl:value-of select="/db:book/@remap"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{ltxdoc}
</xsl:text> + <!-- + PACKAGES FOR DOCUMENTATION + + Ensure we use all the required packages for documentation + (this applies in both package and class cases). This invokes + the pre- and post-commands from prepost.xml --> + <!-- AUTOPACKAGE: construct a node-set of packages needed --> + <xsl:variable name="packages"> + <!-- go through every step (package) in the PREPACKAGE spec + which has a constructorsynopsis element type --> + <xsl:for-each + select="$prepost/db:procedure/ + db:step/db:constructorsynopsis"> + <!-- build a node-list of elements in the + USER DOCUMENTATION, METADATA, or LICENCE + which match the @condition on the constructorsynopsis --> + <xsl:variable name="elements" + select="$thisdoc/db:book/db:part[@xml:id='doc' + and current()/@condition=''] + | + $thisdoc/db:book/db:part[@xml:id='doc']/ + descendant::*[name()=current()/@condition] + | + $thisdoc/db:book/db:info/ + (db:title|db:author|db:abstract|db:annotation)/ + descendant::*[name()=current()/@condition] + | + $licence//descendant::*[name()=current()/@condition]"/> + <!-- + <xsl:if test="count($elements)>0"> + <xsl:message> + <xsl:text>Checking for package </xsl:text> + <xsl:value-of select="parent::db:step/@remap"/> + <xsl:text>: 〈</xsl:text> + <xsl:value-of select="@condition"/> + <xsl:text>〉 has </xsl:text> + <xsl:value-of select="count($elements)"/> + <xsl:text> occurrences</xsl:text> + </xsl:message> + </xsl:if> + --> + <!-- if there are some elements matching, and the package is + not already explicitly requested or is not blocked --> + <xsl:if test="count($elements)>0 and + not($thisdoc//db:constraintdef[@xml:id='docpackages'] + /db:segmentedlist/db:seglistitem + [db:seg=current()/parent::db:step/@remap] + [not(@condition='off')])"> + <xsl:choose> + <!-- if the constructorsynopsis element is empty + then the package is required unconditionally + but may be excluded later if another package already + loads it (specified in @conformance) --> + <xsl:when test="count(db:methodparam)=0"> + <db:seglistitem role="{@condition} was detected." + conformance="{@conformance}"> + <db:seg> + <xsl:if test="parent::db:step/@role"> + <xsl:attribute name="role"> + <xsl:value-of select="parent::db:step/@role"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="parent::db:step/@remap"/> + </db:seg> + </db:seglistitem> + </xsl:when> + <!-- otherwise there are two ways to match: --> + <xsl:otherwise> + <xsl:for-each select="db:methodparam"> + <xsl:choose> + <!-- 1. a parameter giving the attribute, + with an optional modifier giving a value --> + <xsl:when + test="db:parameter and + $elements[@*[name()=current()/db:parameter]]"> + <xsl:choose> + <xsl:when test="count(db:modifier)=0"> + <db:seglistitem role="{parent::db:constructorsynopsis/@condition}/@{db:parameter} was detected." + conformance="{@conformance}"> + <db:seg> + <xsl:if test="ancestor::db:step/@role"> + <xsl:attribute name="role"> + <xsl:value-of select="ancestor::db:step/@role"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="ancestor::db:step/@remap"/> + </db:seg> + </db:seglistitem> + </xsl:when> + <xsl:otherwise> + <xsl:if + test="$elements[@*[name()=current()/db:parameter] + =current()/db:modifier]"> + <db:seglistitem role="{parent::db:constructorsynopsis/@condition}/@{db:parameter}='{db:modifier}' was detected." + conformance="{@conformance}"> + <db:seg> + <xsl:if test="ancestor::db:step/@role"> + <xsl:attribute name="role"> + <xsl:value-of select="ancestor::db:step/@role"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="ancestor::db:step/@remap"/> + </db:seg> + </db:seglistitem> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- 2. a funcparams giving the IDREF attribute + with a modifier giving the name of the + element type that the IDREF points at --> + <xsl:when + test="db:funcparams and + $elements[@*[name()=current()/db:funcparams]]"> + <xsl:variable name="modval" select="db:modifier"/> + <xsl:variable name="prepstep" + select="ancestor::db:step"/> + <xsl:variable name="prepmeth" + select="."/> + <!-- enter the document context --> + <xsl:for-each + select="$elements/@*[name()=current()/db:funcparams]"> + <xsl:if test="name($thisdoc//*[@xml:id=current()/.])= + $modval"> + <db:seglistitem role="{$prepstep/db:constructorsynopsis/@condition}/@{$prepmeth/db:funcparams}='{$prepmeth/db:modifier}' was detected." + conformance="{$prepstep/db:constructorsynopsis/@conformance}"> + <db:seg> + <xsl:if test="$prepstep/@role"> + <xsl:attribute name="role"> + <xsl:value-of select="$prepstep/@role"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="$prepstep/@remap"/> + </db:seg> + </db:seglistitem> + </xsl:if> + </xsl:for-each> + </xsl:when> + <!-- + <xsl:otherwise> + <db:seglistitem + role="parameter:{db:parameter};funcparams={db:funcparams};modifier={db:modifier}" + conformance="{@conformance}"> + <db:seg>unmatched</db:seg> + </db:seglistitem> + </xsl:otherwise> + --> + <!-- there is no otherwise --> + </xsl:choose> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <!-- + <xsl:message> + <xsl:value-of select="count($packages/*)"/> + <xsl:text> packages detected </xsl:text> + <xsl:text> times: names and values are:
</xsl:text> + <xsl:for-each select="$packages/*"> + <xsl:value-of select="name()"/> + <xsl:text> : </xsl:text> + <xsl:value-of select="child::*[1]"/> + <xsl:text>
</xsl:text> + </xsl:for-each> + </xsl:message> + --> + <xsl:if test="count($packages/db:seglistitem)>0"> + <!-- + <xsl:message> + <xsl:text>AUTOPACKAGE</xsl:text> + </xsl:message> + --> + <xsl:text>%% +%% Packages added automatically +%%
</xsl:text> + <xsl:for-each-group select="$packages/db:seglistitem" + group-by="db:seg"> + <xsl:choose> + <xsl:when + test="$packages/db:seglistitem[db:seg=current()/@conformance]"> + <!-- + <xsl:message> + <xsl:text>Omitting </xsl:text> + <xsl:value-of select="db:seg"/> + <xsl:text> automagically</xsl:text> + </xsl:message> + --> + </xsl:when> + <xsl:otherwise> + <!-- + <xsl:message> + <xsl:text>Adding </xsl:text> + <xsl:value-of select="db:seg"/> + <xsl:text> automagically</xsl:text> + </xsl:message> + --> + <xsl:call-template name="packages"> + <xsl:with-param name="pkg" select="."/> + <xsl:with-param name="dest" select="'doc'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each-group> + </xsl:if> + <!-- EXTRAS that AUTOPACKAGE can't handle --> + <!-- 1. Special for babel, needs languages --> + <xsl:variable name="baselang" select="/db:book/@xml:lang"/> + <xsl:if test="/db:book/db:part[@xml:id='doc']/ + descendant::*[@xml:lang][@xml:lang!=$baselang]"> + <xsl:text>% added babel automatically
\usepackage[</xsl:text> + <xsl:for-each-group group-by="@xml:lang" + select="/db:book/db:part[@xml:id='doc']/ + descendant::*[@xml:lang][@xml:lang!=$baselang]"> + <xsl:value-of + select="tokenize($langs/language[@iso=current()/@xml:lang]/@babel, + ' ')[1]"/> + <xsl:text>,</xsl:text> + </xsl:for-each-group> + <xsl:value-of select="tokenize($langs/language[@iso=$baselang]/@babel, + ' ')[1]"/> + <xsl:text>]{babel}
</xsl:text> + <xsl:message> + <xsl:text>Adding babel automatically for </xsl:text> + <xsl:for-each-group group-by="@xml:lang" + select="/db:book/db:part[@xml:id='doc']/ + descendant::*[@xml:lang][@xml:lang!=$baselang] + [not(local-name()='cmdsynopsis' or + local-name()='command' or + local-name()='literal' or + local-name()='methodsynopsis')]"> + <xsl:value-of + select="tokenize($langs/language[@iso=current()/@xml:lang]/@babel, + ' ')[1]"/> + <xsl:text>,</xsl:text> + </xsl:for-each-group> + <xsl:value-of + select="tokenize($langs/language[@iso=$baselang]/@babel, + ' ')[1]"/> + </xsl:message> + </xsl:if> + <!-- 2. any extra package required by the documentation + bibliography style. TODO: check prepost.xml --> + <xsl:if test="/db:book/db:part + //db:bibliography[@xreflabel]"> + <xsl:text>\usepackage{</xsl:text> + <xsl:value-of select="/db:book/db:part + //db:bibliography/@xreflabel"/> + <xsl:text>}
</xsl:text> + </xsl:if> + <!-- 3. url needed for metadata or abstract? + <xsl:if test="/db:book/db:info//db:author/db:email | + /db:book/db:info//db:author/db:uri | + /db:book/db:info/db:abstract//db:ulink | + /db:book/db:info/db:abstract//db:uri | + /db:book/db:info/db:abstract//db:email"> + <xsl:text>\usepackage{url}
</xsl:text> + </xsl:if> + --> + <!-- 4. load THIS package for use in the documentation? --> + <xsl:if test="$doctype='package' and /db:book/@xlink:role"> + <xsl:message> + <xsl:text>Adding </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text> as specified</xsl:text> + </xsl:message> + <xsl:text>\usepackage</xsl:text> + <xsl:if test="/db:book/@xlink:role!=''"> + <xsl:text>[</xsl:text> + <xsl:value-of select="/db:book/@xlink:role"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>}[</xsl:text> + <!-- use the latest revision date as the distro date --> + <xsl:for-each select="//db:info/db:revhistory/db:revision"> + <xsl:sort select="@version" order="ascending"/> + <xsl:if test="position()=last()"> + <xsl:value-of + select="translate(db:date/@conformance,'-','/')"/> + </xsl:if> + </xsl:for-each> + <xsl:text>]% added by specification
</xsl:text> + </xsl:if> + <!-- 5. Process all the requested packages last! + optionally use segtitle? --> + <xsl:text>%% +%% Packages added by author +%%
</xsl:text> + <xsl:for-each + select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id='docpackages'] + /db:segmentedlist/db:seglistitem + [db:seg!=''][not(db:seg/@condition='off')]"> + <xsl:call-template name="packages"> + <xsl:with-param name="pkg" select="."/> + <xsl:with-param name="dest" select="'doc'"/> + </xsl:call-template> + </xsl:for-each> + <!-- additional settings or documentation (again, applies to both) --> + <xsl:apply-templates select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id='docpackages'] + /db:cmdsynopsis[.!='']"/> + <!-- 6. Finally add classpack.sty for bells and whistles --> + <xsl:text>\usepackage{classpack} +%% +%% Settings for docstrip and latexdoc +%% +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\newlength{\revmarg} +\setlength{\revmarg}{1in}
</xsl:text> + <!-- struts only used in tabular setting --> + <xsl:if test="/db:book/db:part[@xml:id='doc']/ + descendant::db:tgroup"> + <xsl:text>\newcommand{\vstrut}{\vrule height1.2em depth.6667ex width0pt} +\newcommand{\prestrut}{\vrule height1em width0pt} +\newcommand{\poststrut}{\vrule depth.5ex width0pt}
</xsl:text> + </xsl:if> + <xsl:text>\begin{document}</xsl:text> + <xsl:value-of select="normalize-space(db:book/@annotations)"/> + <xsl:text>
 \DocInput{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{</xsl:text> + <xsl:value-of select="/db:book/@security"/> + <xsl:text>} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% 
</xsl:text> + <xsl:for-each select="/db:book/db:info/db:revhistory/db:revision"> + <xsl:text>% \changes{v</xsl:text> + <xsl:value-of select="@version"/> + <xsl:text>}{</xsl:text> + <xsl:value-of select="translate(db:date/@conformance,'-','/')"/> + <xsl:text>}{</xsl:text> + <xsl:value-of + select="normalize-space( + db:revdescription/db:itemizedlist/db:title)"/> + <xsl:text>: </xsl:text> + <xsl:choose> + <xsl:when + test="count(db:revdescription/db:itemizedlist/db:listitem)=1"> + <xsl:value-of + select="normalize-space( + db:revdescription/db:itemizedlist/db:listitem)"/> + </xsl:when> + <xsl:otherwise> + <xsl:for-each + select="db:revdescription/db:itemizedlist/db:listitem"> + <xsl:number/> + <xsl:text>) </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:if test="position()!=last()"> + <xsl:text>; </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + <xsl:text>.}
</xsl:text> + </xsl:for-each> + <xsl:text>% +% \GetFileInfo{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx}
</xsl:text> + <xsl:text>% +% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty} +% \DoNotIndex{\@flushglue,\@gobble,\@input} +% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle} +% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa} +% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue} +% \DoNotIndex{\@thanks,\@thefnmark,\@topnum} +% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin} +% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces} +% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup} +% \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef} +% \DoNotIndex{\egroup} +% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist} +% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global} +% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn} +% \DoNotIndex{\ifcase} +% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item} +% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower} +% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing} +% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc} +% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut} +% \DoNotIndex{\strutbox} +% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt} +% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@} +% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim} +% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary} +% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle} +% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode} +% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip} +% \DoNotIndex{\nopagebreak} +% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle} +% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb} +% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar} +% \DoNotIndex{\[,\{,\},\]} +% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode} +% \DoNotIndex{\baselineskip,\begin,\tw@} +% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q} +% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H} +% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z} +% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0} +% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_} +% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother} +% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment} +% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined} +% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc} +% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar} +% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode} +% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting} +% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf} +% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse} +% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault} +% \DoNotIndex{\bfdefault,\DeclareRobustCommand} +</xsl:text> + <!-- add an entry for examples except those with spaces --> + <xsl:for-each-group select="//db:command + [not(@role)] + [not(contains(.,' ') or contains(.,'{'))]" + group-by="normalize-space(.)"> + <xsl:text>% \DoNotIndex{\</xsl:text> + <xsl:value-of select="current-grouping-key()"/> + <xsl:text>}
</xsl:text> + </xsl:for-each-group> + <xsl:for-each + select="/db:book/db:info/db:cover/db:constraintdef[@xml:id='startdoc'] + /db:procedure/db:step[normalize-space(.)!=''] + /db:cmdsynopsis/db:command"> + <xsl:if test="contains(.,'@')"> + <xsl:text>% \makeatletter
</xsl:text> + </xsl:if> + <xsl:text>% </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>
</xsl:text> + <xsl:if test="contains(.,'@')"> + <xsl:text>% \makeatother
</xsl:text> + </xsl:if> + </xsl:for-each> + <xsl:text>%
</xsl:text> + <!-- now the fun starts --> + <xsl:apply-templates + select="db:book/db:info | + db:book/db:part[@xml:id='doc'] | + db:book/db:part[@xml:id='code'] | + db:book/db:part[@xml:id='files']"/> + <xsl:text>
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:info/db:abstract"> + <xsl:if test="db:title"> + <xsl:text>% \renewcommand{\abstractname}{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}\thispagestyle{empty}
</xsl:text> + </xsl:if> + <xsl:text>% \begin{abstract}
</xsl:text> + <!-- fix broken abstract when parskip is used + parskip is a default, so only do this when + it has been manually disabled --> + <xsl:if test="not(//db:constraintdef[@xml:id='docpackages']// + db:seglistitem/db:seg[.='parskip'][@condition='off'])"> + <xsl:text>% \parskip=0.5\baselineskip +% \advance\parskip by 0pt plus 2pt +% \parindent=0pt</xsl:text> + </xsl:if> + <xsl:text>% \noindent
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{abstract} +% \clearpage +% \tableofcontents
</xsl:text> + </xsl:template> + + <xsl:template name="readme"> + <xsl:variable name="file"> + <xsl:text>README</xsl:text> + </xsl:variable> + <xsl:result-document format="textFormat" href="{$file}"> + <xsl:apply-templates select="$readme/*" mode="readme"/> + </xsl:result-document> + </xsl:template> + + <xsl:template name="manifest"> + <xsl:variable name="file"> + <xsl:text>MANIFEST</xsl:text> + </xsl:variable> + <xsl:result-document format="textFormat" href="{$file}"> + <!-- these two files are always there --> + <xsl:text>README +MANIFEST +</xsl:text> + <!-- most of the rest: the .dtx and .ins files, the .pdf + documentation, and any ancillary files --> + <xsl:value-of select="$name"/> + <xsl:text>.dtx
</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.ins
</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.pdf
</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$filetype"/> + <xsl:text>
</xsl:text> + <!-- add any extra files extracted from the .dtx file --> + <xsl:for-each select="/db:book/db:part[@xml:id='code'] + /db:appendix[@xml:id and @xlink:href] + | + /db:book/db:part[@xml:id='files'] + /db:chapter/db:programlisting"> + <xsl:value-of select="@xlink:href"/> + <xsl:text>
</xsl:text> + </xsl:for-each> + <!-- add any extra files listed in the .xml file --> + <xsl:for-each select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id='manifest'] + /db:simplelist/db:member[.!='']"> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>
</xsl:text> + <!-- add any secondary files generated --> + <!-- TODO --> + </xsl:for-each> + </xsl:result-document> + </xsl:template> + + <!-- seglistitems containing the packages needed are passed here --> + + <xsl:template name="packages"> + <!-- packages are given as seglistitems --> + <xsl:param name="pkg"/> + <!-- documentation (dest=doc) or class/package (dest=cls/pkg) --> + <xsl:param name="dest"/> + <!-- know whether this is operating in deferred mode or not --> + <xsl:param name="mode"> + <xsl:text></xsl:text> + </xsl:param> + <!--[DEFERRED] start the package documentation block--> + <xsl:if test="$mode='deferred'"> + <xsl:text>% \begin{package}{</xsl:text> + <xsl:value-of select="$pkg/db:seg"/> + <xsl:text>}
</xsl:text> + <!-- doc for cls/sty output to .dtx --> + <xsl:apply-templates + select="$prepost/db:procedure[@xml:id='prepackage'] + /db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg]/db:para"/> + <xsl:if + test="count($prepost/db:procedure[@xml:id='prepackage'] + /db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg]/db:para)=0"> + <xsl:message> + <xsl:text>ADVISORY: Package </xsl:text> + <xsl:value-of select="$pkg/db:seg"/> + <xsl:text> for </xsl:text> + <xsl:value-of select="$filetype"/> + <xsl:text> has no documentation in prepost.xml</xsl:text> + </xsl:message> + </xsl:if> + <!-- additional per-sty/cls documentation from the + maintained document (or if generated by autopackage) --> + <xsl:if test="@role"> + <xsl:text>% </xsl:text> + <xsl:value-of select="normalize-space(@role)"/> + <xsl:text>
</xsl:text> + </xsl:if> + <!-- repeat for embedded comment doc --> + <xsl:if test="count($prepost/db:procedure[@xml:id='prepackage'] + /db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg]/db:para)>0"> + <xsl:text>% \iffalse
%% 
</xsl:text> + <xsl:apply-templates + select="$prepost/db:procedure[@xml:id='prepackage'] + /db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg]/db:para" mode="readme"/> + <xsl:text>% \fi
</xsl:text> + </xsl:if> + <xsl:text>% \begin{macrocode}
</xsl:text> + </xsl:if> + <!-- check if any special preprocessing is needed + for documentation packages out of prepost.xml + in the constraintdef element type --> + <xsl:for-each + select="$prepost/db:procedure[@xml:id='prepackage'] + /db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg] + /db:constraintdef/db:cmdsynopsis/db:command"> + <!-- checks for escaping internals only needed in doc mode --> + <xsl:if test="contains(.,'@') and $mode=''"> + <xsl:text>\makeatletter
</xsl:text> + </xsl:if> + <!-- output any predefined commands --> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>
</xsl:text> + <!-- [DEFERRED] add any comment from seg here + non-deferred comments get output *as* comments later + <xsl:if test="$pkg/db:seg/@role"> + <xsl:text> (</xsl:text> + <xsl:value-of select="normalize-space($pkg/db:seg/@role)"/> + <xsl:text>)</xsl:text> + </xsl:if> + --> + <!-- checks for escaping internals only needed in doc mode --> + <xsl:if test="contains(.,'@') and $mode=''"> + <xsl:text>\makeatother
</xsl:text> + </xsl:if> + </xsl:for-each> + <!-- decide on \usepackage (doc) or \RequirePackage (cls/sty) --> + <xsl:choose> + <!-- [DEFERRED] just needs RequirePackage --> + <xsl:when test="$mode='deferred'"> + <xsl:text>\RequirePackage</xsl:text> + </xsl:when> + <!-- stypackages or clspackages in non-deferred mode + need armour and RequirePackage --> + <xsl:when test="$dest=$filetype"> + <xsl:text>%<</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>>\RequirePackage</xsl:text> + </xsl:when> + <!-- otherwise it's plain \usepackage (for documentation) --> + <xsl:otherwise> + <xsl:text>\usepackage</xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- output package options in either case --> + <xsl:if test="$pkg/db:seg/@role + or + $prepost/db:procedure[@xml:id='prepackage']/ + db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg]/@role"> + <xsl:choose> + <!-- omit if role="" was specified --> + <xsl:when test="$pkg/db:seg/@role and $pkg/db:seg/@role=''"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>[</xsl:text> + <!-- try to deduplicate --> + <xsl:variable name="reqs"> + <xsl:value-of select="$pkg/db:seg/@role"/> + <xsl:text>,</xsl:text> + <xsl:value-of select="$prepost/db:procedure[@xml:id='prepackage']/ + db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg]/@role"/> + </xsl:variable> + <xsl:variable name="args"> + <xsl:for-each select="tokenize(normalize-space($reqs),',')"> + <arg> + <xsl:value-of select="normalize-space(.)"/> + </arg> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="rewrap"> + <xsl:with-param name="text"> + <xsl:for-each + select="$args/arg[.!=''][not(preceding-sibling::arg=.)]"> + <xsl:if test="position()>1"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:value-of select="."/> + </xsl:for-each> + </xsl:with-param> + </xsl:call-template> + <xsl:text>]</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!-- then the package name --> + <xsl:text>{</xsl:text> + <xsl:value-of select="$pkg/db:seg"/> + <xsl:text>}</xsl:text> + <!-- and the version check, if any --> + <xsl:if test="$pkg/db:seg/@version"> + <xsl:text>[</xsl:text> + <xsl:value-of + select="translate(substring($pkg/db:seg/@version,1,10),'-','/')"/> + <xsl:text>]</xsl:text> + </xsl:if> + <!-- only append comment in non-deferred mode + [DEFERRED] ones were added earlier as text --> + <xsl:if test="$pkg/@role and $mode=''"> + <xsl:text>% </xsl:text> + <xsl:value-of select="normalize-space($pkg/@role)"/> + </xsl:if> + <xsl:text>
</xsl:text> + <!-- check if any corresponding postprocessing is needed --> + <xsl:for-each + select="$prepost/db:procedure[@xml:id='postpackage'] + /db:step[contains(@condition,$dest)] + [@remap=$pkg/db:seg] + /db:constraintdef/db:cmdsynopsis/db:command"> + <xsl:if test="contains(.,'@') and $mode=''"> + <xsl:text>\makeatletter
</xsl:text> + </xsl:if> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>
</xsl:text> + <xsl:if test="contains(.,'@') and $mode=''"> + <xsl:text>\makeatother
</xsl:text> + </xsl:if> + </xsl:for-each> + <!-- [DEFERRED] terminate the code and output any postpackage + documentation --> + <xsl:if test="$mode='deferred'"> + <xsl:text>% \end{macrocode}
</xsl:text> + <xsl:apply-templates + select="$prepost/db:procedure[@xml:id='postpackage'] + /db:step[contains(@condition,$dest)] + [@remap=current()/db:seg]/para"/> + <xsl:text>% \end{package}
</xsl:text> + </xsl:if> + <!-- now see if the package we are documenting needs itself + loading for the documentation (eg for examples) + (only applies in non-deferred mode) --> + <xsl:if test="$mode='' and + $dest='doc' and $doctype='package' and /db:book/@role"> + <xsl:text>% \usepackage</xsl:text> + <xsl:if test="/db:book/@role!=''"> + <xsl:text>[</xsl:text> + <xsl:value-of select="/db:book/@role"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>}% added by specification
</xsl:text> + </xsl:if> + </xsl:template> + + <!-- rewrap designed for long options list in + \RequirePackage --> + + <xsl:template name="rewrap"> + <!-- text is a comma-separated vector or arguments --> + <xsl:param name="text"/> + <!-- maxlen is the max line length to output --> + <xsl:param name="maxlen"> + <xsl:text>32</xsl:text> + <!-- maxlen becomes 50 after the first line --> + </xsl:param> + <xsl:choose> + <!-- if text is an overlong string but contains a comma --> + <xsl:when test="string-length($text)>$maxlen and + contains($text,',')"> + <!-- see if there is a comma within the first $maxlen chars --> + <xsl:variable name="prelastcomma"> + <xsl:choose> + <xsl:when test="contains(substring($text,1,$maxlen),',')"> + <xsl:analyze-string select="substring($text,1,$maxlen)" + regex="^(.*)(,)([^,]*)$"> + <xsl:matching-substring> + <xsl:value-of select="concat(regex-group(1),',')"/> + </xsl:matching-substring> + <xsl:non-matching-substring> + <xsl:text>ERROR FINDING COMMA IN SUBSTRING</xsl:text> + </xsl:non-matching-substring> + </xsl:analyze-string> + </xsl:when> + <!-- No comma in range, test whole string --> + <xsl:otherwise> + <xsl:analyze-string select="$text" + regex="^(.*)(,)([^,]*)$"> + <xsl:matching-substring> + <xsl:value-of select="concat(regex-group(1),',')"/> + </xsl:matching-substring> + <xsl:non-matching-substring> + <xsl:text>ERROR FINDING COMMA IN WHOLE STRING</xsl:text> + </xsl:non-matching-substring> + </xsl:analyze-string> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$prelastcomma"/> + <xsl:choose> + <!-- seems not to be needed --> + <xsl:when test="ancestor::db:constraintdef + [@xml:id=concat($filetype,'packages')]"> + <!-- + <xsl:text>
%<</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>> </xsl:text> + --> + <xsl:text>
 </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>
 </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="rewrap"> + <xsl:with-param name="text" + select="normalize-space(substring-after($text,$prelastcomma))"/> + <xsl:with-param name="maxlen"> + <xsl:text>50</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- cmdsynopses contain special defs for documentation --> + + <xsl:template match="db:cmdsynopsis"> + <xsl:if test="position()=1 and ../db:cmdsynopsis[contains(.,'@')]"> + <xsl:text>\makeatletter
</xsl:text> + </xsl:if> + <xsl:choose> + <!-- new \write files: new: no arg --> + <xsl:when test="db:command/@remap='newwrite'"> + <xsl:text>\newwrite\</xsl:text> + <xsl:value-of select="db:command"/> + <xsl:text>
</xsl:text> + </xsl:when> + <!-- new counters --> + <xsl:when test="db:command/@remap='counter'"> + <xsl:text>\newcounter{</xsl:text> + <xsl:value-of select="db:command"/> + <xsl:text>}</xsl:text> + <xsl:if test="db:arg"> + <xsl:text>\setcounter{</xsl:text> + <xsl:value-of select="db:command"/> + <xsl:text>}{</xsl:text> + <xsl:value-of select="db:arg"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + </xsl:when> + <!-- new lengths --> + <xsl:when test="db:command/@remap='length'"> + <xsl:text>\newlength{\</xsl:text> + <xsl:value-of select="db:command"/> + <xsl:text>}</xsl:text> + <xsl:if test="db:arg"> + <xsl:text>\setlength{\</xsl:text> + <xsl:value-of select="db:command"/> + <xsl:text>}{</xsl:text> + <xsl:value-of select="db:arg"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + </xsl:when> + <!-- plain TeX commands --> + <xsl:when test="@xml:lang='TeX'"> + <xsl:if test="@role='long'"> + <xsl:text>\long</xsl:text> + </xsl:if> + <xsl:text>\def\</xsl:text> + <xsl:value-of select="db:command"/> + <xsl:if test="db:arg/@wordsize"> + <xsl:call-template name="repeatarg"> + <xsl:with-param name="limit" select="db:arg/@wordsize"/> + <xsl:with-param name="prefix" + select="substring(db:arg/@annotations,1, + (string-length(db:arg/@annotations) div 2))"/> + <xsl:with-param name="suffix" + select="substring(db:arg/@annotations, + (string-length(db:arg/@annotations) div 2)+1)"/> + </xsl:call-template> + </xsl:if> + <xsl:choose> + <xsl:when test="db:arg/@remap"> + <xsl:text>{</xsl:text> + <xsl:value-of + select="/db:book/@*[name()=current()/db:arg/@remap]"/> + <xsl:text>}
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>{%
	</xsl:text> + <xsl:value-of select="db:arg"/> + <xsl:text>}
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="db:command/@remap='environment' + and count(db:command/db:arg)=2"> + <xsl:choose> + <xsl:when test="db:command/@role='renew'"> + <xsl:text>\renewenvironment{</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\newenvironment{</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="db:command"/> + <xsl:text>}</xsl:text> + <!-- number of arguments, if any --> + <xsl:if test="db:arg[1]/@wordsize"> + <xsl:text>[</xsl:text> + <xsl:value-of select="db:arg[1]/@wordsize"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{%
	</xsl:text> + <xsl:value-of select="db:arg[1]"/> + <xsl:text>}
</xsl:text> + <xsl:text>{%
	</xsl:text> + <xsl:value-of select="db:arg[2]"/> + <xsl:text>}
</xsl:text> + </xsl:when> + <!-- LaTeX commands --> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="db:command/@role='renew'"> + <xsl:text>\renewcommand{\</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\newcommand{\</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="db:command"/> + <xsl:text>}</xsl:text> + <!-- number of arguments, if any --> + <xsl:if test="db:arg/@wordsize"> + <xsl:text>[</xsl:text> + <xsl:value-of select="db:arg/@wordsize"/> + <xsl:text>]</xsl:text> + <xsl:if test="db:arg/@condition"> + <xsl:text>[</xsl:text> + <xsl:value-of select="db:arg/@condition"/> + <xsl:text>]</xsl:text> + </xsl:if> + </xsl:if> + <xsl:choose> + <!-- remap is a reference to an attribute of the root + element, eg arch means use @arch --> + <xsl:when test="db:arg/@remap"> + <xsl:text>{</xsl:text> + <xsl:value-of + select="/db:book/@*[name()=current()/db:arg/@remap]"/> + <xsl:text>}
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>{%
	</xsl:text> + <xsl:value-of select="db:arg"/> + <xsl:text>}
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="position()=last() and ../db:cmdsynopsis[contains(.,'@')]"> + <xsl:text>\makeatother
</xsl:text> + </xsl:if> + </xsl:template> + + <!-- for info, we omit the cover settings (done earlier)--> + + <xsl:template match="db:info"> + <xsl:message> + <!-- + <xsl:text> on </xsl:text> + <xsl:value-of select="$host"/> + --> + <xsl:text>Creating </xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text> '</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>' (v</xsl:text> + <xsl:value-of select="$version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$revision"/> + <xsl:text>) with checksum </xsl:text> + <xsl:value-of select="/db:book/@security"/> + <xsl:text>.</xsl:text> + </xsl:message> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:cover"/> + + <xsl:template match="db:info/db:title"> + <!-- if this is a class, or a package which has not been + loaded in the documentation, ensure the \fileversion + and \filedate values are made available --> + <xsl:if test="/db:book/@arch='package' or + not(/db:book/@xlink:role)"> + <xsl:text>% \def\fileversion{</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>}
% \def\filedate{</xsl:text> + <xsl:for-each select="//db:info/db:revhistory/db:revision"> + <xsl:sort select="@version" order="ascending"/> + <xsl:if test="position()=last()"> + <xsl:value-of + select="translate(db:date/@conformance,'-','/')"/> + </xsl:if> + </xsl:for-each> + <xsl:text>}
</xsl:text> + </xsl:if> + <xsl:text>% \title{The </xsl:text> + <xsl:text> \textsf{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>} \LaTeXe\ </xsl:text> + <xsl:choose> + <xsl:when test="$doctype='class'"> + <xsl:text>document class</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$doctype"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>\thanks{%
% This document corresponds to \textsf{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>}
% \textit{v.}\ \fileversion, dated \filedate.}</xsl:text> + <xsl:if test="ancestor::db:info/descendant::db:author/ + db:contrib[@role='sponsor']"> + <xsl:text>\enspace\thanks{%
% Development has been supported by </xsl:text> + <xsl:for-each + select="ancestor::db:info/descendant::db:author/ + db:contrib[@role='sponsor']"> + <xsl:if test="position()>1"> + <xsl:text>, </xsl:text> + <xsl:if test="position()=last()"> + <xsl:text>and </xsl:text> + </xsl:if> + </xsl:if> + <xsl:apply-templates/> + </xsl:for-each> + <xsl:text>.}</xsl:text> + </xsl:if> + <xsl:text>
% \\[1em]\Large 
% </xsl:text> + <xsl:apply-templates/> + <xsl:if test="following-sibling::db:subtitle[not(@role='labelonly')]"> + <xsl:text>
% \\[1ex]\large 
% </xsl:text> + <xsl:apply-templates select="following-sibling::db:subtitle/node()"/> + </xsl:if> + <xsl:text>}
</xsl:text> + </xsl:template> + + <xsl:template match="db:info/db:subtitle"/> + + <xsl:template match="db:info//db:author"> + <xsl:if test="count(preceding-sibling::db:author)=0"> + <xsl:text>% \author{</xsl:text> + </xsl:if> + <xsl:for-each select="db:personname/db:*"> + <xsl:apply-templates/> + <xsl:if test="position()!=last()"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + <xsl:apply-templates select="db:honorific | db:affiliation"/> + <xsl:if test="db:email"> + <xsl:text>\\\normalsize(\url{</xsl:text> + <xsl:value-of select="db:email"/> + <xsl:text>})</xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="following-sibling::db:author"> + <xsl:text>
% \and
% </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>}
% \maketitle
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:honorific"> + <xsl:text> \textsc{</xsl:text> + <xsl:value-of select="translate(., + 'ABCDEFGHIJKLMN0PQRSTUVWXYZ', + 'abcdefghijklmn0pqrstuvwxyz')"/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:affiliation"> + <xsl:text>\\\normalsize </xsl:text> + <xsl:for-each select="db:*"> + <xsl:value-of select="normalize-space(.)"/> + <!-- encapitalisation for Centre, Hospital, Unit, and Project --> + <xsl:if test="@remap"> + <xsl:text> </xsl:text> + <xsl:value-of + select="translate(substring(@remap,1,1),'cuhp','CUHP')"/> + <xsl:value-of select="substring(@remap,2)"/> + </xsl:if> + <xsl:if test="position()!=last()"> + <xsl:text>\\[-.25ex]\normalsize </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:template> + + <xsl:template match="db:info/db:releaseinfo | + db:info/db:annotation | + db:info/db:revhistory | + db:info/db:copyright"/> + + <!-- normal text --> + + <xsl:template match="db:para"> + <!-- include percent-space for the fake steps in prepost.xml --> + <xsl:choose> + <xsl:when test="ancestor::db:procedure[@xml:id='prepackage' or + @xml:id='postpackage']"> + <xsl:text>% </xsl:text> + </xsl:when> + <!-- omit for the first para in a list item --> + <xsl:when test="(parent::db:listitem or parent::db:step) + and count(preceding-sibling::db:para)=0"> + <xsl:text></xsl:text> + </xsl:when> + <!-- omit for the first para in a table cell --> + <xsl:when test="parent::db:entry and position()=1"> + <xsl:text></xsl:text> + </xsl:when> + <!-- otherwise include --> + <xsl:otherwise> + <xsl:text>% </xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- label it if necessary --> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <!-- remap allows the bodging of (eg) font controls + to apply just to this paragraph --> + <xsl:if test="@remap"> + <xsl:text>{</xsl:text> + <xsl:value-of select="@remap"/> + </xsl:if> + <!-- do it --> + <xsl:apply-templates/> + <!-- if this is in a list item, note, footnote, or blockquote + AND there are no more paragraphs to come, + THEN DO NOT OUTPUT ANYTHING because the container will + handle the closing syntax --> + <xsl:choose> + <!-- no \par after sole or last para, just a CR --> + <xsl:when test="(parent::db:listitem or + parent::db:note or + parent::db:footnote or + parent::db:blockquote) and + not(following-sibling::db:para)"> + <xsl:text></xsl:text> + </xsl:when> + <!-- OR, if this is the last or sole paragraph in an + auto-included documentation chunk in prepost.xml, + omit the \par --> + <xsl:when + test="(parent::db:step/parent::db:procedure[@xml:id='prepackage'] or + parent::db:step/parent::db:procedure[@xml:id='postpackage']) + and not(following-sibling::db:para)"> + <xsl:text></xsl:text> + </xsl:when> + <!-- otherwise it's the end of a paragraph, which we + make explicit, rather than rely on newlines --> + <xsl:otherwise> + <xsl:text>\par</xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- add punctuation if the sole or last in a list item, + only when needed, + ie if this para does NOT end with its own punctuation + and is not IMMEDIATELY followed by punctuation --> + <xsl:if test="parent::db:listitem + and + not(contains(',.;:!?',substring(normalize-space(.), + string-length(normalize-space(.))))) + and + not(contains(',.;:!?',substring(normalize-space(( + ancestor::db:itemizedlist[1] | + ancestor::db:orderedlist[1] | + ancestor::db:variablelist[1])[1]/ + following-sibling::node()[1]),1,1)))"> + <!-- only add punct to last para in item --> + <xsl:if test="not(following-sibling::db:para)"> + <xsl:choose> + <!-- add semicolon to all but last --> + <xsl:when test="parent::db:listitem/following-sibling::db:listitem"> + <xsl:text>;</xsl:text> + </xsl:when> + <!-- add fullpoint to last except inline --> + <xsl:otherwise> + <xsl:text>.</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:if> + <!-- terminate any font bodges --> + <xsl:if test="@remap"> + <xsl:text>}</xsl:text> + </xsl:if> + <!-- in the case of notes, footnotes, and cell content + we don't even want a newline --> + <xsl:if test="not(parent::db:note or + parent::db:footnote or + parent::db:entry)"> + <xsl:text>
</xsl:text> + <!-- but we need a space after \par in the case of cell content --> + <xsl:if test="parent::db:entry"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:if> + <!-- inline documentation echo, except for footnotes, which + get done inline in db2plaintext.xsl --> + <xsl:if test="ancestor::db:part[@xml:id='code'] and + not(parent::db:footnote)"> + <xsl:text>% \iffalse
%% 
</xsl:text> + <xsl:apply-templates select="." mode="readme"/> + <xsl:text>% \fi
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:literal[not(@xml:lang='LaTeX')]"> + <xsl:call-template name="avoidverb"/> + </xsl:template> + + <xsl:template match="db:literal[@xml:lang='LaTeX']"> + <xsl:value-of select="."/> + </xsl:template> + + <xsl:template match="db:preface"> + <xsl:choose> + <!-- formal prefaces get a title and a ToC entry --> + <xsl:when test="db:title"> + <xsl:text>% \clearpage\section*{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}\addcontentsline{toc}{subsection}{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}</xsl:text> + </xsl:when> + <!-- untitled ones don't --> + <xsl:otherwise> + <xsl:text>% \clearpage\null\vfill\begingroup\centering</xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- and a label if they have an ID --> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <!-- terminate the centering group for untitled prefaces --> + <xsl:if test="not(db:title)"> + <xsl:text>% \par\endgroup\vfill
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:info/db:abstract/db:title | + db:preface/db:title | + db:preface/db:section/db:title | + db:chapter/db:title | db:chapter/db:subtitle | + db:chapter/db:sect1/db:title | + db:chapter//db:sect2/db:title | + db:chapter//db:sect3/db:title | + db:chapter//db:sect4/db:title | + db:appendix/db:title | + db:appendix/db:sect1/db:title | + db:appendix//db:sect2/db:title | + db:appendix//db:sect3/db:title | + db:appendix//db:sect4/db:title | + db:bibliography/db:title"/> + + <xsl:template match="db:part"> + <!-- there are three possible parts: doc, code, and files --> + <xsl:choose> + <!-- documentation --> + <xsl:when test="@xml:id='doc'"> + <!-- iterate through commands and environment variables + to be referenced, in order of length, longest first --> + <xsl:for-each-group group-by="normalize-space(.)" + select="descendant::db:command + [@role and not(@xml:lang or + contains(.,'[') or contains(.,'{'))] + | + descendant::db:envar + [@role and not(@xml:lang or + contains(.,'[') or contains(.,'{'))] + | + descendant::db:tag[@role] + | + descendant::db:varname[@role] + | + descendant::db:classname[@role] + | + descendant::db:package[@role] + | + descendant::db:annotation/@xreflabel"> + <!-- varname? --> + <xsl:sort select="string-length(current-grouping-key())" + data-type="number" order="descending"/> + <!-- only use the first one --> + <xsl:if test="position()=1"> + <xsl:text>% \addtolength{\revmarg}{\widthof{\LabelFont{</xsl:text> + <xsl:value-of select="current-grouping-key()"/> + <xsl:text>}}} +% \newgeometry{left=\revmarg}
</xsl:text> + </xsl:if> + </xsl:for-each-group> + <xsl:apply-templates/> + </xsl:when> + <!-- for the code part, start by terminating the userdoc --> + <xsl:when test="@xml:id='code'"> + <xsl:text>% \StopEventually{\label{endcode} +% \clearpage +% \newgeometry{left=3cm} +% \addcontentsline{toc}{section}{Change History} +% \label{</xsl:text> + <xsl:value-of select="/db:book/db:info/db:revhistory/@xml:id"/> + <xsl:text>} +% \PrintChanges +% \clearpage +% \label{codeindex} +% \addcontentsline{toc}{section}{Index} +% \PrintIndex}
</xsl:text> + <!-- iterate through commands and environment variables + to be referenced, in order of length, longest first --> + <xsl:for-each-group group-by="normalize-space(.)" + select="descendant::db:command + [@role and not(@xml:lang or + contains(.,'[') or contains(.,'{'))] + | + descendant::db:envar + [@role and not(@xml:lang or + contains(.,'[') or contains(.,'{'))] + | + descendant::db:tag[@role] + | + descendant::db:varname[@role] + | + descendant::db:classname[@role] + | + descendant::db:package[@role] + | + descendant::db:annotation/@xreflabel"> + <!-- varname? --> + <xsl:sort select="string-length(current-grouping-key())" + data-type="number" order="descending"/> + <!-- only use the first one --> + <xsl:if test="position()=1"> + <xsl:text>% \setlength{\revmarg}{1in} +% \addtolength{\revmarg}{\widthof{\MacroFont{</xsl:text> + <xsl:value-of select="current-grouping-key()"/> + <xsl:text>}}} +% \newgeometry{left=\revmarg}
</xsl:text> + </xsl:if> + </xsl:for-each-group> + <!-- The code part could be a monolith (no chapters) + so it would all be one <package> or <class> + But if (usually) it has chapters, the tags for the + primary output need to be set round the chapters, + and any appendices may be ancillary files --> + <xsl:if test="count(db:chapter)=0"> + <!-- no chapters, so output start-tag now --> + <xsl:text>% \label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>} +% \iffalse +%<*</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>> +% \fi
</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="count(db:chapter)=0"> + <!-- no chapters, so output end-tag now --> + <xsl:text>% \iffalse +%</</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>> +% \fi
</xsl:text> + </xsl:if> + <!-- once the code has been done, and before any + standalone ancillary files are done, + output the Licence as an appendix --> + <xsl:if test="not(//db:appendix)"> + <xsl:text>% \appendix
</xsl:text> + </xsl:if> + <xsl:text>% \newgeometry{left=3cm}
</xsl:text> + <xsl:apply-templates select="$licence"/> + <!-- finally, do any delayed-output extractable files from + the code part (these need no accompanying text as + they're just re-given here for extraction) --> + <xsl:for-each select="descendant::db:programlisting + [@xml:id and @xlink:show='new' and @xlink:href]"> + <xsl:text>% \iffalse
%<*</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>>
</xsl:text> + <xsl:call-template name="lrtrim"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + <xsl:text>
%</</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>>
% \fi
</xsl:text> + </xsl:for-each> + </xsl:when> + <!-- Part I page is generated by first chapter in part/@xml:id='doc'--> + <xsl:when test="@xml:id='files'"> + <!-- output files that do not require pre/postamble here --> + <xsl:apply-templates mode="files"/> + </xsl:when> + <!-- what other kind of part can there be? --> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="count(following-sibling::db:part)=0"> + <xsl:text>% \Finale
</xsl:text> + </xsl:if> + </xsl:template> + + <!-- TEXT --> + + <xsl:template match="db:acknowledgements"> + <xsl:text>% \subsection*{Acknowledgments}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'after'"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="db:chapter[not(@condition='draft')]"> + <!-- only if it contains something --> + <xsl:if test="normalize-space(.)!=''"> + <!-- output the start-tag if this is the first chapter --> + <xsl:if test="parent::db:part[@xml:id='code'] and + count(preceding-sibling::db:chapter)=0"> + <xsl:text>% \iffalse +%<*</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>> +% \fi
</xsl:text> + </xsl:if> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'before'"/> + </xsl:call-template> + <xsl:text>% \clearpage
</xsl:text> + <xsl:text>% \section</xsl:text> + <xsl:if test="db:subtitle"> + <xsl:text>[</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:if test="db:subtitle"> + <xsl:text>~--- </xsl:text> + <xsl:apply-templates select="db:subtitle/node()"/> + </xsl:if> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:if test="ancestor::db:part[@xml:id='code']"> + <xsl:text>% \iffalse
%% 
</xsl:text> + <xsl:apply-templates select="db:title|db:subtitle" mode="readme"/> + <xsl:text>% \fi
</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'after'"/> + </xsl:call-template> + </xsl:if> + <!-- output the end-tag if this is the last chapter --> + <xsl:if test="parent::db:part[@xml:id='code'] and + count(following-sibling::db:chapter)=0"> + <xsl:text>% \iffalse +%</</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>> +% \fi
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:appendix"> + <!-- only do appendices with content, and do not output any + programlisting code *as* code, only as documentation --> + <xsl:if test="normalize-space(.)!=''"> + <!-- if this is the first appendix, issue the \appendix switch --> + <xsl:if test="count(preceding-sibling::db:appendix)=0"> + <xsl:text>% \appendix
</xsl:text> + </xsl:if> + <!-- if this is a documented extractable *file*, tag it --> + <xsl:if test="parent::db:part[@xml:id='code'] + and @xlink:href and @xml:id"> + <xsl:text>% \iffalse +%<*</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>> +% \fi
</xsl:text> + </xsl:if> + <!-- normal titling --> + <xsl:text>% \clearpage +% \section{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:if test="ancestor::db:part[@xml:id='code']"> + <xsl:text>% \iffalse
%% 
</xsl:text> + <xsl:apply-templates select="db:title|db:subtitle" mode="readme"/> + <xsl:text>% \fi
</xsl:text> + </xsl:if> + <!-- if this is documented extractable file, output an + identity --> + <xsl:if test="parent::db:part[@xml:id='code'] + and @xlink:href and @xml:id"> + <xsl:variable name="ext" select="substring-after(@xlink:href,'.')"/> + <xsl:if test="($ext='cls' or $ext='sty') + and not(@conformance='nointro')"> + <xsl:text>% \begin{macrocode}
\NeedsTeXFormat{</xsl:text> + <xsl:value-of select="/db:book/@conformance"/> + <xsl:text>}[</xsl:text> + <xsl:value-of select="translate(/db:book/@condition,'-','/')"/> + <xsl:text>]
\Provides</xsl:text> + <xsl:choose> + <xsl:when test="$ext='sty'"> + <xsl:text>Package</xsl:text> + </xsl:when> + <xsl:when test="$ext='cls'"> + <xsl:text>Class</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text>{</xsl:text> + <xsl:value-of select="substring-before(@xlink:href,'.')"/> + <xsl:text>}[</xsl:text> + <!-- use the latest revision date as the distro date --> + <xsl:for-each select="/db:book/db:info/db:revhistory/db:revision"> + <xsl:sort select="@version" order="ascending"/> + <xsl:if test="position()=last()"> + <xsl:value-of + select="translate(db:date/@conformance,'-','/')"/> + </xsl:if> + </xsl:for-each> + <xsl:text> v</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>
 </xsl:text> + <xsl:variable name="title"> + <xsl:value-of select="normalize-space(db:title)"/> + <xsl:if test="db:subtitle"> + <xsl:text>: </xsl:text> + <xsl:value-of select="normalize-space(db:subtitle)"/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($title,'\LaTeXe{}')"> + <xsl:value-of select="substring-before($title,'\LaTeXe{}')"/> + <xsl:text>LaTeX2e</xsl:text> + <xsl:value-of select="substring-after($title,'\LaTeXe{}')"/> + </xsl:when> + <xsl:when test="contains($title,'\LaTeX{}')"> + <xsl:value-of select="substring-before($title,'\LaTeX{}')"/> + <xsl:text>LaTeX</xsl:text> + <xsl:value-of select="substring-after($title,'\LaTeX{}')"/> + </xsl:when> + <xsl:when test="contains($title,'\TeX{}')"> + <xsl:value-of select="substring-before($title,'\TeX{}')"/> + <xsl:text>TeX</xsl:text> + <xsl:value-of select="substring-after($title,'\TeX{}')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$title"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>]
% \end{macrocode}
</xsl:text> + </xsl:if> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="@xlink:href and @xml:id"> + <xsl:text>% \iffalse +%</</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>> +% \fi
</xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect1"> + <xsl:if test="normalize-space(.)!=''"> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'before'"/> + </xsl:call-template> + <xsl:if test="@condition='newpage'"> + <xsl:text>% \clearpage
</xsl:text> + </xsl:if> + <xsl:text>% \subsection{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:if test="ancestor::db:part[@xml:id='code']"> + <xsl:text>% \iffalse
%% 
</xsl:text> + <xsl:apply-templates select="db:title|db:subtitle" mode="readme"/> + <xsl:text>% \fi
</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'after'"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect2"> + <xsl:if test="normalize-space(.)!=''"> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'before'"/> + </xsl:call-template> + <xsl:text>% \subsubsection{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:if test="ancestor::db:part[@xml:id='code']"> + <xsl:text>% \iffalse
%% 
</xsl:text> + <xsl:apply-templates select="db:title|db:subtitle" mode="readme"/> + <xsl:text>% \fi
</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'after'"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect3"> + <xsl:if test="normalize-space(.)!=''"> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'before'"/> + </xsl:call-template> + <xsl:text>% \paragraph{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <!-- + <xsl:if test="not(contains(':–-—',substring(normalize-space(db:title),string-length(normalize-space(db:title)))))"> + <xsl:text>—</xsl:text> + </xsl:if> + --> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'after'"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect4"> + <xsl:if test="normalize-space(.)!=''"> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'before'"/> + </xsl:call-template> + <xsl:text>% \subparagraph{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:if test="not(contains(':–-—',substring(normalize-space(db:title),string-length(normalize-space(db:title)))))"> + <xsl:text>\thinspace:</xsl:text> + </xsl:if> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <xsl:call-template name="checkpackages"> + <xsl:with-param name="pos" select="'after'"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="checkpackages"> + <xsl:param name="pos"/> + <xsl:if test="/db:book/db:info/db:cover/db:constraintdef + [@xml:id='clspackages' or @xml:id='stypackages'] + [@linkend=current()/@xml:id] + [@role=$pos or not(@role)]"> + <xsl:variable name="gi" select="local-name()"/> + <xsl:text>%\iffalse +%% +%% Packages required +%% +% \fi +% \</xsl:text> + <xsl:choose> + <xsl:when test="$gi='chapter' or $gi='appendix'"> + <xsl:text>clearpage
% \section</xsl:text> + </xsl:when> + <xsl:when test="$gi='sect1'"> + <xsl:text>subsection</xsl:text> + </xsl:when> + <xsl:when test="$gi='sect2'"> + <xsl:text>subsubsection</xsl:text> + </xsl:when> + <xsl:when test="$gi='sect3'"> + <xsl:text>paragraph</xsl:text> + </xsl:when> + <xsl:when test="$gi='sect4'"> + <xsl:text>subparagraph</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>WARNING: </xsl:text> + <xsl:value-of select="$gi"/> + <xsl:text> is an unidentifiable place to declare packages</xsl:text> + </xsl:message> + <xsl:text>message{Unidentifiable place to declare packages}</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>{</xsl:text> + <xsl:choose> + <xsl:when test="/db:book/db:info/db:cover + /db:constraintdef[@linkend=current()/@xml:id] + /db:segmentedlist/db:segtitle"> + <xsl:apply-templates + select="/db:book/db:info/db:cover + /db:constraintdef[@linkend=current()/@xml:id] + /db:segmentedlist/db:segtitle/node()"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>Packages loaded</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}\label{</xsl:text> + <xsl:value-of + select="/db:book/db:info/db:cover + /db:constraintdef[@linkend=current()/@xml:id] + /@xml:id"/> + <xsl:text>}
</xsl:text> + <xsl:for-each + select="/db:book/db:info/db:cover + /db:constraintdef[@linkend=current()/@xml:id] + /db:segmentedlist/db:seglistitem[db:seg!='']"> + <xsl:call-template name="packages"> + <xsl:with-param name="pkg" select="."/> + <xsl:with-param name="dest" select="$filetype"/> + <xsl:with-param name="mode" select="'deferred'"/> + </xsl:call-template> + </xsl:for-each> + <xsl:text>% 
</xsl:text> + <xsl:if test="/db:book/db:info/db:cover + /db:constraintdef[@linkend=current()/@xml:id] + /@xml:id!='stypackages' + and + /db:book/db:info/db:cover + /db:constraintdef[@linkend=current()/@xml:id] + /@xml:id!='clspackages'"> + <xsl:message> + <xsl:text>WARNING: these packages were listed in a </xsl:text> + <xsl:value-of select="$gi"/> + <xsl:text> element of the master document that was not flagged as belonging to this </xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text> (xml:id="</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>").</xsl:text> + </xsl:message> + <xsl:text>% WARNING: these packages were listed in +% a \verb`</xsl:text> + <xsl:value-of select="$gi"/> + <xsl:text>` of the master document that was not flagged +% as belonging to this </xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text> (\verb`xml:id="</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>"`).
</xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <!-- section in prelims needs to be done as subsection --> + + <xsl:template match="db:section"> + <xsl:text>% \subsection*{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:blockquote"> + <xsl:text>% \begin{quotation}</xsl:text> + <xsl:text>\small\noindent
</xsl:text> + <xsl:apply-templates/> + <xsl:if test="@linkend"> + <xsl:text>% \hfill\begingroup</xsl:text> + <xsl:call-template name="makeref"/> + <xsl:text>\parfillskip=0pt\par\endgroup
</xsl:text> + </xsl:if> + <xsl:text>% \end{quotation}
</xsl:text> + </xsl:template> + + <xsl:template match="db:warning | db:sidebar"> + <xsl:text>% \par\begingroup\fboxsep1em\centering
% \</xsl:text> + <xsl:choose> + <xsl:when test="name()='sidebar'"> + <xsl:text>shadowbox</xsl:text> + </xsl:when> + <xsl:when test="name()='warning'"> + <xsl:text>fbox</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text>{\begin{minipage}{</xsl:text> + <xsl:choose> + <xsl:when test="@wordsize"> + <xsl:value-of + select="number(substring-before(@wordsize,'%')) div 100"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>0.8</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>\columnwidth}\sffamily +% \raggedright\parindent0pt\parskip=.5\baselineskip
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{minipage}}\par\endgroup
</xsl:text> + </xsl:template> + + <xsl:template match="db:warning/db:title | db:sidebar/db:title"> + <xsl:text>% \subsubsection*{\sffamily </xsl:text> + <xsl:apply-templates/> + <xsl:text>}
</xsl:text> + </xsl:template> + + <xsl:template match="db:sidebar/db:address"> + <xsl:text>% \par\raggedleft </xsl:text> + <xsl:apply-templates/> + <xsl:text>\par
</xsl:text> + </xsl:template> + + <!-- main element for code fragment markup --> + + <xsl:template match="db:annotation[@role and @role!='' and @xreflabel] + [not(@annotations)]"> + <xsl:variable name="role" select="@role"/> + <xsl:text>% \begin{</xsl:text> + <xsl:value-of select="$role"/> + <xsl:text>}{</xsl:text> + <xsl:if test="$role='macro' or $role='variable' or + $prepost//db:command[starts-with(.,'\doxitem')] + [contains(.,concat('{',$role,'}'))] + [contains(.,'macrolike')]"> + <xsl:text>\</xsl:text> + </xsl:if> + <xsl:value-of select="@xreflabel"/> + <xsl:text>}
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{</xsl:text> + <xsl:value-of select="$role"/> + <xsl:text>}
</xsl:text> + </xsl:template> + + <!-- pull option declaration data from spec tree --> + + <xsl:template match="db:annotation[@annotations]"> + <xsl:apply-templates/> + <xsl:variable name="college" select="tokenize(@audience,' ')"/> + <xsl:variable name="canopy" + select="//db:part[@xml:id='data'] + //db:constraintdef[@xml:id=current()/@annotations]"/> + <xsl:for-each select="$college"> + <xsl:variable name="item" select="."/> + <xsl:text>% \subsubsection{</xsl:text> + <xsl:value-of select="translate(., + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> + <xsl:text>}
</xsl:text> + <xsl:apply-templates mode="declareoption" + select="$canopy + //db:methodsynopsis[tokenize(@arch,' ')=$item]"> + </xsl:apply-templates> + </xsl:for-each> + </xsl:template> + + <xsl:template match="db:annotation/db:title"> + <xsl:text>% \subsection{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}
</xsl:text> + </xsl:template> + + <xsl:template match="db:methodsynopsis" mode="declareoption"> + <!-- make a low-level title --> + <xsl:text>% \paragraph{</xsl:text> + <xsl:value-of + select="normalize-space(db:methodparam[last()]/db:parameter)"/> + <!-- start a Code block for the option --> + <xsl:text>}
% \begin{option}{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}
% </xsl:text> + <!-- now the descriptive text as a paragraph --> + <!-- multiple parameters only for divisions, not degrees --> + <!-- in document order, which is hierarchical top-down --> + <xsl:for-each select="db:methodparam/db:parameter"> + <xsl:sort select="position()" order="descending"/> + <xsl:if test="position()>1"> + <xsl:text> in </xsl:text> + </xsl:if> + <xsl:value-of select="normalize-space(.)"/> + <xsl:if test="not(@role='degree')"> + <xsl:text> (</xsl:text> + <xsl:value-of select="@role"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:for-each> + <xsl:text>; </xsl:text> + <xsl:if test="not(db:methodparam/db:parameter/@role='degree')"> + <xsl:text>
% using the </xsl:text> + <!-- langs in methodsynopsis/@xml:lang for babel --> + <xsl:value-of select="normalize-space(db:methodname)"/> + <xsl:text> citation format
% from the \verb`</xsl:text> + <xsl:value-of select="db:methodparam[1]/db:initializer"/> + <xsl:text>.bst` \BibTeX\ style</xsl:text> + <xsl:if test="db:methodparam[1]/db:modifier"> + <xsl:text> with the </xsl:text> + <xsl:for-each select="db:methodparam[1]/db:modifier"> + <xsl:if test="preceding-sibling::db:modifier"> + <xsl:text> and </xsl:text> + </xsl:if> + <xsl:text>\textsf{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:for-each> + <xsl:text> package</xsl:text> + <xsl:if test="count(db:methodparam[1]/db:modifier)>1"> + <xsl:text>s</xsl:text> + </xsl:if> + </xsl:if> + <xsl:choose> + <xsl:when test="contains(@xlink:href,'@')"> + <xsl:text> (confirmed by \url{</xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text>})</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> (unconfirmed)</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!-- followed by the actual code for the declared option --> + <xsl:text>.
% \begin{macrocode}
\DeclareOption{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}{%
</xsl:text> + <!-- order doesn't matter here, but the line length does (maxcodelen) --> + <xsl:for-each select="db:methodparam/db:parameter"> + <xsl:text> \</xsl:text> + <xsl:value-of select="@role"/> + <xsl:if test="@remap=''"> + <xsl:text>[]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <!-- no more test for length to break if needed: too complex + <xsl:call-template name="breakline"> + <xsl:with-param name="string" select="normalize-space(.)"/> + </xsl:call-template> --> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}
</xsl:text> + </xsl:for-each> + <xsl:if test="db:methodparam[1]/db:modifier or + db:methodparam[1]/db:initializer"> + <xsl:text> \@usebib</xsl:text> + <xsl:if test="db:methodparam[1]/db:modifier"> + <xsl:text>[</xsl:text> + <xsl:for-each select="db:methodparam[1]/db:modifier"> + <xsl:if test="position()>1"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:value-of select="."/> + </xsl:for-each> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:value-of select="db:methodparam[1]/db:initializer"/> + <xsl:text>}{</xsl:text> + <xsl:value-of select="db:methodname"/> + <xsl:text>}{}
</xsl:text> + </xsl:if> + <!-- dept-specific languages one day + <xsl:if test="@xml:lang"> + <xsl:text> \use@babel[</xsl:text> + <xsl:value-of select="translate(normalize-space(@xml:lang),' ',',')"/> + <xsl:text>]{</xsl:text> + <xsl:text>english</xsl:text> + <xsl:text>}
</xsl:text> + <xsl:variable name="langsused"> + <xsl:value-of select="normalize-space(@xml:lang)"/> + </xsl:variable> + <xsl:if test="@audience"> + <xsl:for-each select="tokenize(@audience,' ')"> + <xsl:variable name="curtok" select="position()"/> + <xsl:text> \def\</xsl:text> + <xsl:value-of select="upper-case(.)"/> + <xsl:text>{\foreignlanguage{</xsl:text> + <xsl:value-of select="tokenize($langsused,' ')[position()=$curtok]"/> + <xsl:text>}}
</xsl:text> + </xsl:for-each> + </xsl:if> + </xsl:if> +--> + <xsl:text>}
</xsl:text> + <xsl:text>% \end{macrocode} +% \end{option}
</xsl:text> + </xsl:template> + + <xsl:template name="breakline"> + <xsl:param name="string"/> + <xsl:param name="max"> + <xsl:value-of select="$maxcodelen"/> + </xsl:param> + <xsl:choose> + <xsl:when test="string-length($string)>$max"> + <!-- see if there is a substring that will fit --> + <xsl:choose> + <!-- if there are no spaces, we're stuck, so use it as-is --> + <xsl:when test="not(contains($string,' '))"> + <xsl:value-of select="$string"/> + </xsl:when> + <!-- if the first substring will fit, output it and try again --> + <xsl:when + test="string-length(substring-before($string,' '))<=$max"> + <xsl:value-of select="$max"/> + <xsl:text>/</xsl:text> + <xsl:value-of select="string-length(substring-before($string,' '))"/> + <xsl:value-of select="substring-before($string,' ')"/> + <xsl:text> </xsl:text> + <!-- see how much we have left --> + <xsl:choose> + <xsl:when + test="($max - 1 - + string-length(substring-before($string,' '))) + < + string-length(substring-before( + substring-after($string,' '), ' '))"> + <xsl:text>
 </xsl:text> + <xsl:call-template name="breakline"> + <xsl:with-param name="string" + select="substring-after($string,' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="breakline"> + <xsl:with-param name="string" + select="substring-after($string,' ')"/> + <xsl:with-param name="max" + select="$max - 1 - + string-length(substring-before($string,' '))"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:remark"> + <xsl:text>% \iffalse +%% v</xsl:text> + <xsl:value-of select="@version"/> + <xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test="@revision"> + <xsl:value-of select="translate(@revision,'-','/')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="translate( + //db:revhistory/db:revision[@version=current()/@version] + /db:date/@conformance,'-','/')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>
% \fi
</xsl:text> + <xsl:text>% \changes{v</xsl:text> + <xsl:value-of select="@version"/> + <xsl:text>}{</xsl:text> + <xsl:choose> + <xsl:when test="@revision"> + <xsl:value-of select="translate(@revision,'-','/')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="translate( + //db:revhistory/db:revision[@version=current()/@version] + /db:date/@conformance,'-','/')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}
</xsl:text> + </xsl:template> + + <!-- programlisting is what produces nicely-typeset code --> + + <xsl:template match="db:programlisting"> + <!-- this references @remap, @xreflabel, @xml:id, @condition, + @xlink:href, @startinglinenumber, @continuation, @wordsize, + @language, @arch, @annotations, @role, xlink:show --> + <xsl:choose> + <!-- 1. SPECIAL USE IN GENERATING DTX MACROCODE: + this occurs only in the "code" section of a + classpack document where the code is unadorned --> + <xsl:when test="(parent::annotation[@xreflabel] + or ancestor::db:part[@xml:id='code']) + and not(@condition='ignore')"> + <xsl:text>% \begin{macrocode}
</xsl:text> + <!-- note any fragments required as external files + specified in the 'code' part get output as extractables + at the end of the dtx file, as separate tagging can't + be nested inside class or package tags --> + <xsl:call-template name="lrtrim"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + <xsl:text>
% \end{macrocode}
</xsl:text> + </xsl:when> + <!-- 2. INTERPRETABLE FORMATS IN DOCUMENTATION + (embedded markup) --> + <xsl:when test="db:token or db:xref"> + <xsl:text>% \iffalse +%<*ignore> +% \fi +% \begin{Verbatim}[frame=single,framesep=1em,fontsize=\small,commandchars=\\\{\}</xsl:text> + <xsl:if test="@xml:id and @role"> + <xsl:text>,label=</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>,title={</xsl:text> + <xsl:value-of select="normalize-space(@role)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>]
</xsl:text> + <xsl:apply-templates/> + <xsl:text>
% \end{Verbatim} +% \iffalse +%</ignore> +% \fi
</xsl:text> + </xsl:when> + <!-- 3. EXAMPLE USE IN CODE, + not for absorption into the package --> + <xsl:when test="@condition='ignore'"> + <!-- + <xsl:call-template name="makelisting"/> + --> + <xsl:text>% \iffalse +%<*ignore> +% \fi +% \begin{Verbatim}[frame=single,framesep=1em,fontsize=\small]
</xsl:text> + <xsl:value-of select="."/> + <xsl:text> +% \end{Verbatim} +% \iffalse +%</ignore> +% \fi
</xsl:text> + </xsl:when> + <!-- 4. OTHERWISE UNADORNED USE IN DOCUMENTATION, + but allows use of userinput --> + <xsl:otherwise> + <xsl:call-template name="makelisting"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- named template to handle listings called at various points --> + + <xsl:template name="makelisting"> + <!-- context is a programlisting element type --> + <xsl:choose> + <!-- read lines from external file --> + <xsl:when test="@xlink:href"> + <xsl:text>% \lstinputlisting[firstline=</xsl:text> + <xsl:choose> + <xsl:when test="@startinglinenumber"> + <xsl:value-of select="@startinglinenumber"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>1</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@endinglinenumber"> + <xsl:text>,lastline=</xsl:text> + <xsl:value-of select="@endinglinenumber"/> + </xsl:if> + <!-- rest of settings are picked up after the begin/end type --> + </xsl:when> + <!-- otherwise do a begin and end --> + <xsl:otherwise> + <xsl:text>% \iffalse +%<*ignore> +% \fi
</xsl:text> + <xsl:text>\begin{lstlisting}[</xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- now pick the parameters needed: + basicstyle=\footnotesize\color{Black}\ttfamily + and a lot else pre-set from prepost.xml configurations + but the wordsize attribute can be used to change + the font size (either a size and baseline separated + by a slash, eg 12/14) or the whole basicstyle + definition --> + <xsl:if test="@xlink:href"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:if test="@wordsize"> + <xsl:text>basicstyle=</xsl:text> + <xsl:choose> + <xsl:when test="contains(@wordsize,'/')"> + <xsl:text>\fontsize{</xsl:text> + <xsl:value-of select="substring-before(@wordsize,'/')"/> + <xsl:text>}{</xsl:text> + <xsl:value-of select="substring-after(@wordsize,'/')"/> + <xsl:text>}\selectfont</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@wordsize"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>\color{Black}\ttfamily,</xsl:text> + </xsl:if> + <!-- set the language --> + <xsl:text>language=</xsl:text> + <xsl:choose> + <xsl:when test="@language='LaTeX' or not(@language)"> + <xsl:text>{[LaTeX]TeX}</xsl:text> + </xsl:when> + <xsl:when test="@language='DocBook'"> + <xsl:text>{[DocBook]XML}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@language"/> + </xsl:otherwise> + </xsl:choose> + <!-- default is unframed --> + <xsl:if test="@arch='framed'"> + <xsl:text>,frame=single,framesep=1em</xsl:text> + </xsl:if> + <!-- remap for emphases and options --> + <xsl:if test="@remap"> + <xsl:text>,emphstyle=</xsl:text> + <xsl:value-of select="@remap"/> + </xsl:if> + <xsl:if test="@annotations or db:userinput"> + <xsl:text>,emph={</xsl:text> + <xsl:value-of select="@annotations"/> + <xsl:if test="db:userinput"> + <xsl:for-each select="db:userinput"> + <xsl:if + test="not(preceding-sibling::db:userinput[.=current()/.])"> + <xsl:if test="(position()=1 and ../@annotations) + or position()>1"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:value-of select="."/> + </xsl:if> + </xsl:for-each> + </xsl:if> + <xsl:text>}</xsl:text> + </xsl:if> + <!-- label --> + <xsl:if test="@xml:id"> + <xsl:text>,label=</xsl:text> + <xsl:value-of select="@xml:id"/> + </xsl:if> + <xsl:text>]</xsl:text> + <!-- end of settings --> + <xsl:choose> + <!-- for an included file, here's the filename --> + <xsl:when test="@xlink:href"> + <xsl:text>{</xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text>}</xsl:text> + </xsl:when> + <!-- otherwise we need the newline --> + <xsl:otherwise> + <xsl:text>
</xsl:text> + <!-- output the content --> + <xsl:call-template name="lrtrim"> + <xsl:with-param name="text" select="."/> + <xsl:with-param name="indent"> + <xsl:choose> + <xsl:when test="contains(.,'\end{lstlisting}') or + contains(.,'\end{verbatim}') or + contains(.,'\end{Verbatim}')"> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text></xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + <xsl:text>
\end{lstlisting}
</xsl:text> + <xsl:text>% \iffalse +%</ignore> +% \fi
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:userinput[not(parent::db:programlisting)]"> + <xsl:text>\emph{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template name="htrim"> + <xsl:param name="text"/> + <xsl:variable name="TEXT" select="translate($text,'	',' ')"/> + <xsl:choose> + <xsl:when test="contains($TEXT,' ')"> + <xsl:call-template name="htrim"> + <xsl:with-param name="text"> + <xsl:value-of select="substring-before($TEXT,' ')"/> + <xsl:text> </xsl:text> + <xsl:value-of select="substring-after($TEXT,' ')"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($TEXT,'
 ')"> + <xsl:call-template name="htrim"> + <xsl:with-param name="text"> + <xsl:value-of select="substring-before($TEXT,'
 ')"/> + <xsl:text>
</xsl:text> + <xsl:value-of select="substring-after($TEXT,'
 ')"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$TEXT"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="lrtrim"> + <xsl:param name="text"/> + <xsl:param name="indent"/> + <xsl:variable name="extent" select="string-length($text)"/> + <xsl:choose> + <!-- text in programlisting amost always begins with a newline, + the one that comes right after <programlisting>, so remove + it. This used to remove leading space and TAB characters, + but that's wrong. + substring($text,1,1)=' ' or or + substring($text,1,1)='	' + --> + <xsl:when test="substring($text,1,1)='
'"> + <xsl:call-template name="lrtrim"> + <xsl:with-param name="text" select="substring($text,2)"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:when> + <!-- then trim trailing white-space. This is right --> + <xsl:when test="substring($text,$extent)=' ' or + substring($text,$extent)='
' or + substring($text,$extent)='	'"> + <xsl:call-template name="lrtrim"> + <xsl:with-param name="text" + select="substring($text,1,($extent - 1))"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:when> + <!-- now we're clean, but we need to paste on any indent + passed by the calling routine, usually to avoid trouble + with documentation the references \end{lstlisting} or + \end{verbatim} within the text of the verbatim block --> + <xsl:when test="$indent!=''"> + <xsl:call-template name="addindent"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="addindent"> + <xsl:param name="text"/> + <xsl:param name="indent"/> + <xsl:value-of select="$indent"/> + <xsl:choose> + <xsl:when test="contains($text,'
')"> + <xsl:value-of select="substring-before($text,'
')"/> + <xsl:text>
</xsl:text> + <xsl:call-template name="addindent"> + <xsl:with-param name="text" select="substring-after($text,'
')"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- tables and figures --> + + <xsl:template match="db:table"> + <xsl:text>% \begin{table}</xsl:text> + <xsl:if test="@floatstyle"> + <xsl:text>[</xsl:text> + <xsl:value-of select="@floatstyle"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>\small\sffamily
</xsl:text> + <xsl:apply-templates/> + <xsl:if test="db:textobject[@role='footer']"> + <xsl:text>% \par\bigskip\footnotesize
</xsl:text> + <xsl:apply-templates select="db:textobject[@role='footer']/*"/> + </xsl:if> + <xsl:text>% \end{table}
</xsl:text> + </xsl:template> + + <xsl:template match="db:table/db:textobject[@role='footer']"/> + + <xsl:template match="db:table/db:title | db:figure/db:title"> + <xsl:text>% \caption{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + <xsl:if test="../@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="../@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>\medskip
</xsl:text> + </xsl:template> + + <xsl:template match="db:informaltable"> + <xsl:text>% \par\medskip{\sffamily\small</xsl:text> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% }
</xsl:text> + </xsl:template> + + <xsl:template match="db:tgroup"> + <xsl:text>% \begingroup</xsl:text> + <xsl:value-of select="parent::db:table/@remap"/> + <xsl:text>
% \centering
% \begin{tabular}{</xsl:text> + <xsl:choose> + <xsl:when test="@tgroupstyle='overhang'"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>@{}</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>%
% 	</xsl:text> + <xsl:for-each select="db:colspec"> + <xsl:call-template name="colprefix"/> + <xsl:call-template name="colsettings"/> + <xsl:call-template name="colsuffix"/> + <xsl:text>%
% 	</xsl:text> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@tgroupstyle='overhang'"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>@{}</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}
</xsl:text> + <xsl:apply-templates select="db:thead"/> + <xsl:if test="not(db:thead)"> + <xsl:text>% \hline
</xsl:text> + </xsl:if> + <xsl:apply-templates select="db:tbody"/> + <xsl:apply-templates select="db:tfoot"/> + <xsl:text>% \end{tabular}
</xsl:text> + <!-- fake footnotes --> + <xsl:if test="starts-with(db:tbody/@xlink:href,'affil') and + count(//db:part[@xml:id='data'] + //db:constraintdef[@xml:id= + concat(substring-before(current()/db:tbody/@xlink:href,'-'),'options')] + /db:methodsynopsis[tokenize(@arch,' ')= + substring-after(current()/db:tbody/@xlink:href,'-')] + [db:modifier])>0"> + <xsl:text>% \scriptsize +% \renewcommand{\labelenumi}{\itshape\alph{enumi}\upshape)} +% \begin{enumerate}[noitemsep]
</xsl:text> + <xsl:for-each + select="//db:part[@xml:id='data'] + //db:constraintdef[@xml:id= + concat(substring-before(current()/db:tbody/@xlink:href,'-'),'options')] + /db:methodsynopsis[tokenize(@arch,' ')= + substring-after(current()/db:tbody/@xlink:href,'-')] + /db:modifier"> + <xsl:text>% \item The \texttt{</xsl:text> + <xsl:value-of select="../@xml:id"/> + <xsl:text>} option </xsl:text> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> + </xsl:for-each> + <xsl:text>% \end{enumerate} +% \setcounter{fnote}{0}
</xsl:text> + </xsl:if> + <xsl:text>% \par\endgroup
</xsl:text> + </xsl:template> + + <xsl:template match="db:colspec"/> + + <xsl:template name="colprefix"> + <!-- @colwidth in <colspec> + @wordsize in <entry>, here and below --> + <xsl:if test="@condition or @colwidth or @wordsize"> + <xsl:text>>{</xsl:text> + <xsl:choose> + <xsl:when test="@align='left' and (@colwidth or @wordsize)"> + <xsl:text>\raggedright{}</xsl:text> + </xsl:when> + <xsl:when test="@align='right' and (@colwidth or @wordsize)"> + <xsl:text>\raggedleft{}</xsl:text> + </xsl:when> + <xsl:when test="@align='center'"> + <xsl:text>\centering{}</xsl:text> + </xsl:when> + <!-- default is justified anyway, and char is inapplicable --> + </xsl:choose> + <!-- condition is for typographic changes --> + <xsl:value-of select="@condition"/> + <xsl:text>\prestrut</xsl:text> + <xsl:if test="@align and (@colwidth or @wordsize or @condition)"> + <xsl:text>\arraybackslash</xsl:text> + </xsl:if> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template name="colsettings"> + <!-- this is the type of column (p|m|b) and width --> + <xsl:choose> + <xsl:when test="@colwidth or @wordsize"> + <xsl:choose> + <xsl:when test="@char='m' or @char='b'"> + <xsl:value-of select="@char"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>p</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>{</xsl:text> + <xsl:variable name="width" select="@colwidth | @wordsize"/> + <xsl:choose> + <xsl:when test="contains($width,'%')"> + <xsl:value-of + select="number(substring-before($width,'%')) div 100"/> + <xsl:text>\columnwidth</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$width"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@align='left' or @align='right' or @align='center'"> + <xsl:value-of select="substring(@align,1,1)"/> + </xsl:when> + <xsl:when test="@align='char'"> + <xsl:text>d</xsl:text> + </xsl:when> + <!-- justified is implied by @colwidth or @wordsize above --> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="colsuffix"> + <xsl:text><{</xsl:text> + <xsl:value-of select="normalize-space(@conformance)"/> + <xsl:text>\poststrut\arraybackslash}</xsl:text> + </xsl:template> + + <xsl:template match="db:thead"> + <xsl:apply-templates/> + <xsl:text>[2pt]\hline
</xsl:text> + </xsl:template> + + <xsl:template match="db:tbody"> + <xsl:text>% </xsl:text> + <xsl:if test="not(db:row[1]/db:entry[1]/@spanname)"> + <xsl:text>\vstrut</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:choose> + <!-- eg, xlink:href='deg-acsss' --> + <xsl:when test="@xlink:href and @xlink:show='embed'"> + <xsl:apply-templates + select="//db:part[@xml:id='data'] + //db:constraintdef[@xml:id= + concat(substring-before(current()/@xlink:href,'-'),'options')] + /db:methodsynopsis + [tokenize(@arch,' ')=substring-after(current()/@xlink:href,'-')]" mode="row"> + <xsl:sort select="@xml:id"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:methodsynopsis" mode="row"> + <!-- each of these produces one row of the table --> + <xsl:text>% </xsl:text> + <!-- signal a footnote if needed --> + <xsl:if test="db:modifier"> + <xsl:text>\fnote{}</xsl:text> + </xsl:if> + <!-- col 1: token for option --> + <xsl:value-of select="@xml:id"/> + <xsl:text>&%
</xsl:text> + <!-- col 2: division[s], may be multiple methodparam elements --> + <xsl:for-each select="db:methodparam/db:parameter"> + <xsl:text>%	</xsl:text> + <!-- @remap is a prefix except for institutes and centres --> + <xsl:if test="not(@remap='') and @role!='institute' and @role!='centre'"> + <xsl:value-of select="normalize-space(@remap)"/> + <xsl:text> </xsl:text> + </xsl:if> + <!-- the name --> + <xsl:apply-templates/> + <!-- @remap is a suffix for institutes and centres --> + <xsl:if test="not(@remap='') and (@role='institute' or @role='centre')"> + <xsl:text> </xsl:text> + <xsl:value-of select="normalize-space(@remap)"/> + </xsl:if> + <!-- any following divisions involved (only for affiliations) --> + <xsl:choose> + <xsl:when test="position()!=last()"> + <xsl:text>; </xsl:text> + </xsl:when> + <!-- dummy to terminate degree options cleanly --> + <xsl:when test="@role='degree'"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>&%
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <!-- citation format --> + <xsl:if test="not(db:methodparam/db:parameter/@role='degree')"> + <xsl:text>%	</xsl:text> + <xsl:value-of select="db:methodname"/> + </xsl:if> + <xsl:text>\\\hline[.1pt]%
</xsl:text> + </xsl:template> + + <xsl:template match="db:row"> + <xsl:text>% </xsl:text> + <xsl:if test="@role='header'"> + <xsl:if test="position()>1"> + <xsl:text>[2pt]\hline
% </xsl:text> + </xsl:if> + </xsl:if> + <xsl:apply-templates/> + <xsl:text>\\</xsl:text> + <!-- + <xsl:if test="position()=last()"> + <xsl:text>[2pt]</xsl:text> + </xsl:if> + --> + <xsl:if test="@role='header'"> + <xsl:text>[2pt]\hline\vstrut</xsl:text> + </xsl:if> + <xsl:if test="(ancestor::db:tbody or ancestor::db:tfoot) + and position()=last()"> + <xsl:text>[2pt]\hline</xsl:text> + </xsl:if> + <xsl:if test="not(ancestor::db:thead)"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:entry[ancestor::db:thead or ancestor::db:tfoot]"> + <xsl:if test="preceding-sibling::db:entry"> + <xsl:text>&</xsl:text> + </xsl:if> + <!-- always make headers paragraphic, which means \multicolumn{1}... + because we don't know how they need to be formatted --> + <xsl:text>\multicolumn{</xsl:text> + <xsl:choose> + <xsl:when test="@spanname"> + <xsl:value-of select="@spanname"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>1</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}{</xsl:text> + <!-- omit LH shoulder on first column --> + <xsl:if test="count(preceding-sibling::db:entry)=0"> + <xsl:text>@{}</xsl:text> + </xsl:if> + <xsl:choose> + <!-- if alignment or width is specified in the heading cell, + use local settings, honouring local prefix/suffix --> + <xsl:when test="@align or @colwidth"> + <xsl:call-template name="colprefix"/> + <xsl:call-template name="colsettings"/> + <xsl:call-template name="colsuffix"/> + </xsl:when> + <!-- otherwise use the column default, + but use local prefix/suffix by preference --> + <xsl:otherwise> + <!-- identify the column number --> + <xsl:variable name="colpos" + select="count(preceding-sibling::db:entry) + 1"/> + <!-- test for the prefix --> + <xsl:choose> + <xsl:when + test="ancestor::db:tgroup/db:colspec[position()=$colpos]/@condition + or + ancestor::db:tgroup/db:colspec[position()=$colpos]/@colwidth + or + ancestor::db:tgroup/db:colspec[position()=$colpos]/@wordsize"> + <xsl:for-each + select="ancestor::db:tgroup/db:colspec[position()=$colpos]"> + <xsl:call-template name="colprefix"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="colprefix"/> + </xsl:otherwise> + </xsl:choose> + <!-- switch context to the colspec to get the settings --> + <xsl:for-each + select="ancestor::db:tgroup/db:colspec[position()=$colpos]"> + <xsl:call-template name="colsettings"/> + </xsl:for-each> + <!-- test for the suffix --> + <xsl:choose> + <xsl:when + test="ancestor::db:tgroup/db:colspec[position()=$colpos]/@condition + or + ancestor::db:tgroup/db:colspec[position()=$colpos]/@colwidth + or + ancestor::db:tgroup/db:colspec[position()=$colpos]/@wordsize"> + <xsl:for-each + select="ancestor::db:tgroup/db:colspec[position()=$colpos]"> + <xsl:call-template name="colsuffix"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="colsuffix"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="count(following-sibling::db:entry)=0"> + <xsl:text>@{}</xsl:text> + </xsl:if> + <xsl:text>}{\sffamily\bfseries </xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:entry[ancestor::db:tbody]"> + <xsl:if test="preceding-sibling::db:entry"> + <xsl:text>&</xsl:text> + </xsl:if> + <xsl:if test="@spanname"> + <xsl:text>\multicolumn{</xsl:text> + <xsl:value-of select="@spanname"/> + <xsl:text>}{</xsl:text> + <xsl:if test="count(preceding-sibling::db:entry)=0"> + <xsl:text>@{}</xsl:text> + </xsl:if> + <xsl:choose> + <!-- if alignment or width is specified, + use local settings --> + <xsl:when test="@align or @wordsize"> + <xsl:call-template name="colprefix"/> + <xsl:call-template name="colsettings"/> + <xsl:call-template name="colsuffix"/> + </xsl:when> + <!-- otherwise use default, + but check local pre and post --> + <xsl:otherwise> + <xsl:call-template name="colprefix"/> + <xsl:variable name="colpos" + select="count(preceding-sibling::db:entry) + 1"/> + <xsl:for-each + select="ancestor::db:tbody/db:colspec[position()=$colpos]"> + <xsl:call-template name="colsettings"/> + </xsl:for-each> + <xsl:call-template name="colsuffix"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="count(following-sibling::db:entry)=0"> + <xsl:text>@{}</xsl:text> + </xsl:if> + <xsl:text>}{</xsl:text> + </xsl:if> + <!-- check for hangouts --> + <xsl:if test="@annotations"> + <xsl:text>\llap{\normalfont </xsl:text> + <xsl:value-of select="@annotations"/> + <xsl:text>}</xsl:text> + </xsl:if> + <!-- text for headers is in bold --> + <xsl:if test="../@role='header'"> + <xsl:text>\vstrut\bfseries </xsl:text> + </xsl:if> + <!-- check for row-spanned brace-collected --> + <xsl:if test="@morerows"> + <xsl:if test="@charoff and @char"> + <xsl:text>\llap{</xsl:text> + <xsl:value-of select="@char"/> + <xsl:value-of select="@morerows"/> + <xsl:text>{</xsl:text> + <xsl:value-of select="@charoff"/> + <xsl:text>}</xsl:text> + <xsl:text>}%
% 	</xsl:text> + </xsl:if> + <xsl:text>\multirow{</xsl:text> + <xsl:value-of select="@morerows"/> + <xsl:text>}{</xsl:text> + <xsl:value-of select="@wordsize"/> + <xsl:text>}{</xsl:text> + </xsl:if> + <!-- now we're in the content at last --> + <xsl:if test="@condition"> + <xsl:value-of select="@condition"/> + <xsl:text>{}</xsl:text> + </xsl:if> + <xsl:choose> + <!-- mldr … on its own (\dotfill) needs a \hbox --> + <xsl:when test=".='\dotfill{}' and @wordsize"> + <xsl:text>\hbox to </xsl:text> + <xsl:value-of select="@wordsize"/> + <xsl:text>{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@morerows"> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="@spanname"> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:figure"> + <xsl:if test="@floatstyle='p' and + descendant::db:imagedata[@format='pdf' and @condition]"> + <xsl:text>% \clearpage
</xsl:text> + </xsl:if> + <xsl:text>% \begin{figure}</xsl:text> + <xsl:if test="@floatstyle"> + <xsl:text>[</xsl:text> + <xsl:value-of select="@floatstyle"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>\small\sffamily\centering
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{figure}
</xsl:text> + <xsl:if test="@floatstyle='p' and + descendant::db:imagedata[@format='pdf' and @condition]"> + <xsl:text>% \clearpage
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:informalfigure"> + <xsl:text>% \begin{center}
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{center}
</xsl:text> + </xsl:template> + + <xsl:template match="db:figure/db:mediaobject | + db:informalfigure/db:mediaobject"> + <xsl:if test="@role='framed'"> + <xsl:text>% \fbox{\vbox{% +% \advance\hsize by-2\fboxsep\advance\hsize by-2\fboxrule
</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="@role='framed'"> + <xsl:text>% }}
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:imageobject"> + <xsl:choose> + <!-- detect a previous image --> + <xsl:when test="preceding-sibling::*[1][local-name()='imageobject']"> + <xsl:choose> + <xsl:when test="@dir='ltr'"> + <xsl:text>% \quad\vrule\quad
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>% \\
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text></xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:imagedata"> + <xsl:choose> + <xsl:when test="@align='center'"> + <xsl:text>% \centering
</xsl:text> + </xsl:when> + <xsl:when test="@align='right'"> + <xsl:text>% \flushright
</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:if test="@arch='framed'"> + <xsl:text>% \fbox{%
</xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="@fileref"> + <xsl:choose> + <xsl:when test="@format='pdf' and @condition"> + <xsl:text>% \includepdf</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>% \includegraphics</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>[</xsl:text> + <xsl:choose> + <xsl:when test="@condition"> + <xsl:value-of select="normalize-space(@condition)"/> + </xsl:when> + <xsl:when test="@width"> + <xsl:text>width=</xsl:text> + <xsl:choose> + <xsl:when test="contains(@width,'%')"> + <xsl:value-of + select="number(substring-before(@width,'%')) div 100"/> + <xsl:text>\columnwidth</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@width"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@depth"> + <xsl:text>height=</xsl:text> + <xsl:choose> + <xsl:when test="contains(@depth,'%')"> + <xsl:value-of + select="number(substring-before(@depth,'%')) div 100"/> + <xsl:text>\textheight</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@depth"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text>width=\columnwidth</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>]</xsl:text> + <xsl:text>{</xsl:text> + <xsl:value-of select="@fileref"/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:when test="@remap"> + <xsl:text>% </xsl:text> + <xsl:if test="@condition"> + <xsl:text>{</xsl:text> + <xsl:value-of select="normalize-space(@condition)"/> + </xsl:if> + <xsl:value-of select="@remap"/> + <xsl:if test="@condition"> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:text>IMAGE</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@arch='framed'"> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + </xsl:template> + + <!-- lists --> + + <xsl:template match="db:itemizedlist"> + <xsl:text>% \begin{itemize}</xsl:text> + <xsl:if test="@spacing='compact'"> + <xsl:text>[noitemsep]</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{itemize}
</xsl:text> + </xsl:template> + + <xsl:template match="db:orderedlist/db:title | + db:procedure/db:title | + db:simplelist[@arch='enumerate']/db:title"/> + + <xsl:template match="db:orderedlist | + db:procedure | + db:simplelist[@arch='enumerate']"> + <xsl:variable name="armour"> + <xsl:choose> + <xsl:when test="parent::db:para"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>%</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- check format for twocol wrapper --> + <xsl:if test="@role='twocol'"> + <xsl:value-of select="$armour"/> + <xsl:text> \begin{multicols}{2}
</xsl:text> + </xsl:if> + <xsl:if test="db:title"> + <xsl:value-of select="$armour"/> + <xsl:text> \noindent\textbf{</xsl:text> + <xsl:apply-templates select="db:title/node()"/> + <xsl:text>}
</xsl:text> + </xsl:if> + <xsl:if test="@xml:id"> + <xsl:value-of select="$armour"/> + <xsl:text> \label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}
</xsl:text> + </xsl:if> + <xsl:value-of select="$armour"/> + <xsl:text> \begin{enumerate</xsl:text> + <!-- check spacing --> + <xsl:if test="parent::db:para"> + <xsl:text>*</xsl:text> + </xsl:if> + <xsl:text>}</xsl:text> + <xsl:if test="parent::db:para + or + (@linkend and + preceding::db:orderedlist[@xml:id=current()/@linkend]) + or + @spacing='compact' or local-name()='simplelist' + or + @startingnumber"> + <xsl:text>[</xsl:text> + <!-- test inline --> + <xsl:if test="parent::db:para"> + <xsl:text>label=\emph{\alph*})</xsl:text> + </xsl:if> + <!-- test resumption --> + <xsl:if test="@linkend and + preceding::db:orderedlist[@xml:id=current()/@linkend]"> + <xsl:if test="parent::db:para"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:text>resume</xsl:text> + </xsl:if> + <!-- check spacing --> + <xsl:if test="@spacing='compact' or local-name()='simplelist'"> + <xsl:if test="parent::db:para or + (@linkend and + preceding::db:orderedlist[@xml:id=current()/@linkend])"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:text>noitemsep</xsl:text> + </xsl:if> + <!-- check numbering --> + <xsl:if test="@startingnumber"> + <xsl:if test="parent::db:para or + (@linkend and + preceding::db:orderedlist[@xml:id=current()/@linkend]) + or @spacing='compact' or local-name()='simplelist'"> + <xsl:text>,</xsl:text> + </xsl:if> + <xsl:text>start=</xsl:text> + <xsl:value-of select="@startingnumber"/> + </xsl:if> + <xsl:text>]</xsl:text> + </xsl:if> + <!-- do list --> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <!-- no withdrawal of armour needed for inline list termination + because the end of a lit item para will have created a newline --> + <xsl:text>% \end{enumerate</xsl:text> + <!-- check spacing --> + <xsl:if test="parent::db:para"> + <xsl:text>*</xsl:text> + </xsl:if> + <xsl:text>}</xsl:text> + <xsl:if test="not(parent::db:para)"> + <xsl:text>
</xsl:text> + </xsl:if> + <!-- check format --> + <xsl:if test="@role='twocol'"> + <xsl:text>% \end{multicols}
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:variablelist"> + <xsl:text>% \begin{description}[style=unboxed</xsl:text> + <xsl:if test="@spacing='compact'"> + <xsl:text>,noitemsep</xsl:text> + </xsl:if> + <xsl:text>]
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{description}
</xsl:text> + </xsl:template> + + <xsl:template match="db:simplelist[@role='twocol']"> + <xsl:text>% \begin{multicols}{2}</xsl:text> + <xsl:if test="@xreflabel"> + <xsl:text>[\paragraph*{</xsl:text> + <xsl:value-of select="normalize-space(@xreflabel)"/> + <xsl:text>}]</xsl:text> + </xsl:if> + <xsl:text>\begin{itemize}[noitemsep]
</xsl:text> + <xsl:apply-templates/> + <xsl:text>% \end{itemize} +% \end{multicols}
</xsl:text> + </xsl:template> + + <xsl:template match="db:type[@role='font']"> + <xsl:text>{</xsl:text> + <xsl:if test="@arch"> + <xsl:text>\fontencoding{</xsl:text> + <xsl:value-of select="upper-case(@arch)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="@remap"> + <!-- special cases --> + <xsl:choose> + <xsl:when test="@remap='sans'"> + <xsl:text>\sffamily</xsl:text> + </xsl:when> + <xsl:when test="@remap='serif'"> + <xsl:text>\rmfamily</xsl:text> + </xsl:when> + <xsl:when test="@remap='mono'"> + <xsl:text>\ttfamily</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\fontfamily{</xsl:text> + <xsl:value-of select="@remap"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@condition"> + <!-- special cases --> + <xsl:choose> + <xsl:when test="@condition='italic'"> + <xsl:text>\itshape</xsl:text> + </xsl:when> + <xsl:when test="@condition='smallcaps'"> + <xsl:text>\scshape</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\fontshape{</xsl:text> + <xsl:value-of select="@condition"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@annotations"> + <!-- special cases --> + <xsl:choose> + <xsl:when test="@annotations='bold'"> + <xsl:text>\bfseries</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\fontseries{</xsl:text> + <xsl:value-of select="@annotations"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:text>\selectfont </xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:property[@role]"> + <xsl:value-of select="@role"/> + <xsl:text>{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <!-- list items --> + + <xsl:template match="db:itemizedlist/db:listitem | + db:orderedlist/db:listitem | + db:procedure/db:step | + db:simplelist/db:member"> + <!-- add syntax to inline lists --> + <xsl:if test="ancestor::db:para and + not(following-sibling::db:listitem)"> + <xsl:choose> + <xsl:when test="parent::db:orderedlist or parent::db:procedure"> + <xsl:text>% and 
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>% or 
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:text>% \item</xsl:text> + <xsl:choose> + <!-- remap a bullet or number --> + <xsl:when test="@remap or parent::db:simplelist"> + <xsl:text>[</xsl:text> + <xsl:value-of select="@remap"/> + <xsl:text>]</xsl:text> + </xsl:when> + <!-- or prefix the number with a symbol (what was this for?!) --> + <xsl:when test="@role"> + <xsl:text>\leavevmode\llap{</xsl:text> + <xsl:value-of select="@role"/> + <xsl:text>\thinspace}</xsl:text> + </xsl:when> + <!-- normally just a space --> + <xsl:otherwise> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- label it if needed --> + <xsl:if test="@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <!-- syntactic punctuation now handled by db:para template + except for db:member, which needs terminating --> + <xsl:if test="local-name()='member'"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:term"> + <xsl:text>% \item[</xsl:text> + <xsl:apply-templates/> + <xsl:if test="not(db:command[@conformance or @condition])"> + <xsl:text>\thinspace:</xsl:text> + </xsl:if> + <xsl:text>]</xsl:text> + <xsl:if test="../@xml:id"> + <xsl:text>\label{</xsl:text> + <xsl:value-of select="../@xml:id"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <!-- inline --> + + <xsl:template match="db:token"> + <xsl:text>{\normalfont\itshape</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:package"> + <xsl:if test="@role and + not(ancestor::db:title) and + not(ancestor::db:abstract) and + not(ancestor::db:acknowledgements) and + not(ancestor::db:term) and + not(ancestor::db:footnote) and + not(ancestor::db:table) and + not(ancestor::db:informaltable) and + not(ancestor::db:figure) + and not(preceding-sibling::db:package[.=current()/.])"> + <xsl:text>\DescribePackage{</xsl:text> + <xsl:choose> + <xsl:when test=".=''"> + <xsl:value-of select="/*[1]/@xml:id"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:if> + <!-- in all cases, use sf --> + <xsl:text>\textsf{</xsl:text> + <xsl:choose> + <xsl:when test=".=''"> + <xsl:value-of select="/*[1]/@xml:id"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:modifier/db:alt"> + <xsl:text>\textsf{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:productname"> + <xsl:text>\emph{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + <xsl:if test="@userlevel"> + <xsl:text>\thinspace(</xsl:text> + <xsl:value-of select="@userlevel"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:citetitle"> + <xsl:text>\emph{</xsl:text> + <xsl:choose> + <xsl:when test="@linkend"> + <xsl:apply-templates + select="//*[@xml:id=current()/@linkend]/db:title/node()"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + <xsl:if test="//db:biblioentry[@xml:id=current()/@linkend]"> + <xsl:text> \cite{</xsl:text> + <xsl:value-of select="@linkend"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:emphasis"> + <xsl:text>\emph{</xsl:text> + <xsl:if test="@role='strong'"> + <xsl:text>\textbf{</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="@role='strong'"> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:tag"> + <!-- attribute attvalue element emptytag endtag genentity localname namespace numcharref paramentity pi prefix comment starttag xmlpi --> + <xsl:if test="@role and + not(ancestor::db:title) and + not(ancestor::db:term) and + not(ancestor::db:footnote) and + not(ancestor::db:table) and + not(ancestor::db:informaltable) and + not(ancestor::db:figure) + and not(preceding-sibling::db:tag[.=current()/.])"> + <xsl:text>\Describe</xsl:text> + <xsl:choose> + <xsl:when test="@class='element' or not(@class)"> + <xsl:text>Element</xsl:text> + </xsl:when> + <xsl:when test="@class='attribute'"> + <xsl:text>Attribute</xsl:text> + </xsl:when> + <xsl:when test="@class='attvalue'"> + <xsl:text>AttributeValue</xsl:text> + </xsl:when> + <xsl:when test="@class='genentity'"> + <xsl:text>Entity</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Error</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>\texttt{</xsl:text> + <xsl:choose> + <xsl:when test="@class='attvalue'"> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="@class='genentity'"> + <xsl:text>\&</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:value-of select="."/> + <xsl:choose> + <xsl:when test="@class='attvalue'"> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="@class='genentity'"> + <xsl:text>;</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text>}</xsl:text> + <xsl:if test="name(following-sibling::node()[1])='' and + starts-with(following-sibling::node()[1],'s')"> + <xsl:text>\thinspace{}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:function"> + <xsl:text>\DescribeFunction{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}\texttt{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:errortext"> + <xsl:text>\DescribeError{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}\textsf{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:type[@role='colour']"> + <xsl:text>\DescribeColour{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}\texttt{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:methodname"> + <xsl:text>\DescribeTemplate{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}\texttt{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:code"> + <xsl:text>\texttt{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:option"> + <xsl:if test="@role and + not(ancestor::db:title) and + not(ancestor::db:term) and + not(ancestor::db:footnote) and + not(ancestor::db:table) and + not(ancestor::db:informaltable) and + not(ancestor::db:figure) + and not(preceding-sibling::db:option[.=current()/.])"> + <xsl:text>\DescribeOption{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="@condition"> + <xsl:text>\oarg{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:when test="@conformance"> + <xsl:text>\marg{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:when> + <!-- otherwise it's for a package or command --> + <xsl:otherwise> + <xsl:text>\textbf{\texttt{</xsl:text> + <xsl:if test="@xml:lang='bash'"> + <xsl:text>-</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="@xml:lang='bash' and not(@conformance='nocolon')"> + <xsl:text>:</xsl:text> + </xsl:if> + <xsl:text>}}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:guiicon"> + <xsl:text>\includegraphics</xsl:text> + <xsl:if test="@annotations"> + <xsl:text>[</xsl:text> + <xsl:value-of select="@annotations"/> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text>}</xsl:text> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:personname"> + <xsl:apply-templates/> + <xsl:text>\index{</xsl:text> + <xsl:value-of select="normalize-space(db:surname)"/> + <xsl:text>!</xsl:text> + <xsl:value-of select="normalize-space(db:firstname)"/> + <xsl:if test="db:othername"> + <xsl:text> </xsl:text> + <xsl:value-of select="normalize-space(db:othername)"/> + </xsl:if> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:personname/db:firstname"> + <xsl:value-of select="."/> + </xsl:template> + + <xsl:template match="db:personname/db:othername"> + <xsl:if test="preceding-sibling::node()!=' '"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="."/> + <xsl:if test="string-length(normalize-space(.))=1 or + (.=upper-case(.) and substring(.,string-length(.))!='.')"> + <xsl:text>.</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:personname/db:surname"> + <xsl:if test="preceding-sibling::node()!=' '"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="."/> + </xsl:template> + + <xsl:variable name="nosc"> + <xsl:for-each select="$prepost//db:step[@conformance='nosc']"> + <xsl:value-of select="$thisdoc//db:constraintdef + [@xml:id='docpackages'] + //db:seg[.=current()/@remap]"/> + </xsl:for-each> + </xsl:variable> + + <xsl:template match="db:acronym"> + <xsl:choose> + <!-- defining instance --> + <xsl:when test="@xml:id"> + <xsl:apply-templates/> + <xsl:text>~(</xsl:text> + <xsl:call-template name="casestyle"> + <xsl:with-param name="text" select="@xml:id"/> + <xsl:with-param name="style" select="'\textsc{'"/> + </xsl:call-template> + <xsl:text>)\index{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>|see{</xsl:text> + <xsl:value-of select="translate(@xml:id, + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> + <xsl:text>}}\index{</xsl:text> + <xsl:value-of select="translate(@xml:id, + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> + <xsl:text>|textbf}</xsl:text> + </xsl:when> + <!-- no ID --> + <xsl:otherwise> + <!-- check for missing smallcaps in font --> + <xsl:choose> + <xsl:when test="$nosc=''"> + <xsl:call-template name="casestyle"> + <xsl:with-param name="text" select="normalize-space(.)"/> + <xsl:with-param name="style" select="'\textsc{'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="casestyle"> + <xsl:with-param name="text" select="normalize-space(.)"/> + <xsl:with-param name="style" select="'{\small '"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="//db:acronym[@xml:id=current()/.]"> + <xsl:if test="ancestor::db:footnote"> + <xsl:text>\protect</xsl:text> + </xsl:if> + <xsl:text>\index{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="casestyle"> + <xsl:param name="text"/> + <xsl:param name="style"/> + <xsl:value-of select="$style"/> + <xsl:choose> + <xsl:when test="contains($style,'\textsc')"> + <xsl:value-of select="translate($text, + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'abcdefghijklmnopqrstuvwxyz')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate($text, + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:superscript"> + <xsl:text>\textsuperscript{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:exceptionname"> + <xsl:text>\textsc{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <!-- tagging features for the doc and dox packages --> + + <xsl:template match="db:envar"> + <!-- role specifies the command does not belong to this package + and is only mentioned incidentally --> + <xsl:if test="@role and + not(ancestor::db:term) and + not(.=ancestor::db:annotation/@xreflabel) and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang)) + and not(preceding-sibling::db:envar[.=current()/.])"> + <xsl:text>\DescribeEnv{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>\texttt{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + <xsl:if test="@condition"> + <xsl:text>\oarg{</xsl:text> + <xsl:value-of select="normalize-space(@condition)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="@conformance"> + <xsl:text>\marg{</xsl:text> + <xsl:value-of select="normalize-space(@conformance)"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:classname"> + <xsl:if test="@role and + not(ancestor::db:footnote) and + not(ancestor::db:title) and + not(ancestor::db:term) and + not(.=ancestor::db:annotation/@xreflabel) and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang)) + and not(preceding-sibling::db:classname[.=current()/.])"> + <xsl:text>\DescribeClass{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:text>\textsf{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + <xsl:if test="@condition"> + <xsl:text>\oarg{</xsl:text> + <xsl:value-of select="normalize-space(@condition)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="@conformance"> + <xsl:text>\marg{</xsl:text> + <xsl:value-of select="normalize-space(@conformance)"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <!-- command occurring in documentation uses \DescribeMacro + or whatever class is given in @remap (eg counter, switch, + length, etc) --> + + <xsl:template match="db:command"> + <!-- role specifies the command does not belong to this package + and is only mentioned incidentally (a common value is 'kernel') + and therefore requires no indexing --> + <xsl:if test="@role and not(.='TeX') and not(.='LaTeX') and + not(ancestor::db:term) and + not(.=ancestor::db:annotation/@xreflabel) and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang)) + and not(preceding-sibling::db:command[.=current()/.])"> + <xsl:text>\DescribeMacro{\</xsl:text> + <xsl:choose> + <xsl:when + test="@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang) + and contains(.,'{')"> + <xsl:value-of select="substring-before(normalize-space(.),'{')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(.)"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:choose> + <!-- fake the backslash when in term (definition list) + or when being used as an example (not for indexing) --> + <xsl:when test="(@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang)) + and (not(@role) or parent::db:term)"> + <xsl:if test="parent::db:term and @userlevel!='optional'"> + <xsl:text>\llap{$\star$\enspace}</xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="parent::db:term"> + <xsl:text>\texttt{\textbackslash{}</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="avoidverb"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- otherwise use \verb for TeX commands only if needed --> + <xsl:when test="@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang)"> + <xsl:call-template name="avoidverb"/> + </xsl:when> + <!-- bash --> + <xsl:when test="@xml:lang='bash'"> + <xsl:call-template name="avoidverb"/> + </xsl:when> + <!-- other language commands have no backslash --> + <xsl:when test="@condition='nolit'"> + <xsl:call-template name="avoidverb"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="avoidverb"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@condition and @condition!='nolit'"> + <xsl:text>\oarg{</xsl:text> + <xsl:value-of select="normalize-space(@condition)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:if test="@conformance"> + <xsl:text>\marg{</xsl:text> + <xsl:value-of select="normalize-space(@conformance)"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template name="avoidverb"> + <!-- try to output monospace filenames, URIs, etc while + avoiding the use of \verb --> + <xsl:variable name="delim"> + <!-- delimiter to use if we really do have to use \verb + these are in order of preference --> + <xsl:choose> + <xsl:when test="not(contains(.,'|'))"> + <xsl:text>|</xsl:text> + </xsl:when> + <xsl:when test="not(contains(.,'+'))"> + <xsl:text>+</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>`</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <!-- if the contents contains any of TeX's special characters + that are invalid or unconfortable in URIs (incl vis.space) + \$^{}<|>␣ but not &_~#% + we have to use \verb, reluctantly --> + <xsl:when test="matches(.,'.*[\\\$\^{}<\|>␣].*') + and not(ancestor::db:title) + and not(ancestor::db:footnote) + and not(ancestor::db:term)"> + <xsl:choose> + <!-- replaceable adds a ` to end the \verb, and a new \verb` + after it has emitted its value --> + <xsl:when test="db:replaceable or @condition='nolit'"> + <xsl:text>\verb</xsl:text> + <xsl:value-of select="$delim"/> + <xsl:if + test="name()='command' and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang))"> + <xsl:text>\</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="@xlink:type"> + <xsl:text>.</xsl:text> + <xsl:value-of select="@xlink:type"/> + </xsl:if> + <xsl:value-of select="$delim"/> + </xsl:when> + <!-- otherwise this is a plain \verb --> + <xsl:otherwise> + <xsl:text>\verb</xsl:text> + <xsl:value-of select="$delim"/> + <xsl:if + test="name()='command' and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang))"> + <xsl:text>\</xsl:text> + </xsl:if> + <xsl:value-of select="normalize-space(.)"/> + <xsl:if test="@xlink:type"> + <xsl:text>.</xsl:text> + <xsl:value-of select="@xlink:type"/> + </xsl:if> + <xsl:value-of select="$delim"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- not ready for this yet --> + <xsl:when test="matches(.,'.*[\\\$\^{}<\|>].*') + and + (ancestor::db:title or + ancestor::db:footnote or + ancestor::db:term)"> + <xsl:message> + <xsl:text>Warning: verbatim in </xsl:text> + <xsl:value-of select="name(ancestor::*[3])"/> + <xsl:text>/</xsl:text> + <xsl:value-of select="name(ancestor::*[2])"/> + <xsl:text>/</xsl:text> + <xsl:value-of select="name(ancestor::*[1])"/> + <xsl:text> for "</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>"</xsl:text> + </xsl:message> + <xsl:text>\url{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}</xsl:text> + </xsl:when> + <!-- if it's in a , use \url + <xsl:when test="contains(normalize-space(.),' ') + and not(contains(.'{') or contains(.,'}'))"> + <xsl:text>\url{</xsl:text> + ??? + <xsl:text>}</xsl:text> + </xsl:when> +--> + <!-- otherwise we can get away with a monospace --> + <xsl:otherwise> + <xsl:choose> + <!-- if it contains the acceptable characters for URIs + &_~#% --> + <xsl:when test="matches(.,'.*[&_~#%].*') + and not(db:replaceable or @condition='nolit')"> + <xsl:text>\url{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}</xsl:text> + </xsl:when> + <!-- replaceable adds a ` to end the \verb, and a new \verb` + after it has emitted its value --> + <xsl:when test="db:replaceable or @condition='nolit'"> + <xsl:text>{\ttfamily{}</xsl:text> + <xsl:if + test="name()='command' and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang))"> + <xsl:text>\textbackslash{}</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:if test="@xlink:type"> + <xsl:text>.</xsl:text> + <xsl:value-of select="@xlink:type"/> + </xsl:if> + <xsl:text>}</xsl:text> + </xsl:when> + <!-- otherwise this is a plain --> + <xsl:otherwise> + <xsl:text>{\ttfamily{}</xsl:text> + <xsl:if + test="name()='command' and + (@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang))"> + <xsl:text>\textbackslash{}</xsl:text> + </xsl:if> + <xsl:value-of select="normalize-space(.)"/> + <xsl:if test="@xlink:type"> + <xsl:text>.</xsl:text> + <xsl:value-of select="@xlink:type"/> + </xsl:if> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:footnote"> + <xsl:text>\footnote{%
</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:uri"> + <xsl:choose> + <xsl:when test="@xlink:href and .!=''"> + <xsl:apply-templates/> + <xsl:text>\footnote{\url{</xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text>}}</xsl:text> + </xsl:when> + <xsl:when test="not(@xlink:href) and .!=''"> + <xsl:text>\url{</xsl:text> + <xsl:if test="@type"> + <xsl:value-of select="@type"/> + <xsl:text>:</xsl:text> + </xsl:if> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:if test="@xreflabel and @type='news'"> + <xsl:text> at \textlangle\verb`</xsl:text> + <xsl:value-of select="@xreflabel"/> + <xsl:text>`\textrangle{}</xsl:text> + </xsl:if> + <!--xsl:if test="following-sibling::node()[1][substring(.,1,1)=',']"> + <xsl:text>\thinspace </xsl:text> + </xsl:if--> + </xsl:template> + + <xsl:template match="db:link"> + <xsl:text>{\color{blue}\uline{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}}</xsl:text> + </xsl:template> + + <xsl:template match="db:filename | db:systemitem"> + <xsl:call-template name="avoidverb"/> + </xsl:template> + + <xsl:template match="db:firstterm"> + <xsl:text>\textbf{\emph{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}}\index{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>|textbf}</xsl:text> + </xsl:template> + + <xsl:template match="db:foreignphrase"> + <xsl:choose> + <xsl:when test="@xml:lang='jp'"> + <xsl:text>\cjktext{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:when test="@xml:lang='ga'"> + <!-- <xsl:text>\texteiad{</xsl:text>--> + <xsl:text>{</xsl:text> + <xsl:value-of select="@remap"/> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:when test="@xml:lang!=/db:book/@xml:lang"> + <xsl:text>\foreignlanguage{</xsl:text> + <xsl:value-of + select="tokenize($langs/language[@iso=current()/@xml:lang]/@babel, + ' ')[1]"/> + <xsl:text>}{</xsl:text> + <xsl:choose> + <xsl:when + test="$langs/language[@iso=current()/@xml:lang]/@wsys='la'"> + <xsl:text>\emph{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\emph{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:note[not(parent::db:para)]"> + <xsl:text>\begin{Sbox}\begin{minipage}{.9\columnwidth}\sffamily +</xsl:text> + <xsl:apply-templates/> + <xsl:text>\end{minipage}\end{Sbox}{\fboxsep1em\centering\fbox{\TheSbox}\par} +</xsl:text> + </xsl:template> + + <xsl:template match="db:note[parent::db:para]"> + <xsl:text>{\bfseries </xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:quote | db:phrase | db:wordasword"> + <xsl:text>`</xsl:text> + <xsl:apply-templates/> + <xsl:text>'</xsl:text> + <xsl:if test="@linkend"> + <xsl:text>
</xsl:text> + <xsl:call-template name="makeref"/> + </xsl:if> + </xsl:template> + + <xsl:template match="db:email"> + <xsl:text>\url{</xsl:text> + <xsl:value-of select="."/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:replaceable"> + <!-- make sure we use the same delimiter as the parent element does --> + <xsl:variable name="delim"> + <!-- in order of preference --> + <xsl:choose> + <xsl:when test="not(contains(.,'|'))"> + <xsl:text>|</xsl:text> + </xsl:when> + <xsl:when test="not(contains(.,'+'))"> + <xsl:text>+</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>`</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <!-- stop-start \verb when in a command or systemitem --> + <xsl:when test="parent::db:command + or parent::db:systemitem + or parent::db:filename"> + <xsl:value-of select="$delim"/> + <xsl:text>{\ttfamily\itshape </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}</xsl:text> + <xsl:text>\verb</xsl:text> + <xsl:value-of select="$delim"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>{\itshape </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Counters and Lengths --> + + <xsl:template match="db:varname[not(ancestor::db:footnote)] + | db:parameter[not(ancestor::db:footnote)]"> + <xsl:if test="@role + and not(preceding-sibling::db:varname[.=current()/.][@role=current()/@role])"> + <xsl:text>\Describe</xsl:text> + <xsl:value-of select="translate(substring(@role,1,1),'cl','CL')"/> + <xsl:value-of select="substring(@role,2)"/> + <xsl:text>{</xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text>}</xsl:text> + </xsl:if> + <xsl:call-template name="avoidverb"/> + </xsl:template> + + <xsl:template match="db:varname[ancestor::db:footnote] + | db:parameter[ancestor::db:footnote]"> + <xsl:call-template name="avoidverb"/> + </xsl:template> + + <!-- special use of endterm xref for ref to ref + + <xsl:template match="db:xref[@endterm]"> + <xsl:choose> + <xsl:when + test="//db:constraintdef[@linkend=current()/@endterm][@remap]"> + <xsl:text>\vref{</xsl:text> + <xsl:value-of + select="//db:constraintdef[@linkend=current()/@endterm]/@remap"/> + <xsl:text>}</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>[unknown reference to `\texttt{</xsl:text> + <xsl:value-of select="@endterm"/> + <xsl:text>}']</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +--> + + <xsl:template match="db:xref[@linkend]"> + <xsl:variable name="target" + select="//*[@xml:id=current()/@linkend]"/> + <!-- catch items in a labelled list before anything else, + and give them an ordinal number --> + <xsl:choose> + <!-- DESC LIST --> + <xsl:when test="name($target)='varlistentry'"> + <xsl:text>`\textbf{</xsl:text> + <xsl:apply-templates select="$target/db:term/node()"/> + <xsl:text>}', the </xsl:text> + <xsl:variable name="nth" + select="number(count($target/ + preceding-sibling::db:varlistentry)+1)"/> + <xsl:choose> + <xsl:when test="$nth=1"> + <xsl:text>first </xsl:text> + </xsl:when> + <xsl:when test="$nth=count($target/ + ancestor::db:variablelist[1]/db:varlistentry)"> + <xsl:text>last </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\ordinal</xsl:text> + <xsl:if test="$nth < 10"> + <xsl:text>string</xsl:text> + </xsl:if> + <xsl:text>num{</xsl:text> + <xsl:value-of select="$nth"/> + <xsl:text>} </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>item in the list </xsl:text> + <xsl:if test="not(@xrefstyle='page')"> + <xsl:text>in </xsl:text> + </xsl:if> + </xsl:when> + <!-- UNNUMBERED LIST ITEMS --> + <xsl:when test="name($target)='listitem' and + name($target/ancestor::*[1])='itemizedlist'"> + <xsl:text>the </xsl:text> + <xsl:variable name="nth" + select="number(count($target/ + preceding-sibling::db:listitem)+1)"/> + <xsl:choose> + <xsl:when test="$nth=1"> + <xsl:text>first </xsl:text> + </xsl:when> + <xsl:when test="$nth=count($target/ + ancestor::db:itemizedlist[1]/db:listitem)"> + <xsl:text>last </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\ordinal</xsl:text> + <xsl:if test="$nth < 10"> + <xsl:text>string</xsl:text> + </xsl:if> + <xsl:text>num{</xsl:text> + <xsl:value-of select="$nth"/> + <xsl:text>} </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>item in the list </xsl:text> + <xsl:if test="not(@xrefstyle='page')"> + <xsl:text>in </xsl:text> + </xsl:if> + </xsl:when> + <!-- ORDERED LIST ITEMS or PROCEDURE STEPS --> + <xsl:when test="(local-name($target)='listitem' and + local-name($target/parent::*[1])='orderedlist') or + (local-name($target)='step' and + local-name($target/parent::*[1])='procedure')"> + <xsl:choose> + <xsl:when test="ancestor::procedure"> + <xsl:text>step</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>item</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>~\ref{</xsl:text> + <xsl:value-of select="@linkend"/> + <xsl:text>}</xsl:text> + <xsl:choose> + <xsl:when test="generate-id(ancestor::db:procedure)= + generate-id($target/parent::db:procedure)"> + <xsl:choose> + <xsl:when + test="count(preceding::* | $target)=count(preceding::*)"> + <xsl:text> above</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> below</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text> in the list on p.\thinspace\pageref{</xsl:text> + <xsl:value-of select="@linkend"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- TITLED ORDERED LISTS --> + <xsl:when test="local-name($target)='orderedlist' and $target/db:title"> + <xsl:text>the list `</xsl:text> + <xsl:apply-templates select="$target/db:title/node()"/> + <xsl:text>' in </xsl:text> + </xsl:when> + <!-- INFORMAL TABLES --> + <xsl:when test="local-name($target)='informaltable'"> + <xsl:text>the table </xsl:text> + </xsl:when> + <!-- PROGRAMLISTING with condition="ignore" in package code --> + <xsl:when test="local-name($target)='programlisting'"> + <xsl:text>the code example </xsl:text> + </xsl:when> + </xsl:choose> + <!-- AUTOMATED --> + <xsl:choose> + <xsl:when test="@xrefstyle='page' + or local-name($target)='informaltable' + or local-name($target)='programlisting'"> + <xsl:text>\vpageref</xsl:text> + </xsl:when> + <!-- omit numbered list items done manually above --> + <xsl:when test="(local-name($target)='listitem' and + local-name($target/ancestor::*[1])='orderedlist') + or + (ancestor::db:procedure and + generate-id(ancestor::db:procedure)= + generate-id($target/parent::db:procedure))"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\vref</xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- now the argument[s]: not wanted for list items done manually --> + <xsl:if test="not(local-name($target)='listitem' and + local-name($target/ancestor::*[1])='orderedlist') + and + not(ancestor::db:procedure and $target/parent::db:procedure)"> + <xsl:if test="@endterm"> + <xsl:text>range</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:value-of select="@linkend"/> + <xsl:text>}</xsl:text> + <xsl:if test="@endterm"> + <xsl:text>{</xsl:text> + <xsl:value-of select="@endterm"/> + <xsl:text>}</xsl:text> + </xsl:if> + </xsl:if> + <xsl:if test="@xreflabel"> + <xsl:text> (</xsl:text> + <xsl:apply-templates + select="$target/child::*[local-name()=current()/@xreflabel][1]/node()"/> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:template> + + <!-- gui menu stuff --> + + <xsl:template match="db:guimenu"> + <xsl:text>\textsf{\bfseries </xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:guisubmenu"> + <xsl:if test="starts-with(local-name(preceding-sibling::*[1]),'gui')"> + <xsl:text>\menusep</xsl:text> + </xsl:if> + <xsl:text>\textsf{</xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:guimenuitem"> + <xsl:if test="starts-with(local-name(preceding-sibling::*[1]),'gui')"> + <xsl:text>\menusep</xsl:text> + </xsl:if> + <xsl:text>\textsf{\itshape </xsl:text> + <xsl:apply-templates/> + <xsl:text>}</xsl:text> + </xsl:template> + + <xsl:template match="db:guilabel"> + <xsl:text>{\fboxsep2pt\fbox{\sffamily </xsl:text> + <xsl:apply-templates/> + <xsl:text>}}</xsl:text> + </xsl:template> + + <xsl:template match="db:guibutton"> + <xsl:text>{\fboxsep2pt\ovalbox{\sffamily </xsl:text> + <xsl:apply-templates/> + <xsl:text>}}</xsl:text> + </xsl:template> + + <!-- odds 'n' sods --> + + <xsl:template match="processing-instruction('LaTeX')"> + <xsl:value-of select="."/> + </xsl:template> + + <xsl:template match="db:varlistentry | + db:varlistentry/db:listitem | + db:authorgroup"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="*"> + <xsl:message> + <xsl:text>default: </xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:text> ("</xsl:text> + <xsl:value-of select="."/> + <xsl:text>")</xsl:text> + </xsl:message> + <xsl:apply-templates/> + </xsl:template> + + <!-- bib --> + + <xsl:template match="db:biblioref"> + <xsl:call-template name="makeref"/> + </xsl:template> + + <xsl:template name="makeref"> + <xsl:variable name="target" + select="//db:bibliography/db:biblioentry[@xml:id=current()/@linkend]"/> + <xsl:choose> + <!-- title only --> + <xsl:when test="@xrefstyle='title'"> + <xsl:choose> + <xsl:when test="$target/@xreflabel='article' or + $target/@xreflabel='inbook' or + $target/@xreflabel='incollection'"> + <xsl:text>`</xsl:text> + <xsl:apply-templates + select="($target/descendant::db:title)[1]/node()"/> + <xsl:text>'</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\emph{</xsl:text> + <xsl:apply-templates + select="($target/descendant::db:title)[1]/node()"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- author only --> + <xsl:when test="@xrefstyle='author'"> + <xsl:for-each select="$target//db:author[1]/db:personname"> + <xsl:value-of select="db:firstname"/> + <xsl:if test="db:othername"> + <xsl:text>
</xsl:text> + <xsl:value-of select="db:othername"/> + </xsl:if> + <xsl:text> </xsl:text> + <xsl:value-of select="db:surname"/> + </xsl:for-each> + </xsl:when> + <!-- author only --> + <xsl:when test="@xrefstyle='shortauthor'"> + <xsl:for-each select="$target//db:author[1]/db:personname"> + <xsl:value-of select="db:surname"/> + </xsl:for-each> + </xsl:when> + <!-- all the rest --> + <xsl:otherwise> + <xsl:text>\cite</xsl:text> + <xsl:if test="(@units and @begin) or @annotations"> + <xsl:text>[</xsl:text> + <xsl:value-of select="@units"/> + <xsl:if test="@units='p' and @end"> + <xsl:text>p</xsl:text> + </xsl:if> + <xsl:text>.\thinspace </xsl:text> + <xsl:value-of select="@begin"/> + <xsl:if test="@end"> + <xsl:text>--</xsl:text> + <xsl:value-of select="@end"/> + </xsl:if> + <xsl:if test="@annotations"> + <xsl:if test="@units and @begin"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:value-of select="normalize-space(@annotations)"/> + </xsl:if> + <xsl:text>]</xsl:text> + </xsl:if> + <xsl:text>{</xsl:text> + <xsl:value-of select="@linkend"/> + <xsl:text>}</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- utilities --> + + <xsl:template name="copyright-statement"> + <xsl:param name="ftype"/> + <xsl:text>% Extracted from </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.xml</xsl:text> + <xsl:text> +% </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$ftype"/> + <xsl:text> is copyright © </xsl:text> + <xsl:variable name="copyright-first"> + <xsl:for-each select="//db:info/db:revhistory/db:revision"> + <xsl:sort select="@version" order="descending"/> + <xsl:if test="position()=last()"> + <xsl:value-of + select="substring(db:date/@conformance,1,4)"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="$copyright-first"/> + <xsl:variable name="copyright-latest"> + <xsl:for-each select="//db:info/db:revhistory/db:revision"> + <xsl:sort select="@version" order="ascending"/> + <xsl:if test="position()=last()"> + <xsl:value-of + select="substring(db:date/@conformance,1,4)"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:if test="$copyright-latest > $copyright-first"> + <xsl:text>-</xsl:text> + <xsl:value-of select="$copyright-latest"/> + </xsl:if> + <xsl:text> by </xsl:text> + <!-- RIGHTS --> + <xsl:choose> + <xsl:when test="/db:book/@audience='lppl'"> + <xsl:value-of + select="normalize-space(//db:info//db:author[1]/ + db:personname/db:firstname)"/> + <xsl:text> </xsl:text> + <xsl:value-of + select="normalize-space(//db:info//db:author[1]/ + db:personname/db:surname)"/> + <xsl:text> <</xsl:text> + <xsl:value-of select="//db:info//db:author[1]/db:email"/> + <xsl:text>>
</xsl:text> + <xsl:text>% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% 
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="normalize-space(//db:info/db:copyright/db:holder)"/> + <xsl:text> <</xsl:text> + <xsl:value-of + select="substring-after(//db:info/db:copyright/db:holder + /@xlink:href,'mailto:')"/> + <xsl:text>>
</xsl:text> + <xsl:text>% +% This work may not be copied or re-used without the express +% written permission of the copyright holder[s]. Access to this +% work is restricted to the copyright holder[s] and their +% authorised employees, contractors, or agents. +% 
</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>% The current maintainer of this work is </xsl:text> + <xsl:choose> + <xsl:when test="//db:info//db:author[@role='maintainer']"> + <xsl:for-each select="//db:info//db:author[@role='maintainer']"> + <xsl:value-of + select="normalize-space(db:personname/db:firstname)"/> + <xsl:text> </xsl:text> + <xsl:value-of + select="normalize-space(db:personname/db:surname)"/> + <xsl:text> <</xsl:text> + <xsl:value-of select="db:email"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="normalize-space(//db:info//db:author/db:personname/db:firstname)"/> + <xsl:text> </xsl:text> + <xsl:value-of + select="normalize-space(//db:info//db:author/db:personname/db:surname)"/> + <xsl:text> <</xsl:text> + <xsl:value-of select="//db:info//db:author/db:email"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>>
</xsl:text> + <xsl:text>% +% This work consists of the files </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx and </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.ins, +% the derived file </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$filetype"/> + <xsl:text>, and any ancillary files listed +% in the MANIFEST.
</xsl:text> + </xsl:template> + + <xsl:template name="repeatarg"> + <xsl:param name="limit"/> + <xsl:param name="count"> + <xsl:text>0</xsl:text> + </xsl:param> + <xsl:param name="prefix"/> + <xsl:param name="suffix"/> + <xsl:if test="$count<$limit"> + <xsl:value-of select="$prefix"/> + <xsl:text>#</xsl:text> + <xsl:value-of select="$count + 1"/> + <xsl:value-of select="$suffix"/> + <xsl:call-template name="repeatarg"> + <xsl:with-param name="limit" select="$limit"/> + <xsl:with-param name="count" select="$count + 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- special mode for outputting the .ins file --> + + <xsl:template match="db:info" mode="ins"> + <xsl:variable name="file"> + <xsl:value-of select="$name"/> + <xsl:text>.ins</xsl:text> + </xsl:variable> + <xsl:result-document format="textFormat" href="{$file}"> + <xsl:text>%</xsl:text> + <xsl:call-template name="copyright-statement"> + <xsl:with-param name="ftype"> + <xsl:text>ins</xsl:text> + </xsl:with-param> + </xsl:call-template> + <xsl:text>% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>} +\preamble
</xsl:text> + <xsl:call-template name="htrim"> + <xsl:with-param name="text"> + <xsl:call-template name="lrtrim"> + <xsl:with-param name="text" select="db:annotation/*"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + <xsl:text>
\endpreamble
</xsl:text> + <!-- this bit just doesn't seem to work right + <xsl:for-each select="/db:book/db:part[@xml:id='files'] + /db:chapter[db:programlisting]"> + <xsl:variable name="ext" + select="substring-after(db:programlisting/@xlink:href,'.')"/> + <xsl:text>\declarepreamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text> +\DoubleperCent\space This is file </xsl:text> + <xsl:value-of select="db:programlisting/@xlink:href"/> + <xsl:text>
\endpreamble
</xsl:text> + <xsl:text>\declarepostamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text> +\DoubleperCent\space End of file </xsl:text> + <xsl:value-of select="db:programlisting/@xlink:href"/> + <xsl:text>
\endpreamble
</xsl:text> + </xsl:for-each> + --> + <xsl:text>\generate{</xsl:text> + <!-- generate the main file first --> + <xsl:text>\file{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$filetype"/> + <xsl:text>}{\from{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx}{</xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text>}}%
</xsl:text> + <!-- add any fragments from the documentation + these are those with an ID, a href, *and* show='new' --> + <xsl:for-each + select="//db:programlisting + [@xml:id and @xlink:show='new' and @xlink:href]"> + <xsl:variable name="ext" select="substring-after(@xlink:href,'.')"/> + <xsl:choose> + <xsl:when test="$ext='tex'"> + <xsl:text> \usepreamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>preamble\usepostamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>postamble</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> \usepreamble\empty\usepostamble\empty</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>
 \file{</xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text>}{\from{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx}{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}}%
</xsl:text> + </xsl:for-each> + <!-- add any documented ancillary files from appendixes + in the code part --> + <xsl:for-each select="/db:book/db:part[@xml:id='code'] + /db:appendix[@xml:id and @xlink:href]"> + <xsl:variable name="ext" select="substring-after(@xlink:href,'.')"/> + <xsl:choose> + <xsl:when test="$ext='tex'"> + <xsl:text> \usepreamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>preamble\usepostamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>postamble</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text></xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text> \file{</xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text>}{\from{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx}{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}}%
</xsl:text> + </xsl:for-each> + <!-- add any undocumented ancillary files --> + <xsl:for-each select="/db:book/db:part[@xml:id='files'] + /db:chapter[db:programlisting]"> + <xsl:variable name="ext" + select="substring-after(db:programlisting/@xlink:href,'.')"/> + <xsl:choose> + <xsl:when test="$ext='tex'"> + <xsl:text> \usepreamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>preamble\usepostamble\</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>postamble</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> \usepreamble\empty\usepostamble\empty</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>
 \file{</xsl:text> + <xsl:value-of select="db:programlisting/@xlink:href"/> + <xsl:text>}{\from{</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx}{</xsl:text> + <xsl:value-of select="@xml:id"/> + <xsl:text>}}%
</xsl:text> + </xsl:for-each> + <xsl:text>} +\obeyspaces +\Msg{********************************************************} +\Msg{** **} +\Msg{** Read the documentation before using this </xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:if test="$doctype='class'"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:text>. **} +\Msg{** **} +\Msg{********************************************************} +\endbatchfile +</xsl:text> + </xsl:result-document> + </xsl:template> + + <xsl:template match="text()"> + <xsl:choose> + <!-- SPECIAL HANDLING FOR SHELL SCRIPTS --> + <xsl:when test="ancestor::db:programlisting[@language='bash']"> + <xsl:choose> + <!-- remove leading newlines from initial strings --> + <xsl:when test="count(preceding-sibling::text())=0 + and starts-with(.,'
')"> + <xsl:value-of select="substring(.,2)"/> + </xsl:when> + <!-- remove trailing space from terminals --> + <xsl:when test="count(following-sibling::text())=0 + and matches(.,'\n[\s]*$')"> + <xsl:value-of select="replace(.,'\n[\s]*$','')"/> + </xsl:when> + <!-- otherwise don't prefix or suffix --> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- SIMILAR FOR TEXT OF INLINE COMMANDS (and bibliography entries + being handled by db2bibtex.xsl): normalise spaces + but preserve one leading and one trailing space if given --> + <xsl:when test="ancestor::db:command or ancestor::db:biblioentry"> + <!-- replace a single leading WS token with a space --> + <xsl:if test="starts-with(.,' ') or + starts-with(.,'	') or + starts-with(.,'
')"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="normalize-space(.)"/> + <!-- replace a single trailing WS token with a space --> + <xsl:if test="substring(.,string-length(.))=' ' or + substring(.,string-length(.))='	' or + substring(.,string-length(.))='
'"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:when> + <!-- otherwise check for percent prefixes --> + <xsl:otherwise> + <xsl:call-template name="dtxtext"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="dtxtext"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="normalize-space(.)=''"> + <xsl:text></xsl:text> + </xsl:when> + <!-- if the span starts with a TAB, remove it, + and keep doing so until no more TABs --> + <xsl:when test="starts-with($text,'	')"> + <xsl:call-template name="dtxtext"> + <xsl:with-param name="text" + select="substring($text,2)"/> + </xsl:call-template> + </xsl:when> + <!-- if it starts with a newline AND it's in a <programlisting> + element AND this is the first span of its type, prefix + a percent --> + <xsl:when test="starts-with($text,'
') and + parent::db:programlisting and + count(preceding-sibling::text())=0"> + <xsl:text>% </xsl:text> + <xsl:call-template name="dtxtext"> + <xsl:with-param name="text" + select="substring($text,2)"/> + </xsl:call-template> + </xsl:when> + <!-- break strings containing newlines --> + <xsl:when test="contains($text,'
')"> + <xsl:value-of select="substring-before($text,'
')"/> + <xsl:choose> + <xsl:when + test="normalize-space(substring-after($text,'
'))='' and + parent::db:programlisting and + count(following-sibling::text())=0"> + <xsl:text></xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>
% </xsl:text> + <xsl:call-template name="dtxtext"> + <xsl:with-param name="text" + select="substring-after($text,'
')"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- convert underscores in filenames --> + <xsl:when test="ancestor::db:filename[db:replaceable] and + contains($text,'_')"> + <xsl:value-of select="substring-before($text,'_')"/> + <xsl:text>\_</xsl:text> + <xsl:call-template name="dtxtext"> + <xsl:with-param name="text" + select="substring-after($text,'_')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="build"> + <xsl:result-document format="textFormat" href="build"> + <xsl:text>#! /bin/bash +# +# Bourne shell script to build the </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text> </xsl:text> + <xsl:value-of select="$doctype"/> + <xsl:text> file and documentation +# +java -jar </xsl:text> + <xsl:value-of select="$processor"/> + <xsl:text> -o:</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.xml </xsl:text> + <xsl:value-of select="$cpdir"/> + <xsl:text>/db2dtx.xsl processor=</xsl:text> + <xsl:value-of select="$processor"/> + <xsl:text> cpdir=</xsl:text> + <xsl:value-of select="$cpdir"/> + <xsl:text> appdir=</xsl:text> + <xsl:value-of select="$appdir"/> + <xsl:text> +yes|pdflatex </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.ins +pdflatex </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx
</xsl:text> + <xsl:if test="//db:part[descendant::db:bibliography + and descendant::db:biblioref]"> + <xsl:text>bibtex </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>
awk -f </xsl:text> + <xsl:value-of select="$cpdir"/> + <xsl:text>/decommentbbl.awk </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.bbl ></xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.bdc
mv </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.bdc </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.bbl
pdflatex </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx
</xsl:text> + </xsl:if> + <xsl:text>makeindex -s gind.ist -o </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.ind </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.idx +makeindex -s gglo.ist -o </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.gls </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.glo +pdflatex </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx
</xsl:text> + <!-- additional processing steps --> + <xsl:for-each select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id='builder'] + /db:segmentedlist/db:seglistitem/db:seg"> + <!-- 1. Content is the command including any fixed parameters + which immediately follow it, but not usually arguments --> + <xsl:value-of select="normalize-space(.)"/> + <!-- 1a. alternative way for a -f argument --> + <xsl:if test="@xlink:show='replace'"> + <xsl:text> -f</xsl:text> + </xsl:if> + <!-- 1b. output spec with a -o option --> + <xsl:if test="@role"> + <xsl:text> -o </xsl:text> + <xsl:choose> + <xsl:when test="@audience"> + <xsl:value-of select="@audience"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>.</xsl:text> + <xsl:value-of select="@role"/> + </xsl:if> + <!-- 2. space between command and args --> + <xsl:text> </xsl:text> + <!-- 3. input default file is the name of the current document --> + <xsl:choose> + <xsl:when test="@audience"> + <xsl:value-of select="@audience"/> + </xsl:when> + <xsl:when test="@xlink:actuate!='none'"> + <xsl:value-of select="$name"/> + </xsl:when> + <xsl:otherwise> + <xsl:text></xsl:text> + </xsl:otherwise> + </xsl:choose> + <!-- filetype of the input file --> + <xsl:choose> + <!-- either with xlink:type --> + <xsl:when test="@xlink:type"> + <xsl:text>.</xsl:text> + <xsl:value-of select="@xlink:type"/> + </xsl:when> + <!-- default for the first one is the current (dtx) --> + <xsl:when test="position()=1"> + <xsl:text>.dtx</xsl:text> + </xsl:when> + <!-- otherwise it's the @role of the preceding command --> + <xsl:when test="parent::db:seglistitem + /preceding-sibling::db:seglistitem[1] + /db:seg[@role]"> + <xsl:text>.</xsl:text> + <xsl:value-of + select="parent::db:seglistitem + /preceding-sibling::db:seglistitem[1] + /db:seg/@role"/> + </xsl:when> + <!-- otherwise nothing --> + </xsl:choose> + <!-- 4. Output: optionally a redirect --> + <xsl:if test="@xlink:arcrole"> + <xsl:text> ></xsl:text> + <xsl:value-of select="@xlink:arcrole"/> + </xsl:if> + <!-- 5. newline at end --> + <xsl:text>
</xsl:text> + </xsl:for-each> + <xsl:text>echo Copying files into dev tree...
</xsl:text> + <!-- copy all the files into the dev tree for zipping + doc/latex/name/MANIFEST|README|.pdf + source/latex/name/.dtx|.ins + tex/latex/name/.cls|.sty + --> + <xsl:text>mkdir -p doc/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <xsl:text>mkdir -p source/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <xsl:text>mkdir -p tex/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <!-- first the documentation --> + <xsl:text>cp README MANIFEST </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.pdf </xsl:text> + <xsl:text>doc/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <!-- then the source code --> + <xsl:text>cp </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.dtx </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.ins </xsl:text> + <xsl:text>source/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <!-- then this class or package --> + <xsl:text>cp </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$filetype"/> + <xsl:text> </xsl:text> + <xsl:text>tex/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <!-- add any ancillary files extracted from the .dtx file --> + <xsl:for-each select="/db:book/db:part[@xml:id='code'] + /db:appendix[@xml:id and @xlink:href] + | + /db:book/db:part[@xml:id='files'] + /db:chapter/db:programlisting"> + <xsl:text>cp </xsl:text> + <xsl:value-of select="@xlink:href"/> + <xsl:text> </xsl:text> + <xsl:text>tex/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + </xsl:for-each> + <!-- add any extra files listed in the .xml file --> + <xsl:for-each select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id='manifest'] + /db:simplelist/db:member[.!='']"> + <xsl:text>cp </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + <xsl:text> </xsl:text> + <xsl:text>source/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + </xsl:for-each> + <!-- ZIP 'EM UP from the dev directory --> + <xsl:text>echo Zipping up files from dev tree...
</xsl:text> + <xsl:text>zip -r --exclude=*.svn* --exclude=*.DS_Store* </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>.tds.zip doc/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text> source/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text> tex/latex/</xsl:text> + <xsl:value-of select="/db:book/@xml:base"/> + <xsl:text>
</xsl:text> + <xsl:text>echo Zipping up plain CTAN version...
</xsl:text> + <xsl:text>zip </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>.zip README MANIFEST </xsl:text> + <xsl:value-of select="/db:book/@xml:id"/> + <xsl:text>.dtx </xsl:text> + <xsl:value-of select="/db:book/@xml:id"/> + <xsl:text>.ins </xsl:text> + <xsl:value-of select="/db:book/@xml:id"/> + <xsl:text>.pdf </xsl:text> + <xsl:value-of select="/db:book/@xml:id"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="$filetype"/> + <xsl:for-each select="/db:book/db:info/db:cover + /db:constraintdef[@xml:id='manifest'] + /db:simplelist/db:member[.!='']"> + <xsl:text> </xsl:text> + <xsl:value-of select="normalize-space(.)"/> + </xsl:for-each> + <xsl:text> </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>.tds.zip
</xsl:text> + <!-- INSTALL the package or class file into the live tree --> + <xsl:text>echo Installing working copy...
</xsl:text> + <xsl:text>unzip -o -d </xsl:text> + <xsl:value-of select="$personaltree"/> + <xsl:text> </xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="/db:book/@version"/> + <xsl:text>.</xsl:text> + <xsl:value-of select="/db:book/@revision"/> + <xsl:text>.tds.zip
</xsl:text> + </xsl:result-document> + </xsl:template> + + <xsl:template match="db:part/db:title | + db:chapter/db:title | + db:chapter/db:para" mode="files"/> + + <xsl:template match="db:chapter" mode="files"> + <xsl:apply-templates mode="files"/> + </xsl:template> + + <xsl:template match="db:programlisting" mode="files"> + <xsl:choose> + <xsl:when test="ancestor::db:part[@xml:id='files']"> + <xsl:text>% \iffalse
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>% \begin{macrocode}
</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>%<*</xsl:text> + <xsl:value-of select="parent::db:chapter/@xml:id"/> + <xsl:text>></xsl:text> + <xsl:value-of select="."/> + <xsl:text>
%</</xsl:text> + <xsl:value-of select="parent::db:chapter/@xml:id"/> + <xsl:text>>
</xsl:text> + <xsl:choose> + <xsl:when test="ancestor::db:part[@xml:id='files']"> + <xsl:text>% \fi
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>% \end{macrocode}
</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="delogify"> + <xsl:param name="string"/> + <xsl:choose> + <xsl:when test="contains($string,'\LaTeXe{}')"> + <xsl:call-template name="delogify"> + <xsl:with-param name="string"> + <xsl:value-of select="substring-before($string,'\LaTeXe{}')"/> + <xsl:text>LaTeX2e</xsl:text> + <xsl:value-of select="substring-after($string,'\LaTeXe{}')"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($string,'\LaTeX{}')"> + <xsl:call-template name="delogify"> + <xsl:with-param name="string"> + <xsl:value-of select="substring-before($string,'\LaTeX{}')"/> + <xsl:text>LaTeX</xsl:text> + <xsl:value-of select="substring-after($string,'\LaTeX{}')"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($string,'\TeX{}')"> + <xsl:call-template name="delogify"> + <xsl:with-param name="string"> + <xsl:value-of select="substring-before($string,'\TeX{}')"/> + <xsl:text>TeX</xsl:text> + <xsl:value-of select="substring-after($string,'\TeX{}')"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> + +<!-- + Checksum is the number of backslash commands in the + output code — approximately! + lxgrep "part[@xml:id='code']//programlisting" $1.xml |\ + grep '\\' |\ + sed -e "s+[^\\\\]++g" |\ + tr -d '\012' |\ + tr '\\' '\012' |\ + wc -l +--> diff --git a/support/classpack/db2plaintext.xsl b/support/classpack/db2plaintext.xsl new file mode 100644 index 0000000000..ec518d7b8f --- /dev/null +++ b/support/classpack/db2plaintext.xsl @@ -0,0 +1,513 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:db="http://docbook.org/ns/docbook" + version="2.0"> + + <!-- ClassPack README STRUCTURE ONLY for inclusion in db2dtx.xsl + + 23 para + 11 productname + 11 title + 10 olink + 6 filename + 6 sect1 + 5 acronym + 4 listitem + 4 systemitem + 4 term + 4 varlistentry + 3 programlisting + 3 sect2 + 2 anchor + 2 guilabel + 2 varname + 1 chapter + 1 emphasis + 1 guibutton + 1 replaceable + 1 uri + 1 variablelist + 1 warning + +--> + + <xsl:variable name="maindoc" select="."/> + + <xsl:variable name="width"> + <xsl:text>72</xsl:text> + </xsl:variable> + + <!-- plain titles and plain paras --> + + <xsl:template mode="readme" + match="db:title[not(parent::db:chapter) and + not(parent::db:sect1) and + not(parent::db:sect2) and + not(parent::db:sect3) and + not(parent::db:warning)] | + db:para[not(parent::db:listitem) and + not(parent::db:warning)]"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="ancestor::db:part[@xml:id!='code']"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <!-- section headings --> + + <xsl:template match="db:chapter/db:title" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" + select="upper-case(normalize-space($content))"/> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="ancestor::db:part[@xml:id!='code']"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect1/db:title" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="prefix"> + <xsl:value-of + select="count(parent::db:sect1/preceding-sibling::db:sect1) + 1"/> + <xsl:text> </xsl:text> + </xsl:with-param> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="ancestor::db:part[@xml:id!='code']"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect2/db:title" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="prefix"> + <xsl:value-of + select="count(ancestor::db:sect1/preceding-sibling::db:sect1) + 1"/> + <xsl:text>.</xsl:text> + <xsl:value-of + select="count(parent::db:sect2/preceding-sibling::db:sect2) + 1"/> + <xsl:text> </xsl:text> + </xsl:with-param> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="ancestor::db:part[@xml:id!='code']"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:sect3/db:title" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="prefix"> + <xsl:value-of + select="count(ancestor::db:sect1/preceding-sibling::db:sect1) + 1"/> + <xsl:text>.</xsl:text> + <xsl:value-of + select="count(ancestor::db:sect2/preceding-sibling::db:sect2) + 1"/> + <xsl:text>.</xsl:text> + <xsl:value-of + select="count(parent::db:sect3/preceding-sibling::db:sect3) + 1"/> + <xsl:text> </xsl:text> + </xsl:with-param> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="ancestor::db:part[@xml:id!='code']"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:warning/db:title" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="prefix"> + <xsl:text> WARNING: </xsl:text> + </xsl:with-param> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + <xsl:text> !
</xsl:text> + </xsl:template> + + <xsl:template match="db:programlisting" mode="readme"> + <xsl:variable name="curdoctype"> + <xsl:value-of select="$maindoc/db:book/@arch"/> + </xsl:variable> + <xsl:if test="@condition=$curdoctype or not(@condition)"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="indent"> + <xsl:text> </xsl:text> + </xsl:with-param> + </xsl:call-template> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:term" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="indent"> + <xsl:text> </xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="db:para[parent::db:listitem]" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code']"> + <xsl:text>%% </xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="ancestor::db:variablelist"> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:when test="ancestor::db:itemizedlist"> + <xsl:text> * </xsl:text> + </xsl:when> + <xsl:when test="ancestor::db:orderedlist"> + <xsl:text> </xsl:text> + <xsl:value-of + select="count(parent::db:listitem/preceding-sibling::db:listitem)+1"/> + <xsl:text> </xsl:text> + </xsl:when> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="ancestor::db:part[@xml:id!='code']"> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="db:para[parent::db:warning]" mode="readme"> + <xsl:variable name="content"> + <xsl:apply-templates select="node()" mode="inline"/> + </xsl:variable> + <xsl:call-template name="normtext"> + <xsl:with-param name="content" select="normalize-space($content)"/> + <xsl:with-param name="indent"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + <xsl:text> ! </xsl:text> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="following-sibling::db:para"> + <xsl:if test="ancestor::db:part[@xml:id='code'] or + ancestor::db:procedure[@xml:id='prepackage']"> + <xsl:text>%% </xsl:text> + </xsl:if> + <xsl:text> !</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="db:sect1" mode="readme"> + <xsl:choose> + <xsl:when + test="@xml:id='bugs' and + $maindoc//db:revhistory/db:revision[1]/db:revdescription/db:orderedlist"> + <xsl:apply-templates mode="readme" select="db:title"/> + <xsl:text>The following need attention:

</xsl:text> + <xsl:apply-templates mode="readme" + select="$maindoc//db:revhistory/db:revision[1]/db:revdescription/db:orderedlist"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="readme"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="db:anchor" mode="readme"> + <xsl:variable name="loc" select="@targetptr"/> + <xsl:variable name="pos" select="@type"/> + <xsl:variable name="omit" select="@remap"/> + <!-- + <xsl:message> + <xsl:text>Getting </xsl:text> + <xsl:value-of select="$loc"/> + <xsl:text>/</xsl:text> + <xsl:value-of select="$pos"/> + </xsl:message> + --> + <xsl:choose> + <!-- special usage referencing a macro --> + <xsl:when test="@targetptr='copyright' and @type='*'"> + <xsl:for-each select="$maindoc"> + <xsl:call-template name="copyright-statement"> + <xsl:with-param name="ftype" select="/db:book/@userlevel"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <!-- normal operation --> + <xsl:otherwise> + <xsl:apply-templates mode="readme" + select="$maindoc/ + descendant::*[local-name()=$loc][1]/*[local-name()!=$omit]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- CONTENT --> + + <xsl:template match="db:olink" mode="inline"> + <xsl:call-template name="metadata"/> + </xsl:template> + + <xsl:template match="db:acronym | db:uri | db:filename" + mode="inline"> + <xsl:apply-templates mode="inline"/> + </xsl:template> + + <xsl:template match="db:phrase | db:wordasword | db:quote" + mode="inline"> + <xsl:text>"</xsl:text> + <xsl:apply-templates mode="inline"/> + <xsl:text>"</xsl:text> + </xsl:template> + + <xsl:template match="db:footnote" mode="inline"> + <xsl:text> [</xsl:text> + <xsl:apply-templates mode="inline"/> + <xsl:text>]</xsl:text> + </xsl:template> + + <xsl:template match="db:command" mode="inline"> + <xsl:if test="@xml:lang='TeX' or @xml:lang='LaTeX' or not(@xml:lang)"> + <xsl:text>\</xsl:text> + </xsl:if> + <xsl:apply-templates mode="inline"/> + </xsl:template> + + <xsl:template match="text()" mode="inline"> + <xsl:choose> + <xsl:when test="parent::db:emphasis"> + <xsl:value-of select="upper-case(.)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="db:biblioref" mode="inline"> + <xsl:text>(</xsl:text> + <xsl:variable name="bibref" select="@linkend"/> + <!-- go to the entry --> + <xsl:for-each select="$maindoc/descendant::db:biblioentry[@xml:id=$bibref]"> + <xsl:variable name="authors" select="count(descendant::db:author)"/> + <!-- only name up to the first two --> + <xsl:for-each select="descendant::db:author + [count(preceding-sibling::db:author)<2]"> + <xsl:if test="$authors>2 + and count(preceding-sibling::db:author)=1"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:if test="count(preceding-sibling::db:author)=2"> + <xsl:text> & </xsl:text> + </xsl:if> + <xsl:value-of select="db:personname/db:surname"/> + </xsl:for-each> + <xsl:if test="$authors>3"> + <xsl:text> et al</xsl:text> + </xsl:if> + <xsl:text>, </xsl:text> + <xsl:value-of select="substring(descendant::db:date[1]/@YYYY-MM-DD,1,4)"/> + </xsl:for-each> + <xsl:text>)</xsl:text> + </xsl:template> + + <!-- extraction of metadata from master file --> + + <xsl:template name="metadata"> + <xsl:variable name="loc" select="@targetptr"/> + <xsl:variable name="pos" select="@type"/> + <!-- + <xsl:message> + <xsl:text>Getting </xsl:text> + <xsl:value-of select="$loc"/> + <xsl:text>/</xsl:text> + <xsl:value-of select="$pos"/> + </xsl:message> + --> + <xsl:value-of + select="$maindoc/ + descendant::*[local-name()=$loc][1]/@*[name()=$pos]"/> + </xsl:template> + + <!-- typesetting --> + + <xsl:template name="normtext"> + <xsl:param name="content"/> + <xsl:param name="indent"> + <xsl:text></xsl:text> + </xsl:param> + <xsl:param name="prefix"> + <xsl:text></xsl:text> + </xsl:param> + <xsl:call-template name="set"> + <!-- + <xsl:value-of select='replace(., "\$\d+\.\d{2}","\$xx.xx")'/> +--> + <xsl:with-param name="text" + select="replace(replace(replace(replace( + concat($prefix,$content),'\\TeX\{\}','TeX'), + '\\LaTeX\{\}','LaTeX'), + '\\thinspace\{\}',' '), + '\\nicefrac(.)(.)','$1/$2')"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="set"> + <xsl:param name="text"/> + <xsl:param name="indent"> + <xsl:text></xsl:text> + </xsl:param> + <xsl:choose> + <xsl:when test="string-length($text) < $width"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$text"/> + <xsl:text>
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="line"> + <xsl:call-template name="token"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$line"/> + <xsl:text>
</xsl:text> + <xsl:call-template name="set"> + <xsl:with-param name="text" + select="normalize-space(substring-after( + concat($indent,$text),$line))"/> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="token"> + <xsl:param name="text"/> + <xsl:param name="line"/> + <xsl:param name="length"> + <xsl:text>0</xsl:text> + </xsl:param> + <xsl:param name="indent"> + <xsl:text></xsl:text> + </xsl:param> + <xsl:variable name="word"> + <xsl:choose> + <xsl:when test="contains($text,' ')"> + <xsl:value-of select="substring-before($text,' ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="size" select="string-length($word)"/> + <xsl:choose> + <!-- too much for line --> + <xsl:when test="$length + 1 + $size > $width"> + <xsl:value-of select="$line"/> + </xsl:when> + <!-- another word will fit --> + <xsl:otherwise> + <xsl:call-template name="token"> + <xsl:with-param name="line"> + <xsl:choose> + <xsl:when test="$length=0"> + <xsl:value-of select="$indent"/> + <xsl:value-of select="$word"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($line,' ',$word)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="length"> + <xsl:choose> + <xsl:when test="$length=0"> + <xsl:value-of select="$size + string-length($indent)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($line) + 1 + $size"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="text" select="substring-after($text,' ')"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/support/classpack/decommentbbl.awk b/support/classpack/decommentbbl.awk new file mode 100644 index 0000000000..0ceb4d7f36 --- /dev/null +++ b/support/classpack/decommentbbl.awk @@ -0,0 +1,37 @@ +# decommentbbl.awk +# +# This awk(1) script catenates consecutive lines of a BiBTeX-produced +# .bbl file which end in a comment character (removing the comment +# character in the process) because the default % comment character +# gets misinterpreted by the ltxdoc package when building class or +# package files. +# +# Copyright © 2008-2012 Silmaril Consultants +# Available under the terms of the LaTeX Project Public License +# as part of the classpack development package +# Peter Flynn <peter@silmaril.ie> 2010-10-14 +# +###################################################################### +# +# Read every line of the file into an array + +{ + line[NR]=$0; +} + +###################################################################### +# +# At the end, go through the array; if a line ends with a % sign, +# catenate it to the buffer, omitting the percent sign itself; +# otherwise, output the buffer and zero it for further use. + +END { + for(i=1;i<=NR;++i) { + if(substr(line[i],length(line[i]))=="%") { + buffer=buffer substr(line[i],1,length(line[i])-1); + } else { + print buffer line[i];buffer=""; + } + } +} + diff --git a/support/classpack/doctexbook.dtd b/support/classpack/doctexbook.dtd new file mode 100644 index 0000000000..8d144373d5 --- /dev/null +++ b/support/classpack/doctexbook.dtd @@ -0,0 +1,63 @@ +%% +%% This is file `doctexbook.dtd', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% classpack.dtx (with options: `savedtd') +%% This file was generated from an XML master source. +%% Amendments and corrections should be notified to the +%% maintainer for inclusion in future versions. +%% +%% The XML vocabulary +%% +%% There are currently no changes to the DocBook element structure. +%% +%% The DTD is a driver implementing a number of entity declarations to +%% ease the transformation to LaTeX. +<!ENTITY % db5dtd SYSTEM "/dtds/docbook/docbook-5.0/dtd/docbook.dtd"> +<!ATTLIST date YYYY-MM-DD CDATA #IMPLIED> +<!ATTLIST blockquote units CDATA #IMPLIED + begin CDATA #IMPLIED + end CDATA #IMPLIED> +<!ATTLIST quote units CDATA #IMPLIED + begin CDATA #IMPLIED + end CDATA #IMPLIED> +<!ELEMENT html:form EMPTY> +<!ENTITY ampers "\&#38;"> +<!ENTITY BiBTeX "\BibTeX{}"> +<!ENTITY BibTeX "\BibTeX{}"> +<!ENTITY BIBTeX "\BibTeX{}"> +<!ENTITY ConTeXt "\ConTeXt{}"> +<!ENTITY LaTeX "\LaTeX{}"> +<!ENTITY LaTeX2e "\LaTeXe{}"> +<!ENTITY XeTeX "\XeTeX{}"> +<!ENTITY LyX "\LyX{}"> +<!ENTITY METAFONT "\MF{}"> +<!ENTITY METAPOST "\MP{}"> +<!ENTITY TeX "\TeX{}"> +<!ENTITY bsol "{\texttt{\textbackslash}}"> +<!ENTITY date "\filedate{}"> +<!ENTITY degree "\textdegree{}"> +<!ENTITY doctype "\classorpackage{}"> +<!ENTITY filler "\hfil{}"> +<!ENTITY frac12 "\nicefrac12"> +<!ENTITY frac13 "\nicefrac13"> +<!ENTITY frac23 "\nicefrac23"> +<!ENTITY hellip "\dots{}"> +<!ENTITY mdash "~--- "> +<!ENTITY mldr "\dotfill{}"> +<!ENTITY nbsp "~"> +<!ENTITY ndash "--"> +<!ENTITY percnt "\%"> +<!ENTITY square "\raisebox{-1pt}{\Square}"> +<!ENTITY thinsp "\thinspace{}"> +<!ENTITY times "×"> +<!ENTITY specialUuml '{\normalfont\"{\fontfamily{cdr}\selectfont U}}'> +<!ENTITY verbar "\menusep{}"> +<!ENTITY version "\fileversion{}"> +<!-- call the main DTD --> %db5dtd; + +\endinput +%% +%% End of file `doctexbook.dtd'. diff --git a/support/classpack/lppl.xml b/support/classpack/lppl.xml new file mode 100644 index 0000000000..1c405b1568 --- /dev/null +++ b/support/classpack/lppl.xml @@ -0,0 +1,541 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "+//Silmaril//DTD DocBook 5.0//EN" + "/dtds/docbook/docbook-5.0/dtd/docbook.dtd" [ +<!ENTITY TeX "\TeX{}"> +<!ENTITY LaTeX "\LaTeX{}"> +<!ENTITY LaTeX3 "\LaTeX{3}"> +<!ENTITY mdash "~--- "> +<!ENTITY nbsp "~"> +]> +<chapter xml:id="LPPL:LPPL" version="1.3c" xml:lang="en:US" + revision="2008-05-04" annotations="Copyright 1999, 2002--2008 + &LaTeX3; Project"> + <title>The &LaTeX; Project Public License</title> + <blockquote> + <para>Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed.</para> + </blockquote> + <sect1 xml:id="LPPL:Preamble"> + <title>Preamble</title> + <para>The &LaTeX; Project Public License (<acronym>LPPL</acronym>) + is the primary license under which the &LaTeX; kernel and the + base &LaTeX; packages are distributed.</para> + <para>You may use this license for any work of which you hold the + copyright and which you wish to distribute. This license may be + particularly suitable if your work is &TeX;-related (such as a + &LaTeX; package), but it is written in such a way that you can + use it even if your work is unrelated to &TeX;.</para> + <para>The section <citetitle linkend="LPPL:Distribute" + pubwork="section"/>, below, gives instructions, examples, and + recommendations for authors who are considering distributing + their works under this license.</para> + <para>This license gives conditions under which a work may be + distributed and modified, as well as conditions under which + modified versions of that work may be distributed.</para> + <para>We, the &LaTeX3; Project, believe that the conditions below + give you the freedom to make and distribute modified versions of + your work that conform with whatever technical specifications + you wish while maintaining the availability, integrity, and + reliability of that work. If you do not see how to achieve your + goal while meeting these conditions, then read the document + <filename xlink:type="tex">cfgguide</filename> and <filename + xlink:type="tex">modguide</filename> in the base &LaTeX; + distribution for suggestions.</para> + </sect1> + <sect1 xml:id="LPPL:Definitions"> + <title>Definitions</title> + <para>In this license document the following terms are used:</para> + <variablelist> + <varlistentry> + <term>Work</term> + <listitem> + <para>Any work being distributed under this License.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Derived Work</term> + <listitem> + <para>Any work that under any applicable law is derived from + the Work.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Modification</term> + <listitem> + <para>Any procedure that produces a Derived Work under any + applicable law—for example, the production of a file + containing an original file associated with the Work or a + significant portion of such a file, either verbatim or + with modifications and/or translated into another + language.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Modify</term> + <listitem> + <para>To apply any procedure that produces a Derived Work + under any applicable law.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Distribution</term> + <listitem> + <para>Making copies of the Work available from one person to + another, in whole or in part. Distribution includes (but + is not limited to) making any electronic components of the + Work accessible by file transfer protocols such as + <acronym>FTP</acronym> or <acronym>HTTP</acronym> or by + shared file systems such as Sun's Network File System + (<acronym>NFS</acronym>).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Compiled Work</term> + <listitem> + <para>A version of the Work that has been processed into a + form where it is directly usable on a computer system. + This processing may include using installation facilities + provided by the Work, transformations of the Work, copying + of components of the Work, or other activities. Note that + modification of any installation facilities provided by + the Work constitutes modification of the Work.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Current Maintainer</term> + <listitem> + <para>A person or persons nominated as such within the Work. + If there is no such explicit nomination then it is the + <phrase>Copyright Holder</phrase> under any applicable + law.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Base Interpreter</term> + <listitem> + <para>A program or process that is normally needed for + running or interpreting a part or the whole of the + Work.</para> + <para>A Base Interpreter may depend on external components + but these are not considered part of the Base Interpreter + provided that each external component clearly identifies + itself whenever it is used interactively. Unless + explicitly specified when applying the license to the + Work, the only applicable Base Interpreter is a + <phrase>&LaTeX;-Format</phrase> or in the case of files + belonging to the <phrase>&LaTeX;-format</phrase> a program + implementing the `&TeX; language'.</para> + </listitem> + </varlistentry> + </variablelist> + </sect1> + <sect1 xml:id="LPPL:Conditions"> + <title>Conditions on Distribution and Modification</title> + <orderedlist> + <listitem> + <para>Activities other than distribution and/or modification + of the Work are not covered by this license; they are + outside its scope. In particular, the act of running the + Work is not restricted and no requirements are made + concerning any offers of support for the Work.</para> + </listitem> + <listitem xml:id="LPPL:item:distribute"> + <para>You may distribute a complete, unmodified copy of the + Work as you received it. Distribution of only part of the + Work is considered modification of the Work, and no right to + distribute such a Derived Work may be assumed under the + terms of this clause.</para> + </listitem> + <listitem> + <para>You may distribute a Compiled Work that has been + generated from a complete, unmodified copy of the Work as + distributed under Clause <xref + linkend="LPPL:item:distribute"/> above, as + long as that Compiled Work is distributed in such a way that + the recipients may install the Compiled Work on their system + exactly as it would have been installed if they generated a + Compiled Work directly from the Work.</para> + </listitem> + <listitem xml:id="LPPL:item:currmaint"> + <para>If you are the Current Maintainer of the Work, you may, + without restriction, modify the Work, thus creating a + Derived Work. You may also distribute the Derived Work + without restriction, including Compiled Works generated from + the Derived Work. Derived Works distributed in this manner + by the Current Maintainer are considered to be updated + versions of the Work.</para> + </listitem> + <listitem> + <para>If you are not the Current Maintainer of the Work, you + may modify your copy of the Work, thus creating a Derived + Work based on the Work, and compile this Derived Work, thus + creating a Compiled Work based on the Derived Work.</para> + </listitem> + <listitem xml:id="LPPL:item:conditions"> + <para>If you are not the Current Maintainer of the Work, you + may distribute a Derived Work provided the following + conditions are met for every component of the Work unless + that component clearly states in the copyright notice that + it is exempt from that condition. Only the Current + Maintainer is allowed to add such statements of exemption to + a component of the Work.</para> + <orderedlist> + <listitem> + <para>If a component of this Derived Work can be a direct + replacement for a component of the Work when that + component is used with the Base Interpreter, then, + wherever this component of the Work identifies itself to + the user when used interactively with that Base + Interpreter, the replacement component of this Derived + Work clearly and unambiguously identifies itself as a + modified version of this component to the user when used + interactively with that Base Interpreter.</para> + </listitem> + <listitem> + <para>Every component of the Derived Work contains + prominent notices detailing the nature of the changes to + that component, or a prominent reference to another file + that is distributed as part of the Derived Work and that + contains a complete and accurate log of the + changes.</para> + </listitem> + <listitem> + <para>No information in the Derived Work implies that any + persons, including (but not limited to) the authors of + the original version of the Work, provide any support, + including (but not limited to) the reporting and + handling of errors, to recipients of the Derived Work + unless those persons have stated explicitly that they do + provide such support for the Derived Work.</para> + </listitem> + <listitem> + <para>You distribute at least one of the following with + the Derived Work:</para> + <orderedlist> + <listitem> + <para>A complete, unmodified copy of the Work; if your + distribution of a modified component is made by + offering access to copy the modified component from + a designated place, then offering equivalent access + to copy the Work from the same or some similar place + meets this condition, even though third parties are + not compelled to copy the Work along with the + modified component;</para> + </listitem> + <listitem> + <para>Information that is sufficient to obtain a + complete, unmodified copy of the Work.</para> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + </listitem> + <listitem> + <para>If you are not the Current Maintainer of the Work, you + may distribute a Compiled Work generated from a Derived + Work, as long as the Derived Work is distributed to all + recipients of the Compiled Work, and as long as the + conditions of Clause <xref + linkend="LPPL:item:conditions"/>, above, are met + with regard to the Derived Work.</para> + </listitem> + <listitem> + <para>The conditions above are not intended to prohibit, and + hence do not apply to, the modification, by any method, of + any component so that it becomes identical to an updated + version of that component of the Work as it is distributed + by the Current Maintainer under Clause <xref + linkend="LPPL:item:currmaint"/>, above.</para> + </listitem> + <listitem> + <para>Distribution of the Work or any Derived Work in an + alternative format, where the Work or that Derived Work (in + whole or in part) is then produced by applying some process + to that format, does not relax or nullify any sections of + this license as they pertain to the results of applying that + process.</para> + </listitem> + <listitem> + <orderedlist> + <listitem> + <para>A Derived Work may be distributed under a different + license provided that license itself honors the + conditions listed in Clause <xref + linkend="LPPL:item:conditions"/> above, in + regard to the Work, though it does not have to honor the + rest of the conditions in this license.</para> + </listitem> + <listitem> + <para>If a Derived Work is distributed under a different + license, that Derived Work must provide sufficient + documentation as part of itself to allow each recipient + of that Derived Work to honor the restrictions in + Clause <xref + linkend="LPPL:item:conditions"/> above, concerning + changes from the Work.</para> + </listitem> + </orderedlist> + </listitem> + <listitem> + <para>This license places no restrictions on works that are + unrelated to the Work, nor does this license place any + restrictions on aggregating such works with the Work by any + means.</para> + </listitem> + <listitem> + <para>Nothing in this license is intended to, or may be used + to, prevent complete compliance by all parties with all + applicable laws.</para> + </listitem> + </orderedlist> + </sect1> + <sect1 xml:id="LPPL:Warranty"> + <title>No Warranty</title> + <para>There is no warranty for the Work. Except when otherwise + stated in writing, the Copyright Holder provides the Work + <phrase>as is</phrase>, without warranty of any kind, either + expressed or implied, including, but not limited to, the implied + warranties of merchantability and fitness for a particular + purpose. The entire risk as to the quality and performance of + the Work is with you. Should the Work prove defective, you + assume the cost of all necessary servicing, repair, or + correction.</para> + <para>In no event unless required by applicable law or agreed to + in writing will The Copyright Holder, or any author named in the + components of the Work, or any other party who may distribute + and/or modify the Work as permitted above, be liable to you for + damages, including any general, special, incidental or + consequential damages arising out of any use of the Work or out + of inability to use the Work (including, but not limited to, + loss of data, data being rendered inaccurate, or losses + sustained by anyone as a result of any failure of the Work to + operate with any other programs), even if the Copyright Holder + or said author or said other party has been advised of the + possibility of such damages.</para> + </sect1> + <sect1 xml:id="LPPL:Maintenance"> + <title>Maintenance of The Work</title> + <para>The Work has the status <phrase>author-maintained</phrase> + if the Copyright Holder explicitly and prominently states near + the primary copyright notice in the Work that the Work can only + be maintained by the Copyright Holder or simply that it is + <phrase>author-maintained</phrase>.</para> + <para>The Work has the status <phrase>maintained</phrase> if there + is a Current Maintainer who has indicated in the Work that they + are willing to receive error reports for the Work (for example, + by supplying a valid e-mail address). It is not required for the + Current Maintainer to acknowledge or act upon these error + reports.</para> + <para>The Work changes from status <phrase>maintained</phrase> to + <phrase>unmaintained</phrase> if there is no Current Maintainer, + or the person stated to be Current Maintainer of the work cannot + be reached through the indicated means of communication for a + period of six months, and there are no other significant signs + of active maintenance.</para> + <para>You can become the Current Maintainer of the Work by + agreement with any existing Current Maintainer to take over this + role.</para> + <para>If the Work is unmaintained, you can become the Current + Maintainer of the Work through the following steps:</para> + <orderedlist> + <listitem> + <para>Make a reasonable attempt to trace the Current + Maintainer (and the Copyright Holder, if the two differ) + through the means of an Internet or similar search.</para> + </listitem> + <listitem> + <para>If this search is successful, then enquire whether the + Work is still maintained.</para> + <orderedlist> + <listitem> + <para>If it is being maintained, then ask the Current + Maintainer to update their communication data within one + month.</para> + </listitem> + <listitem xml:id="LPPL:item:intention"> + <para>If the search is unsuccessful or no action to resume + active maintenance is taken by the Current Maintainer, + then announce within the pertinent community your + intention to take over maintenance. (If the Work is a + &LaTeX; work, this could be done, for example, by + posting to <uri type="news">comp.text.tex</uri>.)</para> + </listitem> + </orderedlist> + </listitem> + <listitem> + <orderedlist> + <listitem> + <para>If the Current Maintainer is reachable and agrees to + pass maintenance of the Work to you, then this takes + effect immediately upon announcement.</para> + </listitem> + <listitem xml:id="LPPL:item:announce"> + <para>If the Current Maintainer is not reachable and the + Copyright Holder agrees that maintenance of the Work be + passed to you, then this takes effect immediately upon + announcement.</para> + </listitem> + </orderedlist> + </listitem> + <listitem xml:id="LPPL:item:change"> + <para>If you make an <phrase>intention announcement</phrase> + as described in <xref + linkend="LPPL:item:intention"/> above and after three + months your intention is challenged neither by the Current + Maintainer nor by the Copyright Holder nor by other people, + then you may arrange for the Work to be changed so as to + name you as the (new) Current Maintainer.</para> + </listitem> + <listitem> + <para>If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change + completed under the terms of <xref + linkend="LPPL:item:announce"/> + or <xref linkend="LPPL:item:change"/>, then that + Current + Maintainer must become or remain the Current Maintainer upon + request provided they then update their communication data + within one month.</para> + </listitem> + </orderedlist> + <para>A change in the Current Maintainer does not, of itself, + alter the fact that the Work is distributed under the + <acronym>LPPL</acronym> license.</para> + <para>If you become the Current Maintainer of the Work, you should + immediately provide, within the Work, a prominent and + unambiguous statement of your status as Current Maintainer. You + should also announce your new status to the same pertinent + community as in <xref linkend="LPPL:item:intention"/> + above.</para> + </sect1> + <sect1 xml:id="LPPL:Distribute"> + <title>Whether and How to Distribute Works under This + License</title> + <para>This section contains important instructions, examples, and + recommendations for authors who are considering distributing + their works under this license. These authors are addressed as + <wordasword>you</wordasword> in this section.</para> + <sect2 xml:id="LPPL:Choosing"> + <title>Choosing This License or Another License</title> + <para>If for any part of your work you want or need to use + <emphasis>distribution</emphasis> conditions that differ + significantly from those in this license, then do not refer to + this license anywhere in your work but, instead, distribute + your work under a different license. You may use the text of + this license as a model for your own license, but your license + should not refer to the <acronym>LPPL</acronym> or otherwise + give the impression that your work is distributed under the + <acronym>LPPL</acronym>.</para> + <para>The document <filename + xlink:type="tex">modguide</filename> in the base &LaTeX; + distribution explains the motivation behind the conditions of + this license. It explains, for example, why distributing + &LaTeX; under the <acronym>GNU</acronym> General Public + License (<acronym>GPL</acronym>) was considered inappropriate. + Even if your work is unrelated to &LaTeX;, the discussion in + <filename xlink:type="tex">modguide</filename> may still be + relevant, and authors intending to distribute their works + under any license are encouraged to read it.</para> + </sect2> + <sect2 xml:id="LPPL:WithoutDistribution"> + <title>A Recommendation on Modification Without + Distribution</title> + <para>It is wise never to modify a component of the Work, even + for your own personal use, without also meeting the above + conditions for distributing the modified component. While you + might intend that such modifications will never be + distributed, often this will happen by accident—you may + forget that you have modified that component; or it may not + occur to you when allowing others to access the modified + version that you are thus distributing it and violating the + conditions of this license in ways that could have legal + implications and, worse, cause problems for the community. It + is therefore usually in your best interest to keep your copy + of the Work identical with the public one. Many works provide + ways to control the behavior of that work without altering any + of its licensed components.</para> + </sect2> + <sect2 xml:id="LPPL:HowTo"> + <title>How to Use This License</title> + <para>To use this license, place in each of the components of + your work both an explicit copyright notice including your + name and the year the work was authored and/or last + substantially modified. Include also a statement that the + distribution and/or modification of that component is + constrained by the conditions in this license.</para> + <para>Here is an example of such a notice and statement:</para> + <programlisting> +%%% pig.dtx +%%% Copyright 2005 M. Y. Name +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is M. Y. Name. +%% +%% This work consists of the files pig.dtx and pig.ins +%% and the derived file pig.sty. + </programlisting> + <para>Given such a notice and statement in a file, the + conditions given in this license document would apply, with + the <wordasword>Work</wordasword> referring to the three files + <filename xlink:type="dtx">pig</filename>, <filename + xlink:type="ins">pig</filename>, and <filename + xlink:type="sty">pig</filename> (the last being generated + from <filename xlink:type="dtx">pig</filename> using <filename + xlink:type="ins">pig</filename>), the <phrase>Base + Interpreter</phrase> referring to any + <phrase>&LaTeX;-Format</phrase>, and both <phrase>Copyright + Holder</phrase> and <phrase>Current Maintainer</phrase> + referring to the person + <personname>M. Y. Name</personname>.</para> + <para>If you do not want the Maintenance section of + <acronym>LPPL</acronym> to apply to your Work, change + <wordasword>maintained</wordasword> above into + <phrase>author-maintained</phrase>. However, we recommend that + you use <wordasword>maintained</wordasword> as the Maintenance + section was added in order to ensure that your Work remains + useful to the community even when you can no longer maintain + and support it yourself.</para> + </sect2> + <sect2 xml:id="LPPL:NotReplacements"> + <title>Derived Works That Are Not Replacements</title> + <para>Several clauses of the <acronym>LPPL</acronym> specify + means to provide reliability and stability for the user + community. They therefore concern themselves with the case + that a Derived Work is intended to be used as a (compatible or + incompatible) replacement of the original Work. If this is not + the case (e.g., if a few lines of code are reused for a + completely different task), then clauses 6b and 6d shall not + apply.</para> + </sect2> + <sect2 xml:id="LPPL:Recommendations"> + <title>Important Recommendations</title> + <sect3> + <title>Defining What Constitutes the Work</title> + <para>The <acronym>LPPL</acronym> requires that distributions + of the Work contain all the files of the Work. It is + therefore important that you provide a way for the licensee + to determine which files constitute the Work. This could, + for example, be achieved by explicitly listing all the files + of the Work near the copyright notice of each file or by + using a line such as:</para> + <programlisting> +%% This work consists of all files listed in manifest.txt. + </programlisting> + <para>in that place. In the absence of an unequivocal list it + might be impossible for the licensee to determine what is + considered by you to comprise the Work and, in such a case, + the licensee would be entitled to make reasonable + conjectures as to which files comprise the Work.</para> + </sect3> + </sect2> + </sect1> +</chapter> diff --git a/support/classpack/prepost.xml b/support/classpack/prepost.xml new file mode 100644 index 0000000000..a61f0268df --- /dev/null +++ b/support/classpack/prepost.xml @@ -0,0 +1,648 @@ +<!DOCTYPE refsection + PUBLIC "+//Silmaril//DTD DocBook 5.0 for DocTeX//EN" "doctexbook-master.dtd"> +<!-- This is the lookup table prepost.xml used by the db2dtx.xsl + program, part of the classpack package for maintaining LaTeX + packages and document classes. It is documented in the manual for + classpack. + + To sort the contents of this file by package name, use the command + lxsort refsection/procedure step @remap prepost.xml + + To list the packages specified, use the command + lxprintf -e step "%s %s\n" ancestor::procedure/@xml:id @remap prepost.xml +--> +<refsection> + <title>Commands to use before and after packages</title> + <procedure xml:id="prepackage"> + <!-- FONTS --> + <step condition="doc cls sty" remap="fix-cm"> + <para>Allow infinitely-variable font scaling.</para> + </step> + <step condition="cls sty" remap="avant"> + <para>Adobe Avant Garde as the default sans-serif typeface.</para> + </step> + <step condition="cls sty" remap="mathdesign"> + <para>Use the alternate MathDesign fonts for mathematics.</para> + </step> + <step condition="cls sty" remap="charter"> + <para>Bitstream Charter as the default typeface</para> + </step> + <step condition="cls sty" remap="courier"> + <para>Adobe Courier as the default monospace (typewriter) + typeface.</para> + </step> + <step condition="cls doc sty" remap="emerald"> + <para>Collection of handwriting typefaces.</para> + </step> + <step remap="dejavu" condition="cls sty doc" conformance="nosc"> + <para>Sets the DejaVu typeface as the default.</para> + </step> + <step condition="cls sty doc" remap="DejaVuSans" conformance="nosc"> + <para>Sets the DejaVu typeface as the default sans-serif typeface.</para> + </step> + <step condition="cls sty doc" remap="DejaVuSerif" conformance="nosc"> + <para>Sets the DejaVu typeface as the default serif typeface.</para> + </step> + <step condition="cls sty" remap="eucal"> + <para>Add the AMS Euler calligraphic math letters.</para> + </step> + <step condition="doc cls sty" remap="aller"> + <para>Sans-serif typeface by Dalton Maag available free from + <uri>http://www.fontsquirrel.com/fonts/Aller</uri></para> + </step> + <step condition="cls sty" remap="amssymb"> + <para>Provide for the American Mathematical Society's symbols + (see their documentation for details).</para> + </step> + <step role="utf8x" remap="inputenc" condition="cls sty"> + <para>UTF-8 is the default character set, to allow for use of + any character in any writing system. Some characters are not + specified for all fonts, so may have to be specified + manually.</para> + </step> + <step condition="doc" remap="inputenc" role="utf8x"> + <constructorsynopsis condition=""/> + <constraintdef> + <cmdsynopsis> + <command>\let\SavedShow\show</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="cls sty" remap="fontenc" role="T1"> + <para>Extended font encoding to handle UTF-8.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="cls sty" remap="marvosym"> + <para>Selection of symbols by Martin Vogel, including the Euro + sign.</para> + </step> + <step condition="cls sty" remap="helvet" role="scaled=0.8667"> + <para>Adobe Helvetica as the default sans-serif typeface.</para> + </step> + <step condition="cls sty" remap="lmodern"> + <para>The updated Computer Modern typeface as the default.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="cls sty" remap="manfnt"> + <para>Knuth's <wordasword>manual</wordasword> font (as in + <citetitle>The &TeX;book</citetitle>), used for symbols.</para> + </step> + <step condition="cls sty" remap="mathptmx"> + <para>Adobe Times New Roman as the default serif typeface, with + extended (non-Adobe) Times math.</para> + </step> + <step condition="doc cls sty" remap="warnock"> + <para>Serif typeface by Robert Slimbach available under licence + from Adobe.</para> + </step> + <step condition="cls sty" remap="pslatex"> + <para>Provides Times, Helvetica, and Courier, but chiefly used + for its specially-narrowed Courier.</para> + </step> + <step condition="doc" remap="mflogo"> + <para>Provides the &METAFONT; and &METAPOST; logos.</para> + <constructorsynopsis condition=""/> + </step> + <!-- BIBLIO --> + <step condition="doc" remap="apacite"> + <para>Bibliographic commands and formatting for the American + Psychological Association journals.</para> + <constraintdef> + <cmdsynopsis> + <command>\AtBeginDocument{\edef\ApaciteRestoreAtCode{\catcode`@=\the\catcode`@\relax}}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="cls sty" remap="bibunits"> + <para>Provision for per-chapter bibliographies.</para> + </step> + <!-- UTILS --> + <step remap="array" condition="cls sty doc"> + <para>Additional column formatting for tables.</para> + <constructorsynopsis condition="tgroup"> + </constructorsynopsis> + <constructorsynopsis condition="colspec"> + <methodparam> + <parameter>condition</parameter> + </methodparam> + <methodparam> + <parameter>colwidth</parameter> + </methodparam> + <methodparam> + <parameter>char</parameter> + <modifier>m</modifier> + </methodparam> + <methodparam> + <parameter>char</parameter> + <modifier>b</modifier> + </methodparam> + </constructorsynopsis> + </step> + <step remap="dcolumn" condition="doc"> + <para>Column formatting for decimal-aligned values</para> + <constructorsynopsis condition="colspec"> + <methodparam> + <parameter>align</parameter> + <modifier>char</modifier> + </methodparam> + </constructorsynopsis> + </step> + <step condition="cls sty" remap="babel"> + <para>Add H&ers;J support and cultural changes for many + languages.</para> + </step> + <step condition="doc cls sty" remap="calc"> + <para>Required for the calculation of extra widths for margin + adjustment.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="cls" remap="ccaption"> + <para>Allows modifications to the layout of table and figure + captions.</para> + </step> + <step remap="etoolbox" condition="doc cls sty"> + <para>An e-&TeX; toolbox for class and package authors</para> + </step> + <step condition="cls sty doc" remap="draftwatermark"> + <para>Allow the creation of a background watermark saying + <wordasword>DRAFT</wordasword>.</para> + </step> + <step condition="cls doc sty" remap="enumitem" role="inline"> + <para>List variants: inline and compact. THIS REPLACES PARALIST + AND MDWLIST.</para> + <constructorsynopsis condition="orderedlist"> + <methodparam> + <parameter>spacing</parameter> + <modifier>compact</modifier> + </methodparam> + </constructorsynopsis> + <constructorsynopsis condition="itemizedlist"> + <methodparam> + <parameter>spacing</parameter> + <modifier>compact</modifier> + </methodparam> + </constructorsynopsis> + <constructorsynopsis condition="variablelist"> + </constructorsynopsis> + </step> + <step condition="doc cls sty" remap="fancybox"> + <para>This provides round-cornered and drop-shadow boxes.</para> + <constructorsynopsis condition="guibutton"/> + <constructorsynopsis condition="sidebar"/> + </step> + <step condition="cls sty" remap="fancyhdr"> + <para>Do running headers and footers.</para> + </step> + <step condition="cls sty" remap="fancyvrb"> + <para>Add more robust verbatim facilities.</para> + <constructorsynopsis condition="programlisting"/> + </step> + <step condition="cls sty" remap="textcase"> + <para>Provides a more sophisticated casing function than the + default.</para> + </step> + <step condition="cls sty" remap="float"> + <para>Allows redesigning of floats and creation of new float + types.</para> + </step> + <step condition="doc cls sty" remap="fmtcount"> + <para>Allows for the automated formatting of ordinal + representations of numbers and counters as strings (eg first, + second, third, etc).</para> + <constructorsynopsis condition="xref"> + <methodparam> + <funcparams>linkend</funcparams> + <modifier>varlistentry</modifier> + </methodparam> + <methodparam> + <funcparams>linkend</funcparams> + <modifier>listitem</modifier> + </methodparam> + </constructorsynopsis> + </step> +<!-- defaults for Letter +* driver: pdftex +* paper: letterpaper +* layout: <same size as paper> +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: +* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt) +* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt) +* \paperwidth=614.295pt +* \paperheight=794.96999pt +* \textwidth=469.75502pt +* \textheight=650.43001pt +* \oddsidemargin=0.0pt +* \evensidemargin=0.0pt +* \topmargin=-37.0pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=10.0pt +* \footskip=30.0pt +* \marginparwidth=65.0pt +* \marginparsep=11.0pt +* \columnsep=10.0pt +* \skip\footins=9.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) +--> +<!-- defaults for A4 +* driver: pdftex +* paper: a4paper +* layout: <same size as paper> +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: +* h-part:(L,W,R)=(71.13188pt, 455.24411pt, 71.13188pt) +* v-part:(T,H,B)=(71.13188pt, 702.78308pt, 71.13188pt) +* \paperwidth=597.50787pt +* \paperheight=845.04684pt +* \textwidth=455.24411pt +* \textheight=702.78308pt +* \oddsidemargin=-1.1381pt +* \evensidemargin=-1.1381pt +* \topmargin=-38.1381pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=10.0pt +* \footskip=30.0pt +* \marginparwidth=57.0pt +* \marginparsep=11.0pt +* \columnsep=10.0pt +* \skip\footins=9.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) +--> + <step condition="doc" remap="geometry" + role="textwidth=150mm,textheight=8.5in"> + <!-- width from A4, height from Letter, assuming 25mm/1in margins --> + <para>Needed to allow resettable left margin to take account of + whatever the widest macro name is; and to adjust margins on + default base article package so that the document fits + acceptably on both A4 and Letter paper. Assuming a 25mm (1in) + margin, this means a text area of + \[\min\big\{8½″-2″\,\big\|\,210\mbox{mm}-2″\big\}× + \min\big\{9″-2″\,\big\|\,297\mbox{mm}-2″\big\}\]which I + calculate as 6.27″×9″ or 159mm\,×\,229mm.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="cls sty" remap="geometry"> + <para>Package for establishing margins and text area.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="cls sty" remap="graphicx"> + <para>Provide for graphics (PNG, JPG, or PDF format (only) for + pdflatex; EPS format (only) for standard &LaTeX;).</para> + <constructorsynopsis condition="imagedata"> + <methodparam> + <parameter>fileref</parameter> + </methodparam> + </constructorsynopsis> + </step> + <step condition="cls sty" remap="hyperref"> + <para>Provides complex settings for making hypertext (clickable) + links in PDF and PS output for URIs, cross-references, and + bibliographic citations.</para> + </step> + <step condition="cls sty" remap="ifpdf"> + <para>Allow detection of PDF or DVI mode.</para> + </step> + <step condition="cls sty" remap="ifsym" role="geometry"> + <para>Geometric symbols from the <filename>if</filename> + fonts.</para> + </step> + <step condition="cls sty" remap="ifthen"> + <para>Package to enable if--then--else conditional + processing.</para> + </step> + <step condition="cls sty" remap="lipsum"> + <para>Package to generate <wordasword>Greeked</wordasword> text + (actually cod-Latin) as a placeholder.</para> + </step> + <step condition="cls sty" remap="listings"> + <para>Provides syntactic fontification or formatting + (<phrase>pretty-printing</phrase>) of verbatim text according to + the computer language used.</para> + <constructorsynopsis condition="programlisting"> + </constructorsynopsis> + </step> + <step condition="doc cls sty" remap="makeidx"> + <para>Package for creating indexes.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="cls sty" remap="mdwlist"> + <para>DEPRECATED: USE ENUMITEM. Mark Wooding's package for + compact lists.</para> + </step> + <step condition="cls sty" remap="minitoc"> + <para>Provides a <wordasword>mini</wordasword> (per-chapter or + per-section) Table of Contents.</para> + </step> + <step condition="cls sty" remap="multicol"> + <para>Provides multi-column typesetting.</para> + <constructorsynopsis condition="simplelist"> + <methodparam> + <parameter>role</parameter> + <modifier>twocol</modifier> + </methodparam> + </constructorsynopsis> + <constructorsynopsis condition="orderedlist"> + <methodparam> + <parameter>role</parameter> + <modifier>twocol</modifier> + </methodparam> + </constructorsynopsis> + <constructorsynopsis condition="procedure"> + <methodparam> + <parameter>role</parameter> + <modifier>twocol</modifier> + </methodparam> + </constructorsynopsis> + </step> + <step condition="cls sty doc" remap="multirow"> + <para>Provides multi-column typesetting.</para> + <constructorsynopsis condition="entry"> + <methodparam> + <parameter>morerows</parameter> + </methodparam> + </constructorsynopsis> + </step> + <step condition="doc cls sty" remap="nicefrac"> + <para>Slanted fractions, even in math mode.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="doc cls sty" remap="paralist"> + <para>DEPRECATED: USE ENUMITEM. Provides for in-line lists.</para> + </step> + <step condition="doc cls sty" remap="parskip"> + <para>Creates paragraphs separated by white-space with no + indentation.</para> + <constructorsynopsis condition=""/> + </step> + <step condition="doc cls sty" remap="pdfpages"> + <para>Allow embedding of individual pages from another PDF + document.</para> + <constructorsynopsis condition="imagedata"> + <methodparam> + <parameter>format</parameter> + <modifier>pdf</modifier> + </methodparam> + </constructorsynopsis> + </step> + <step condition="doc cls sty" remap="ragged2e"> + <para>Allow hyphenation in ragged setting.</para> + </step> + <step condition="doc cls sty" remap="sectsty"> + <para>Allows the section headings to be re-styled.</para> + </step> + <step condition="cls sty" remap="setspace"> + <para>Provide 1½ or double line spacing.</para> + </step> + <step condition="cls sty" remap="soul"> + <para>Provides letter-spacing, strikeout, and underlining.</para> + </step> + <step condition="cls sty" remap="textcomp"> + <para>Additional commands for common symbols and punctuation.</para> + </step> + <step condition="doc cls sty" remap="ucccrest"> + <para>University College Cork crest (restricted).</para> + </step> + <step condition="doc cls sty" remap="ulem" role="normalem"> + <para>Underlining as an option (<emphasis>not</emphasis> + automatically replacing italics).</para> + <constructorsynopsis condition="link"> + </constructorsynopsis> + </step> + <step condition="doc cls sty" remap="url"> + <para>Handling of URI formatting.</para> + <constructorsynopsis condition="ulink"> + </constructorsynopsis> + <constructorsynopsis condition="uri"> + </constructorsynopsis> + <constructorsynopsis condition="email"> + </constructorsynopsis> + <constructorsynopsis condition=""> + <methodparam> + <parameter>methodsynopsis</parameter> + <modifier>href</modifier> + </methodparam> + </constructorsynopsis> + </step> + <step condition="doc" remap="chicago"> + <para>University of Chicago reference and citation style.</para> + <constructorsynopsis condition="bibliography"> + <methodparam> + <parameter>xreflabel</parameter> + <modifier>chicago</modifier> + </methodparam> + </constructorsynopsis> + </step> + <step condition="doc cls sty" remap="varioref"> + <para>Provides extended formatting of cross-references.</para> + <constructorsynopsis condition="xref"/> + </step> + <step condition="cls sty" remap="xargs"> + <para>Allow for multiple optional arguments.</para> + </step> + <step condition="doc cls sty" remap="xcolor" role="svgnames"> + <para>Provide color.</para> + <constructorsynopsis condition=""/> + </step> + </procedure> + <procedure xml:id="postpackage"> + <step condition="doc" remap="apacite"> + <constraintdef> + <cmdsynopsis> + <command>\AtBeginDocument{\ApaciteRestoreAtCode}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc" remap="dox"> + <para>Provides extra documentation commands to + distinguish types of macro being defined.</para> + <constructorsynopsis condition=""/> + <constraintdef> + <cmdsynopsis> + <!-- define the names --> + <command>\doxitem{Attribute}{attribute}{attributes}</command> + <command>\doxitem{AttributeValue}{attributevalue}{attribute values}</command> + <command>\doxitem{Class}{class}{classes}</command> + <command>\doxitem{Colour}{colour}{colours}</command> + <command>\doxitem{Counter}{counter}{counters}</command> + <command>\doxitem{DTD}{dtd}{DTDs/Schemas}</command> + <command>\doxitem{Element}{element}{element types}</command> + <command>\doxitem{Entity}{entity}{entities}</command> + <command>\doxitem{Error}{error}{errors}</command> + <command>\doxitem{Function}{function}{functions}</command> + <command>\doxitem[macrolike]{Length}{length}{lengths}</command> + <command>\doxitem{Mode}{mode}{mode}</command> + <command>\doxitem{Option}{option}{options}</command> + <command>\doxitem{Package}{package}{packages}</command> + <command>\doxitem{Template}{template}{templates}</command> + <!-- a narrow font to display the tags in the userdoc --> + <command>\newcommand{\LabelFont}[2][\relax]{\strut + {\fontencoding\encodingdefault + \fontfamily{lmtt}\fontseries{lc}\selectfont#1#2}\space}</command> + <!-- how to print them in the margin --> + <command>\def\PrintDescribeAttribute#1{\LabelFont{@#1}}</command> + <command>\def\PrintDescribeAttributeValue#1{\LabelFont[\itshape]{#1}}</command> + <command>\def\PrintDescribeClass#1{\LabelFont{#1}}</command> + <command>\def\PrintDescribeColour#1{\LabelFont[\color{#1}]{#1}}</command> + <command>\def\PrintDescribeCounter#1{\LabelFont{#1}}</command> + <command>\def\PrintDescribeDTD#1{\LabelFont{#1}}</command> + <command>\def\PrintDescribeElement#1{\LabelFont{<#1>}}</command> + <command>\def\PrintDescribeEntity#1{\LabelFont{\&#1;}}</command> + <command>\def\PrintDescribeError#1{\LabelFont[\color{Red}!]{#1}}</command> + <command>\def\PrintDescribeFunction#1{\LabelFont{#1}}</command> + <command>\def\PrintDescribeLength#1{\LabelFont{#1}}</command> + <command>\def\PrintDescribeMode#1{\LabelFont[\sffamily]{\textlangle#1\textrangle}}</command> + <command>\def\PrintDescribeOption#1{\LabelFont[\itshape]{#1}}</command> + <command>\def\PrintDescribePackage#1{\LabelFont{#1}}</command> + <command>\def\PrintDescribeTemplate#1{\LabelFont[\fontfamily{lmss}\fontseries{sbc}\selectfont]{#1}}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc cls sty" remap="enumitem" role="inline"> + <constraintdef> + <cmdsynopsis> + <command>\setlist[description]{style=unboxed}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc" remap="inputenc" role="utf8x"> + <constraintdef> + <cmdsynopsis> + <command>\AtBeginDocument{\let\show\SavedShow}</command> + <command>\DeclareUnicodeCharacter{9251}{\textvisiblespace}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="cls sty" remap="inputenc" role="utf8x"> + <constraintdef> + <cmdsynopsis> + <command>\PrerenderUnicode{–}</command> + <command>\PrerenderUnicode{š}</command> + <command>\PrerenderUnicode{ć}</command> + <command>\PrerenderUnicode{Å}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc" remap="listings"> + <para>Provides better formatting of listings, with syntactic + highlighting for &LaTeX; and other languages.</para> + <constraintdef> + <cmdsynopsis> + <command>\lstdefinelanguage[DocBook]{XML} + {morekeywords={abstract,address,affiliation,annotation,arg,author, + book,chapter,classname,cmdsynopsis,command,constraintdef,contrib, + copyright,cover,date,email,emphasis,envar,filename,firstname, + footnote,guibutton,guilabel,guimenu,guimenuitem,guisubmenu, + holder,info,itemizedlist,listitem,literal,member,option, + orderedlist,orgdiv,orgname,package,para,parameter,part, + personname,phrase,procedure,productname,programlisting,quote, + refsection,remark,constructorsynopsis,methodparan,modifier, + funcparams,olink,bibliography,biblioentry,biblioset,subtitle, + artpagenums,volumenum,issuenum, + releaseinfo,replaceable,revdescription,revhistory,revision, + sect1,sect2,sect3,sect4,seg,seglistitem,segmentedlist,segtitle, + simplelist,step,surname,systemitem,tag,term,title,uri,userinput, + variablelist,varlistentry,wordasword,xref,year,xml:id,xlink:href},} + </command> + <command>\lstdefinelanguage[TEI]{XML} + {morekeywords={TEI.2,teiHeader,div2,head,p,num,val,xml:id}, + }[keywords,comments,strings] + </command> + <command>\lstloadlanguages{[LaTeX]TeX,[DocBook]XML,XSLT,bash,R}</command> + <command>\lstset{basicstyle=\small\color{Black}\ttfamily, + literate= + {Ö}{{\"O}}1 + {Ä}{{\"A}}1 + {Ü}{{\"U}}1 + {ß}{{\ss}}2 + {ü}{{\"u}}1 + {á}{{\'a}}1 + {é}{{\'e}}1 + {í}{{\'i}}1 + {ó}{{\'o}}1 + {ú}{{\'u}}1 + {ä}{{\"a}}1 + {ö}{{\"o}}1, + keywordstyle=\color{DarkGreen}\bfseries, + commentstyle=\color{Gray}\upshape, + stringstyle=\color{DarkRed}\upshape, + emphstyle=\color{MediumBlue}\itshape, + showstringspaces=false, + columns=fullflexible, + keepspaces=true}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc cls sty" remap="makeidx"> + <constraintdef> + <cmdsynopsis> + <command>\makeindex</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc" remap="nicefrac"> + <constraintdef> + <cmdsynopsis> + <command>\def\textonehalf{\ensuremath{\nicefrac12}}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc" remap="sectsty"> + <constraintdef> + <cmdsynopsis> + <command>\allsectionsfont{\sffamily}</command> + <command>\renewcommand*{\descriptionlabel}[1]{\hspace\labelsep + \sffamily\bfseries #1}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="doc sty cls" remap="varioref"> + <constraintdef> + <cmdsynopsis> + <command>\vrefwarning</command> + <command>\labelformat{chapter}{Chapter~#1}</command> + <command>\labelformat{chapter}{\@chapapp~#1}</command> + <command>\labelformat{section}{section~#1}</command> + <command>\labelformat{subsection}{section~#1}</command> + <command>\labelformat{subsubsection}{section~#1}</command> + <command>\labelformat{paragraph}{section~#1}</command> + <command>\labelformat{figure}{Figure~#1}</command> + <command>\labelformat{table}{Table~#1}</command> + <command>\labelformat{item}{item~#1}</command> + <command>\renewcommand{\reftextcurrent}{elsewhere on this + page}</command> + <command>\def\reftextafter{on the + \reftextvario{next}{following} page}</command> + </cmdsynopsis> + </constraintdef> + </step> + <step condition="cls sty doc" remap="xcolor"> + <para>There seems to be a bug in the T1 encoding of some package + (unidentified, but possibly <package>xcolor</package>) which + uses the command <command>T1</command>, which is an + impossibility (no digits allowed in command names). So we fake + it here to stop &LaTeX; complaining, by dropping the first + argument on the floor.</para> + <constraintdef> + <cmdsynopsis> + <command>\@ifundefined{T}{\newcommand{\T}[2]{{\fontencoding{T1}\selectfont#2}}}{}</command> + </cmdsynopsis> + </constraintdef> + </step> + </procedure> +</refsection> diff --git a/support/classpack/readme.xml b/support/classpack/readme.xml new file mode 100644 index 0000000000..f87175b79f --- /dev/null +++ b/support/classpack/readme.xml @@ -0,0 +1,166 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "+//Silmaril//DTD DocBook 5.0//EN" + "/dtds/docbook/docbook-5.0/dtd/docbook.dtd" [ +<!ENTITY TeX "TeX"> +<!ENTITY LaTeX "LaTeX"> +<!ENTITY BiBTeX "BiBTeX"> +<!ENTITY LaTeX3 "LaTeX3"> +<!ENTITY mdash " — "> +<!ENTITY nbsp " "> +<!ENTITY thinsp " "> +<!ATTLIST sect1 targetptr CDATA #IMPLIED type CDATA #IMPLIED> +<!ATTLIST anchor targetptr CDATA #IMPLIED type CDATA #IMPLIED> +]> +<chapter xml:id="readme" version="0.03" xml:lang="en:IE" + revision="2012-06-16" annotations="Copyright © 2012 &LaTeX3; Project"> + <title>README</title> + <para>This is the README file for the <olink targetptr="book" + type="xml:id"/> <olink targetptr="book" type="arch"/>.</para> + <sect1 targetptr="abstract" type="content"> + <title>Summary</title> + <anchor targetptr="abstract" type="*" remap="title"/> + </sect1> + <sect1> + <title>Normal installation</title> + <para>This <olink targetptr="book" type="arch"/> is distributed as + a <filename>.tds.zip</filename> file (TDS is the &TeX; Directory + Structure, the standard layout for a modern &TeX; installation). + Install it on any personal <acronym>TDS</acronym>-compliant + &TeX; system by unzipping it into your personal &TeX; directory + (folder). This will put all the files into the right places, so + you can start using them immediately.</para> + <para>If you haven't yet created a personal &TeX; directory, see + below for details of what one is, and how to create it.</para> + <para>On a shared (multiuser) system like a server, unzip it into + the <varname>$TEXMFLOCAL</varname> directory instead (see + below), and run your &TeX; directory-indexing program (eg + <productname>texhash</productname>, + <productname>mktexlsr</productname>, + <productname>Update FNDB</productname>, etc) so that + everyone can use it.</para> + <para>If you are using an old non-<acronym>TDS</acronym>-compliant + system, see below under Manual Installation.</para> + <sect2> + <title>Your personal &TeX; directory</title> + <para>This is a directory (folder) on single-user systems like + desktops and laptops where you put all your local manual + modifications, updates, and additions such as classes, + packages, and fonts. The name and location are fixed:</para> + <variablelist> + <varlistentry> + <term>Apple Mac OS X</term> + <listitem> + <para><systemitem>~/Library/texmf</systemitem></para> + </listitem> + </varlistentry> + <varlistentry> + <term>Unix and GNU/Linux</term> + <listitem> + <para><systemitem>~/texmf</systemitem></para> + </listitem> + </varlistentry> + <varlistentry> + <term>MS-Windows 95/XP</term> + <listitem> + <para><systemitem>C:\texmf</systemitem></para> + </listitem> + </varlistentry> + <varlistentry> + <term>MS-Windows 2007 and above</term> + <listitem> + <para><systemitem>Computer\System\<replaceable>YOURNAME</replaceable>\texmf</systemitem></para> + </listitem> + </varlistentry> + </variablelist> + <para>Create that folder if it does not already exist.</para> + <warning> + <title>If you are a Windows user running + <productname>MiK&TeX;</productname></title> + <para>When you create the folder, you must add it to + <productname>MiK&TeX;</productname>'s list of supported + folders. Run the <productname>MiK&TeX; + Maintenance/Settings</productname> program, select the + <guilabel>Roots</guilabel> tab, and add the folder. You only + have to do this once.</para> + <para>Each time you add or remove software in your personal + &TeX; folder, you <emphasis>must</emphasis> also click on + the <guibutton>Update FNDB</guibutton> button in the + <guilabel>General</guilabel> tab.</para> + </warning> + <para>Unix (Mac and GNU/Linux) users do not need to (indeed, + should not) run their filename database indexer + (<productname>mktexlsr</productname> or + <productname>texhash</productname>) for files put in + your personal &TeX; directory.</para> + </sect2> + <sect2> + <title>Installation on shared systems</title> + <para>On multi-user systems (Unix-based), identify the shared + local directory tree with the command</para> + <programlisting>kpsewhich -expand-var '$TEXMFLOCAL'</programlisting> + <para>This will give you the location of the shared + <filename>texmf</filename> directory into which you must + install these files.</para> + <para>Do not forget to run the + <productname>texhash</productname> or + <productname>mktexlsr</productname> (filename indexer) program + after installation, otherwise the files will not be found by + &LaTeX; and nothing will work!</para> + </sect2> + </sect1> + <sect1> + <title>Manual installation (non-TDS systems)</title> + <para>To install this software manually, unzip the zip file into a + temporary directory and move the <filename><olink + targetptr="book" type="xml:id"/>.<olink targetptr="book" + type="userlevel"/></filename> file from the + <filename>tex/latex/<olink targetptr="book" + type="xml:base"/></filename> directory to a location + (directory/folder) where &LaTeX; will find it on your system. + This referred to in some documentation as <phrase>the + <varname>TEXINPUTS</varname> directory</phrase>, although it + may be called something else on your system.</para> + <para><emphasis>It is your responsibility to know where this + location is.</emphasis> See the question in the &TeX; + <acronym>FAQ</acronym> at + <uri>http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf</uri> + for more information. If you do not know, or cannot find it, or + do not have access to it, your &TeX; system may be out of date + need replacing.</para> + <sect2> + <title>Last resort</title> + <para>In an emergency, and as a last resort on unmanageable + systems, it is possible simply to put the <filename><olink + targetptr="book" type="xml:id"/>.<olink targetptr="book" + type="userlevel"/></filename> file in your current working + directory (the same folder as your <filename>.tex</filename> + file[s]).</para> + <para>While this may work, it is not supported, and may lead to + other resources (packages, fonts, etc) not being found.</para> + </sect2> + </sect1> + <sect1> + <title>Usage</title> + <para>Make this the first line of your &LaTeX; document:</para> + <programlisting condition="class">\documentclass[options]{<olink + targetptr="book" type="xml:id"/>}</programlisting> + <programlisting condition="package">\usepackage[options]{<olink + targetptr="book" type="xml:id"/>}</programlisting> + <para>Read the documentation for the options available. The + documentation is distributed as a <acronym>PDF</acronym> + document in the zip file. You can also regenerate it by + typesetting the <filename><olink targetptr="book" + type="xml:id"/>.dtx</filename> file with &LaTeX; (and + &BiBTeX; and <productname>makeindex</productname>) in the normal + way.</para> + </sect1> + <sect1 xml:id="bugs"> + <title>Bugs and TODO</title> + <para>No outstanding reported bugs at the time of this version.</para> + </sect1> + <sect1 targetptr="copright" type="content"> + <title>Copyright</title> + <para>The following statement is included in the source code:</para> + <anchor targetptr="copyright" type="*"/> + </sect1> +</chapter> |