| 1 |
% \iffalse |
| 2 |
%% Package `export' to use with LaTeX 2e |
| 3 |
%% Copyright (C) 1996, 1997, 1998, 1999 Jean-Pierre F. Drucbert, all rights reserved |
| 4 |
%% |
| 5 |
%% You may use and distribute this file freely, provided that |
| 6 |
%% you don't pretend that you wrote it. |
| 7 |
% |
| 8 |
% It may be distributed and/or modified under the |
| 9 |
% conditions of the LaTeX Project Public License, either version 1.1 |
| 10 |
% of this license or (at your option) any later version. |
| 11 |
% The latest version of this license is in |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% and version 1.1 or later is part of all distributions of LaTeX |
| 14 |
% version 1999/06/01 or later. |
| 15 |
% |
| 16 |
%<package>\NeedsTeXFormat{LaTeX2e}[1996/06/01] |
| 17 |
%<package>\ProvidesPackage{export} |
| 18 |
%<package> [2000/10/16 v1.8 Exportation of LaTeX registers (JPFD)] |
| 19 |
% |
| 20 |
%<*driver> |
| 21 |
\documentclass{ltxdoc} |
| 22 |
\GetFileInfo{export.sty} |
| 23 |
\def\filedate{2000/10/16} |
| 24 |
\def\fileversion{v1.8} |
| 25 |
\usepackage{array,multicol} |
| 26 |
\EnableCrossrefs |
| 27 |
%\DisableCrossrefs % Say \DisableCrossrefs if index is ready |
| 28 |
\RecordChanges % Gather update information |
| 29 |
\CodelineIndex % Index code by line number |
| 30 |
\title{The \pkg{export} package} |
| 31 |
\author{Jean-Pierre F. Drucbert\\\texttt{[email protected]}}% |
| 32 |
\date{\filedate} |
| 33 |
\def\bs{\texttt{\char'134}} |
| 34 |
\newlength{\clw}\setlength{\clw}{0.39\textwidth} |
| 35 |
\let\pkg\textsf |
| 36 |
\begin{document} |
| 37 |
\maketitle |
| 38 |
\DocInput{export.dtx} |
| 39 |
\end{document} |
| 40 |
%</driver> |
| 41 |
% \fi |
| 42 |
% |
| 43 |
% \CheckSum{271} |
| 44 |
% |
| 45 |
% \changes{v1.0}{20 Sep 96}{First officially released version.} |
| 46 |
% \changes{v1.1}{18 Jul 97}{Corrected two nasty bugs.} |
| 47 |
% \changes{v1.2}{12 Sep 97}{Added exporting of lengths \cs{topmargin} |
| 48 |
% and \cs{topskip}. |
| 49 |
% Added comment on \cs{ExportLength}.} |
| 50 |
% \changes{v1.3}{12 Sep 97, pm}{Typos corrected in documentation, index on 2 columns.} |
| 51 |
% \changes{v1.4}{17 Oct 97}{Added optionnal argument to |
| 52 |
% \cs{openexport} and \cs{Import} to specify a file extension. |
| 53 |
% Added new parameters in \cs{ExportPageLayout}.} |
| 54 |
% \changes{v1.5}{18 Oct 97}{Added \cs{ExportParameter}. |
| 55 |
% Hence improved \cs{ExportPageLayout}. Added \cs{ExportArrayParams}.} |
| 56 |
% \changes{v1.6}{03 Aug 99}{Added LPPL license. Minor corrections.} |
| 57 |
% \changes{v1.7}{03 Sep 99}{Added \cs{ExportMuskip}.} |
| 58 |
% \changes{v1.8}{16 Oct 2000}{Added \cs{ExportIf}.} |
| 59 |
% |
| 60 |
% \DoNotIndex{\@Mii,\@Miv,\@cons,\@currlist,\@dblarg,\@dbldeferlist} |
| 61 |
% \DoNotIndex{\@dblfloat,\@dottedtocline,\@eha,\@Esphack,\@float} |
| 62 |
% \DoNotIndex{\@floatpenalty,\@ifnextchar,\@ifundefined,\@latexerr} |
| 63 |
% \DoNotIndex{\@mkboth,\@namedef,\@nameuse,\@parboxrestore,\@spaces} |
| 64 |
% \DoNotIndex{\@starttoc,\@tempa,\@tempboxa,\@tempdima,\@warning} |
| 65 |
% \DoNotIndex{\addcontentsline,\addtocounter,\advance,\arabic,\bfseries} |
| 66 |
% \DoNotIndex{\bgroup,\box,\chapter,\columnwidth,\csname,\def,\dimen,\docdate} |
| 67 |
% \DoNotIndex{\edef,\egroup,\else,\endcsname,\endinput,\expandafter,\fi} |
| 68 |
% \DoNotIndex{\filedate,\fileversion,\global,\hbadness,\hbox,\hfil,\hrule} |
| 69 |
% \DoNotIndex{\hsize,\ht,\if@twocolumn,\ifdim,\iffalse,\ifnum,\iftrue,\ifvbox} |
| 70 |
% \DoNotIndex{\ifx,\ignorespaces,\intextsep,\kern,\let,\long,\moveleft,\newbox} |
| 71 |
% \DoNotIndex{\newcommand,\newcounter,\newif,\newsavebox,\noexpand,\normalsize} |
| 72 |
% \DoNotIndex{\numberline,\PackageError,\PackageWarning,\par,\parindent} |
| 73 |
% \DoNotIndex{\penalty,\prevdepth,\protect,\refstepcounter,\relax} |
| 74 |
% \DoNotIndex{\renewcommand,\rmfamily,\section,\setbox,\setcounter,\space} |
| 75 |
% \DoNotIndex{\textheight,\the,\typeout,\unvbox,\uppercase,\vadjust,\value} |
| 76 |
% \DoNotIndex{\vbox,\vrule,\vskip,\vspace,\wd,\z@} |
| 77 |
% |
| 78 |
% \begin{abstract} |
| 79 |
% This package\footnote{% |
| 80 |
% \begin{tabular}[t]{l} |
| 81 |
% Copyright \copyright\ 1996, 1997, 1998, 1999, 2000, 2001 by\\ |
| 82 |
% Jean-Pierre F. Drucbert\vphantom{bp}\\ |
| 83 |
% ONERA/Centre de Toulouse SRI\vphantom{bp}\\ |
| 84 |
% Office National d'\'Etudes et de Recherches A\'erospatiales\vphantom{bp}\\ |
| 85 |
% Centre de Toulouse\vphantom{bp}\\ |
| 86 |
% Service R\'eseaux et Informatique\vphantom{bp}\\ |
| 87 |
% Complexe Scientifique de Rangueil\vphantom{bp}\\ |
| 88 |
% \\ |
| 89 |
% 2, Avenue \'Edouard Belin\vphantom{bp}\\ |
| 90 |
% BP 4025 F-31055 TOULOUSE CEDEX\vphantom{bp}\\ |
| 91 |
% FRANCE\vphantom{bp}\\ |
| 92 |
% \vphantom{bp}\\ |
| 93 |
% Email: \texttt{[email protected]}\vphantom{bp}\\ |
| 94 |
% \end{tabular}} |
| 95 |
% allows you to export or import the values of various \LaTeX\ |
| 96 |
% registers like counters and lengths (rigid or rubber). This could be |
| 97 |
% useful to fabricate ``composite'' documents or to pass some data |
| 98 |
% from a document to another one. |
| 99 |
% \end{abstract} |
| 100 |
% |
| 101 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 102 |
% \section{The \pkg{export} package} |
| 103 |
% This package is designed to transmit data of type \meta{counter} or |
| 104 |
% \meta{length} % from a \LaTeX\ document to another. You must be aware |
| 105 |
% that this package must be used \emph{with extreme care}. |
| 106 |
% The passing of data is done via a file. A first document |
| 107 |
% \emph{exports} the data by invoking the following sequence of commands: |
| 108 |
% \DescribeMacro{\openexport} |
| 109 |
% \DescribeMacro{\closeexport} |
| 110 |
% \DescribeMacro{\Export} |
| 111 |
% \DescribeMacro{\ExportLength} |
| 112 |
% \DescribeMacro{\PreciseExportLength} |
| 113 |
% \DescribeMacro{\ExportMuskip} |
| 114 |
% \DescribeMacro{\ExportParameter} |
| 115 |
% \DescribeMacro{\ExportIf} |
| 116 |
% \begin{multicols}{2}\small |
| 117 |
% \setlength{\columnseprule}{.4pt} |
| 118 |
% \begin{quotation}\ttfamily\noindent |
| 119 |
% \bs openexport[\meta{extension}]\{\meta{file}\}\\ |
| 120 |
% \bs Export\{\meta{counter}\}\\ |
| 121 |
% \bs Export\{\meta{counter}\}\\ |
| 122 |
% \qquad.\\ |
| 123 |
% \qquad.\\ |
| 124 |
% \qquad.\\ |
| 125 |
% \bs ExportLength\{\meta{length}\}\\ |
| 126 |
% \bs PreciseExportLength\{\meta{length}\}\\ |
| 127 |
% \bs ExportMuskip\{\meta{muskip}\}\\ |
| 128 |
% \bs ExportParameter\{\meta{parameter}\}\\ |
| 129 |
% \bs ExportIf\{\meta{ifname}\}\\ |
| 130 |
% \qquad.\\ |
| 131 |
% \qquad.\\ |
| 132 |
% \qquad.\\ |
| 133 |
% \bs closeexport\\ |
| 134 |
% \end{quotation} |
| 135 |
% \end{multicols} |
| 136 |
% \noindent |
| 137 |
% where \meta{file} is the file used to carry the data (its name will have |
| 138 |
% the \texttt{.xpt} extension by default, but you must not give it here; |
| 139 |
% an optionnal argument may be used to specify the extension), \meta{counter} |
| 140 |
% is the name of a \LaTeX\ counter % (i.e. one of the well known counters |
| 141 |
% \texttt{chapter}, \texttt{section}, \ldots, |
| 142 |
% \texttt{equation}, etc.), or a counter you have declared by |\newcounter|. |
| 143 |
% Also, % \meta{length} is the name (\emph{without the backslash}) of a |
| 144 |
% \LaTeX\ length like % \texttt{parskip} or of a length declared by |
| 145 |
% |\newlength|. In the ``importing'' document, |
| 146 |
% we will find a command |\Import{|\meta{file}|}| or |
| 147 |
% |\Import[|\meta{extension}|]{|\meta{file}|}|. |
| 148 |
% The |\ExportLength| |
| 149 |
% command exports a length expressed in \emph{points} (\texttt{pt}) |
| 150 |
% which some fractionnal digits (5 is the maximum), while |
| 151 |
% |\PreciseExportLength| exports the length expressed in |
| 152 |
% \emph{scaled points} units (\texttt{sp}, 65536~\texttt{sp} make a point), |
| 153 |
% so it avoids possible rounding errors. |
| 154 |
% David Carlisle has pointed out that using that macro with a |
| 155 |
% \emph{rubber} length as argument would lose the shrinking and |
| 156 |
% stretching parts and that |\ExportLength| does not make |
| 157 |
% any rounding error in fact. You can trust him! Always use |
| 158 |
% |\ExportLength| in case of doubt. |
| 159 |
% |
| 160 |
% |\ExportMuskip| is like |\ExportLength| but for a muskip |
| 161 |
% register. In fact, you could use |\ExportLength| for a |
| 162 |
% muskip register: the two commands are identical, except the |
| 163 |
% message written in the \texttt{.log} file. But you can not |
| 164 |
% use |\PreciseExportLength| with a muskip register: another |
| 165 |
% pretext to not use that superfluous command. |
| 166 |
% |
| 167 |
% |\ExportParameter| allows you to export parameters defined |
| 168 |
% by simple commands, like |\textfraction|. Do not try to export |
| 169 |
% complex things. It would nor work, at best, or crash, at worst. |
| 170 |
% |
| 171 |
% |\ExportIf| allows you to export the state of an ``if'' |
| 172 |
% condition, i.e. the command |\ExportIf{foo}| will export the state of |
| 173 |
% |\iffoo|, just by writing |\foofalse| or |\footrue| in the |
| 174 |
% export file. |
| 175 |
% \emph{Note that the \meta{ifname} does not contains |
| 176 |
% the letters if at the beginning, nor the backslash.} |
| 177 |
% |
| 178 |
% \DescribeMacro{\ExportPageLayout} |
| 179 |
% If you want to export \emph{all} the dimensions (lengths) describing the |
| 180 |
% page layout, just use the |\ExportPageLayout| command. In a standard way, |
| 181 |
% you should export only that into a given file, which should |
| 182 |
% be imported in the preamble |
| 183 |
% of the importing document. This method allows to have two documents with |
| 184 |
% similar page layouts. |
| 185 |
% |
| 186 |
% \DescribeMacro{\ExportArrayParams} |
| 187 |
% This macro export the dimensions and parameters related to the |
| 188 |
% layout of \texttt{array} and \texttt{tabular} environments. |
| 189 |
% |
| 190 |
% \subsection{An Example of Application} |
| 191 |
% This package is very useful when associated which the \pkg{dvipaste} |
| 192 |
% package\,\footnote{This package is now obsoleted by the nice |
| 193 |
% package \pkg{grfpaste} from David Carlisle, but the same remarks |
| 194 |
% still apply.}, which allows you to prepare rectangular page pieces |
| 195 |
% and to ``paste'' these page pieces into your document. |
| 196 |
% \textbf{Warning:} if a such pasted piece modifies an imported counter |
| 197 |
% or length, you must take account of that alteration in the document |
| 198 |
% receiving the pasted piece. |
| 199 |
% |
| 200 |
% The \pkg{dvipaste.sty} package is now available from CTAN archives, |
| 201 |
% in the same directory than the \pkg{export} package. But you |
| 202 |
% should get from CTAN the whole directory containing |
| 203 |
% \pkg{dvipaste.tex} is. Get it (and the accompagning files), |
| 204 |
% and read the documentation of \pkg{dvipaste}: |
| 205 |
% you will also need the \pkg{dvipaste.c} program. |
| 206 |
% The \pkg{grfpaste} package is also available from CTAN |
| 207 |
% archives; it needs the \pkg{dvipaste.c} program. |
| 208 |
% A simple example is described in the next pages. |
| 209 |
% \clearpage |
| 210 |
% \begin{enumerate} |
| 211 |
% \item the main document \texttt{a.tex} exports the counters |
| 212 |
% \texttt{equation} and \texttt{chapter}, via the file \texttt{x.xpt}, |
| 213 |
% toward the document \texttt{b.tex}. |
| 214 |
% Adding to that, \texttt{a.tex} imports the labels defined in \texttt{b.tex} |
| 215 |
% (using the \pkg{xr} package, from David Carlisle). |
| 216 |
% \begin{quotation}\footnotesize |
| 217 |
% \unskip\hspace*{-4\parindent}\begin{tabular}{p{\clw}c|cp{\clw}} |
| 218 |
% \null\hfill\texttt{a.tex}\hfill\null% |
| 219 |
% &\quad&\quad&\null\hfill\texttt{b.tex}\hfill\null\\\hline |
| 220 |
% \verb|\documentclass{article}%|&&&\verb|\documentclass{article}%|\\ |
| 221 |
% \verb|\usepackage%|&&&\verb|\usepackage%|\\ |
| 222 |
% \verb| {...,export,dvipaste,xr,...}|&&&\verb| {...,export,dvipaste,...}|\\ |
| 223 |
% \verb|\externaldocument{b}|&&&\\ |
| 224 |
% \verb|\begin{document}|&&&\verb|\begin{document}|\\ |
| 225 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 226 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 227 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 228 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 229 |
% \verb|\openexport{x}|&&&\\ |
| 230 |
% \verb|\Export{equation}|&&&\\ |
| 231 |
% \verb|\Export{chapter}|&&&\\ |
| 232 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 233 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 234 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 235 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 236 |
% \verb|\closeexport|&&&\\ |
| 237 |
% \end{tabular} |
| 238 |
% |
| 239 |
% \end{quotation} |
| 240 |
% |
| 241 |
% \item The document \texttt{b.tex} imports the data contained in |
| 242 |
% the file \texttt{x.xpt}, |
| 243 |
% i.e. the values of the \texttt{equation} and \texttt{chapter} counters. |
| 244 |
% \begin{quotation}\footnotesize |
| 245 |
% \unskip\hspace*{-4\parindent}\begin{tabular}{p{\clw}c|cp{\clw}} |
| 246 |
% \null\hfill\tt a.tex\hfill\null% |
| 247 |
% &\quad&\quad&\null\hfill\tt b.tex\hfill\null\\\hline |
| 248 |
% &&&\verb|\Import{x}| |
| 249 |
% \end{tabular} |
| 250 |
% |
| 251 |
% \end{quotation} |
| 252 |
% |
| 253 |
% \item the it uses this counter in preparing an equation in a logical box: |
| 254 |
% \begin{quotation}\footnotesize |
| 255 |
% \unskip\hspace*{-4\parindent}\begin{tabular}{p{\clw}c|cp{\clw}} |
| 256 |
% \null\hfill\tt a.tex\hfill\null% |
| 257 |
% &\quad&\quad&\null\hfill\tt b.tex\hfill\null\\\hline |
| 258 |
% &&&\verb|\setbox0=\hbox{%|\\ |
| 259 |
% &&&\verb| \begin{minipage}{\textwidth}|\\ |
| 260 |
% &&&\verb|\begin{equation}|\\ |
| 261 |
% &&&\verb|a=b \label{eq-a}|\\ |
| 262 |
% &&&\verb|\end{equation}|\\ |
| 263 |
% &&&\verb|\end{minipage}}|\\ |
| 264 |
% &&&\verb|\sendout{\box0}|\\ |
| 265 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 266 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 267 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 268 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 269 |
% &&&\verb|\end{document}|\\ |
| 270 |
% \end{tabular} |
| 271 |
% |
| 272 |
% \end{quotation} |
| 273 |
% |
| 274 |
% \item The document \texttt{a.tex} ``pastes'' the piece created by |
| 275 |
% \texttt{b.tex}, then explicitely increments the \texttt{equation} |
| 276 |
% counter, since the pasted piece contains an unaccounted equation% |
| 277 |
% \footnote{An other, more general, method would be to ``export back'' |
| 278 |
% the counter via an other file. This method is used when several |
| 279 |
% counters are involved.}: |
| 280 |
% \begin{quotation}\footnotesize |
| 281 |
% \unskip\hspace*{-4\parindent}\begin{tabular}{p{\clw}c|cp{\clw}} |
| 282 |
% \null\hfill\tt a.tex\hfill\null% |
| 283 |
% &\quad&\quad&\null\hfill\tt b.tex\hfill\null\\\hline |
| 284 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 285 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 286 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 287 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 288 |
% \verb|\noindent\paste{b}{1}|&&&\\ |
| 289 |
% \verb|\stepcounter{equation}|&&&\\ |
| 290 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 291 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 292 |
% \null\hfill$\vdots$\hfill$\vdots$\hfill\null% |
| 293 |
% &&&\null\hfill$\vdots$\hfill$\vdots$\hfill\null\\ |
| 294 |
% \end{tabular} |
| 295 |
% |
| 296 |
% \end{quotation} |
| 297 |
% \end{enumerate} |
| 298 |
% |
| 299 |
% In fact, the following sequence of actions must be performed here: |
| 300 |
% \begin{quote}\sloppy |
| 301 |
% \begin{tabular}{lcp{8cm}} |
| 302 |
% \textbf{latex b}&\qquad&to create the files \texttt{b.dat}, which |
| 303 |
% contain the dimensions of the pieces to ``paste'' and |
| 304 |
% \texttt{b.dvi} contains the pieces themselves. But \texttt{b.tex} |
| 305 |
% will not be able to import anything, because \texttt{x.xpt} has |
| 306 |
% not yet been created;\\ |
| 307 |
% \textbf{latex a}&&to create \texttt{x.xpt};\\ |
| 308 |
% \textbf{latex b}&&to create again \texttt{b.dat} with the right |
| 309 |
% dimensions and \texttt{b.dvi} containing correct values for |
| 310 |
% equation numbers, since importation could be done;\\ |
| 311 |
% \textbf{latex a}&&to take into account the new dimensions in |
| 312 |
% \texttt{b.dat};\\ |
| 313 |
% \textbf{dvipaste a}&&to ``paste'' into \texttt{a.dvi} the pieces |
| 314 |
% coming from \texttt{b.dvi}. |
| 315 |
% \end{tabular} |
| 316 |
% \end{quote} |
| 317 |
% |
| 318 |
% Note that the \pkg{xr} package, from David Carlisle, allows you |
| 319 |
% to pass \meta{label} information (i.e. to use |\ref{|\meta{label}|}| |
| 320 |
% or |\pageref{|\meta{label}|}|) when the \meta{label} is |
| 321 |
% defined by |\label{|\meta{label}|}| in an other \LaTeX\ document. |
| 322 |
% |
| 323 |
% \subsection{Figures and Tables} |
| 324 |
% \DescribeMacro{\xcaptionf} |
| 325 |
% \DescribeMacro{\xcaptiont} |
| 326 |
% In the case of a figure or table which is ``pasted'' this way into |
| 327 |
% a document \emph{with} its caption, this one will not be present in |
| 328 |
% the list of figures or tables. An easy solution is to use a |
| 329 |
% |\xcaptionf{|\meta{caption}|}| (or |\xcaptiont{|\meta{caption}|}| |
| 330 |
% for a table) command. These commands will increment the figure or |
| 331 |
% table counter. |
| 332 |
% |
| 333 |
% \subsection{Inserting several pages} |
| 334 |
% Sometimes, you will need to separately typeset several pages of a |
| 335 |
% document. To accomplish that, you prepare a second document |
| 336 |
% containing only the desired pages. This second document |
| 337 |
% will need, by exemple, some packages not used in the main document |
| 338 |
% (often because they require too much resources). To get correctly |
| 339 |
% numbered pages, figures, tables, notes, etc., |
| 340 |
% in the main document and in the secondary document, you just have to |
| 341 |
% export the corresponding counters from the main document \emph{before} |
| 342 |
% the insertion, to import them at the beginning of the secondary document, |
| 343 |
% to export them again (via an other file) at the end of the secondary |
| 344 |
% document, and at least to import them (via this second file) |
| 345 |
% \emph{after} the insertion into the main document. |
| 346 |
% |
| 347 |
% \begin{quotation}\sffamily\noindent |
| 348 |
% It will certainly be necessary to transmit the page counter, |
| 349 |
% which is named ``\texttt{page}''. You must then add a |
| 350 |
% |\clearpage| command \emph{before} the exportation. |
| 351 |
% This is mandatory only if the exported value must be used to |
| 352 |
% number the page which follows the exportation. Do not export |
| 353 |
% the page counter to an auxiliary document in which you are creating |
| 354 |
% pieces to be ``pasted'' into your document (in such an auxiliary document, |
| 355 |
% the ``page counter'' is in fact counter used to number the |
| 356 |
% pieces to be pasted). |
| 357 |
% \end{quotation} |
| 358 |
% |
| 359 |
% The insertion is only logical: you will have to do it manually in |
| 360 |
% the printed paper sheets, or to use software tools manipulating |
| 361 |
% \texttt{.dvi} files (e.g. \textbf{dvidvi}, \textbf{dviselect}, |
| 362 |
% and \textbf{dviconcat}). A serious problem subsists: |
| 363 |
% if they are sectionning commands and floating elements |
| 364 |
% (like figures and tables) with captions in the secondary document, |
| 365 |
% what to do to have a correct table of contents, a correct |
| 366 |
% list of figures and tables in the main document? |
| 367 |
% A similar problem arises for the bibliography. You just need to |
| 368 |
% add, in the main document, at the insertion point, a |
| 369 |
% command: |
| 370 |
% \DescribeMacro{\AddInputInAux} |
| 371 |
% \begin{quote}\tt |
| 372 |
% \bs AddInputInAux\{\meta{secondary document}.aux\} |
| 373 |
% \end{quote} |
| 374 |
% and so the \texttt{.aux} file of the secondary document will be |
| 375 |
% considered as an auxiliary file (of first or second level) of |
| 376 |
% the main document. This method has a small drawback: |
| 377 |
% if you declare the main document as an external document |
| 378 |
% (as defined by the \pkg{xr} package) of the secondary document |
| 379 |
% in order to be able to reference labels of the main document (or |
| 380 |
% of parts of it) from the secondary one, you will have to use the |
| 381 |
% optionnal argument in the command: |
| 382 |
% \begin{quote}\ttfamily |
| 383 |
% \bs usepackage\{xr\}\\ |
| 384 |
% \bs externaldocument[\meta{optiannal arg.}]\{\meta{main document}\}\\ |
| 385 |
% \bs externaldocument[\meta{optionnal arg.}]\{\meta{part |
| 386 |
% of main document}\} |
| 387 |
% \end{quote} |
| 388 |
% else the labels in the main document (or parts of it) would be |
| 389 |
% considered as defined twice during the processing of the secondary |
| 390 |
% document. This happens not often, but if you have this problem, the |
| 391 |
% solution is simple but not trivial. |
| 392 |
% |
| 393 |
% \section{Acknowledgments} |
| 394 |
% I must thanks, once more, David Carlisle for his precious comments, |
| 395 |
% for the \pkg{grfpaste} package, and his great work on the \pkg{xr} package. |
| 396 |
% |
| 397 |
% \section{Problems} |
| 398 |
% \begin{itemize} |
| 399 |
% \item This package is certainly to be used with care; the user |
| 400 |
% must understand its mechanism. |
| 401 |
% \item I did not found a way to determine automatically the type |
| 402 |
% of a \LaTeX\ register. If it is not defined, you get an error. |
| 403 |
% But exporting a register with the wrong type (i.e. a rubber length |
| 404 |
% as a counter) may lead to confusion or loss of data. |
| 405 |
% \item The documentation is written in a very poor english. Do not |
| 406 |
% hesitate to send corrections. |
| 407 |
% \item Do not confuse this \pkg{export} package (and its \cs{Import} |
| 408 |
% command) with the \pkg{import} package (and its \cs{import} command) |
| 409 |
% from Donald Arseneau. The two packages have no relation except |
| 410 |
% similarity of names. |
| 411 |
% \end{itemize} |
| 412 |
% |
| 413 |
% \section{To Do} |
| 414 |
% \begin{itemize} |
| 415 |
% \item Other parameter sets could be exported the same way as the |
| 416 |
% page layout parameters. Ask if you have needs. |
| 417 |
% \item Export other kinds of parameters (strings, macros, etc.). |
| 418 |
% \item Improve the documentation. |
| 419 |
% \end{itemize} |
| 420 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 421 |
% |
| 422 |
% \StopEventually{\setcounter{IndexColumns}{2}\PrintIndex\PrintChanges} |
| 423 |
% |
| 424 |
% \clearpage |
| 425 |
% \section{Implementation} |
| 426 |
% |
| 427 |
% \begin{macrocode} |
| 428 |
%<*package> |
| 429 |
% \end{macrocode} |
| 430 |
% |
| 431 |
% \begin{macro}{\export} |
| 432 |
% First, we declare the |\export| write channel: |
| 433 |
% \begin{macrocode} |
| 434 |
\newwrite\export |
| 435 |
% \end{macrocode} |
| 436 |
% \end{macro} |
| 437 |
% |
| 438 |
% \begin{macro}{\openexport} |
| 439 |
% The command |\openexport| announce the beginning of a sequence |
| 440 |
% of exportations and opens the file which will be used to |
| 441 |
% carry the data: |
| 442 |
% \begin{macrocode} |
| 443 |
\newcommand{\openexport}[2][xpt]{% |
| 444 |
\PackageInfo{export}{\MessageBreak |
| 445 |
Exportations into #2.#1.\MessageBreak}% |
| 446 |
\immediate\openout\export #2.#1} |
| 447 |
% \end{macrocode} |
| 448 |
% The optionnal argument is the extension added to the name of the file. |
| 449 |
% Default: \texttt{xpt}. Using an other extension may be useful for |
| 450 |
% package writers needing more specific names. |
| 451 |
% \end{macro} |
| 452 |
% |
| 453 |
% \begin{macro}{\closeexport} |
| 454 |
% The command |\closeexport| terminates a sequence of exportations |
| 455 |
% by closing the file and announcing. Opening and closing are |\immediate|. |
| 456 |
% \begin{macrocode} |
| 457 |
\newcommand{\closeexport}{\immediate\closeout\export% |
| 458 |
\PackageInfo{export}{\MessageBreak |
| 459 |
End of exportations.\MessageBreak}} |
| 460 |
% \end{macrocode} |
| 461 |
% \end{macro} |
| 462 |
% |
| 463 |
% \begin{macro}{\ExportLength} |
| 464 |
% And now, the exporting commands. To export a length in points, |
| 465 |
% we just use |\the|\meta{length} and write it as an argument of |
| 466 |
% a |\setlength| command. This command may be used for rigid |
| 467 |
% and rubber lengths, because |\the| gives the shrinking and |
| 468 |
% stretching parts of a rubber length. |
| 469 |
% \begin{macrocode} |
| 470 |
\newcommand{\ExportLength}[1]{% |
| 471 |
\PackageInfo{export}{Exportation of length #1}% |
| 472 |
\immediate\write\export{\string\setlength{\csname#1\endcsname}% |
| 473 |
{\the\csname#1\endcsname}}} |
| 474 |
% \end{macrocode} |
| 475 |
% \end{macro} |
| 476 |
% |
| 477 |
% \begin{macro}{\PreciseExportLength} |
| 478 |
% But for rigid lengths (for rubber ones, you would lose the |
| 479 |
% skrinking and stretching parts), you could use |
| 480 |
% |\PreciseExportLength|, which export the length expressed in |
| 481 |
% scaled points. The trick is to use |\number| in place of |\the|, |
| 482 |
% and adding \texttt{sp} for units. |
| 483 |
% \begin{macrocode} |
| 484 |
\newcommand{\PreciseExportLength}[1]{% |
| 485 |
\PackageInfo{export}{Precise exportation of length #1}% |
| 486 |
\immediate\write\export{\string\setlength{\csname#1\endcsname}% |
| 487 |
{\number\csname#1\endcsname sp}}} |
| 488 |
% \end{macrocode} |
| 489 |
% \end{macro} |
| 490 |
% |
| 491 |
% \begin{macro}{\ExportMuskip} |
| 492 |
% To export a muskip in mu-s, |
| 493 |
% we just use |\the|\meta{length} and write it as an argument of |
| 494 |
% a |\setlength| command. |
| 495 |
% \begin{macrocode} |
| 496 |
\newcommand{\ExportMuskip}[1]{% |
| 497 |
\PackageInfo{export}{Exportation of muskip #1}% |
| 498 |
\immediate\write\export{\string\setlength{\csname#1\endcsname}% |
| 499 |
{\the\csname#1\endcsname}}} |
| 500 |
% \end{macrocode} |
| 501 |
% Note that |\ExportLength| works well with muskips, but |
| 502 |
% |\PreciceExportLength| does nait and gives an error: |
| 503 |
% another reason to not use that superfluous command. |
| 504 |
% \end{macro} |
| 505 |
% |
| 506 |
% \begin{macro}{\Export} |
| 507 |
% Exporting a counter is rather trivial, using |\@arabic| to get |
| 508 |
% its value from the internal name of the \LaTeX\ counter. |
| 509 |
% \begin{macrocode} |
| 510 |
\newcommand{\Export}[1]{% |
| 511 |
\PackageInfo{export}{Exportation of counter #1}% |
| 512 |
\immediate\write\export{\string\setcounter{#1}% |
| 513 |
{\@arabic\csname c@#1\endcsname}}} |
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro} |
| 516 |
% |
| 517 |
% \begin{macro}{\ExportParameter} |
| 518 |
% Exporting a simple parameter is utterly complex: hence |
| 519 |
% contorsions with \cs{expandafter} and \cs{noexpand}. |
| 520 |
% The \cs{providecommand} should avoid errors. |
| 521 |
% \begin{macrocode} |
| 522 |
\newcommand{\ExportParameter}[1]{% |
| 523 |
\PackageInfo{export}{Exportation of parameter #1}% |
| 524 |
\immediate\write\export% |
| 525 |
{\string\providecommand{\expandafter\noexpand\csname#1\endcsname}% |
| 526 |
{}} |
| 527 |
\immediate\write\export% |
| 528 |
{\string\renewcommand{\expandafter\noexpand\csname#1\endcsname}% |
| 529 |
{\csname#1\endcsname}}} |
| 530 |
% \end{macrocode} |
| 531 |
% \end{macro} |
| 532 |
% |
| 533 |
% \begin{macro}{\ExportIf} |
| 534 |
% Exporting an ``if'' condition is far from trivial. |
| 535 |
% We need to protect the contition name and to |
| 536 |
% avoid some expansions. |
| 537 |
% \begin{macrocode} |
| 538 |
\newcommand{\ExportIf}[1]{% |
| 539 |
\PackageInfo{export}{Exportation of the if condition ``#1''} |
| 540 |
\expandafter\csname if#1\endcsname |
| 541 |
\immediate\write\export{\expandafter\noexpand\csname #1true\endcsname} |
| 542 |
\else |
| 543 |
\immediate\write\export{\expandafter\noexpand\csname #1false\endcsname} |
| 544 |
\fi} |
| 545 |
% \end{macrocode} |
| 546 |
% \end{macro} |
| 547 |
% |
| 548 |
% \begin{macro}{\Import} |
| 549 |
% Importing the data is easy: open the file for reading, |
| 550 |
% read it: the |\setcounter| and |\setlength| commands are |
| 551 |
% executed, then close it. |
| 552 |
% \begin{macrocode} |
| 553 |
\newcommand{\Import}[2][xpt]{% |
| 554 |
\PackageInfo{export}{\MessageBreak |
| 555 |
Importations from #2.#1\MessageBreak}% |
| 556 |
\InputIfFileExists{#2.#1}{\relax}{\relax}} |
| 557 |
% \end{macrocode} |
| 558 |
% \end{macro} |
| 559 |
% |
| 560 |
% \begin{macro}{\xcaptionf} |
| 561 |
% Now, the two caption commands. They increment the figure or table counter, |
| 562 |
% then call the internal macro |\@xcaption|. We provide |\xcaption| if you |
| 563 |
% have other classes of floats. |
| 564 |
% \begin{macrocode} |
| 565 |
\def\xcaptionf{\refstepcounter{figure} \@dblarg{\@xcaption{figure}}} |
| 566 |
% \end{macrocode} |
| 567 |
% \end{macro} |
| 568 |
% \begin{macro}{\xcaptiont} |
| 569 |
% \begin{macrocode} |
| 570 |
\def\xcaptiont{\refstepcounter{table} \@dblarg{\@xcaption{table}}} |
| 571 |
% \end{macrocode} |
| 572 |
% \end{macro} |
| 573 |
% \begin{macro}{\xcaption} |
| 574 |
% \begin{macrocode} |
| 575 |
\def\xcaption#1{\refstepcounter{#1} \@dblarg{\@xcaption{#1}}} |
| 576 |
% \end{macrocode} |
| 577 |
% \end{macro} |
| 578 |
% |
| 579 |
% \begin{macro}{\@xcaption} |
| 580 |
% \begin{macrocode} |
| 581 |
\long\def\@xcaption#1[#2]#3{\par\addcontentsline{\csname |
| 582 |
ext@#1\endcsname}{#1}{\protect\numberline{\csname |
| 583 |
the#1\endcsname}{\ignorespaces #2}}% |
| 584 |
% ^^A \begingroup |
| 585 |
% ^^A \@parboxrestore |
| 586 |
% ^^A \normalsize |
| 587 |
% ^^A \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par |
| 588 |
% ^^A \endgroup |
| 589 |
} |
| 590 |
% \end{macrocode} |
| 591 |
% \end{macro} |
| 592 |
% |
| 593 |
% \begin{macro}{\iprotected@write} |
| 594 |
% We need these two internal macros for |\AddInputInAux|. They are |
| 595 |
% slighty modified copies of similar macros in the \LaTeX\ kernel. |
| 596 |
% \begin{macrocode} |
| 597 |
\def\iprotected@write#1#2#3{% |
| 598 |
\begingroup |
| 599 |
\let\thepage\relax |
| 600 |
#2% |
| 601 |
\let\protect\@unexpandable@protect |
| 602 |
\edef\reserved@a{\immediate\write#1{#3}}% |
| 603 |
\reserved@a |
| 604 |
\endgroup |
| 605 |
\if@nobreak\ifvmode\nobreak\fi\fi |
| 606 |
} |
| 607 |
% \end{macrocode} |
| 608 |
% \end{macro} |
| 609 |
% |
| 610 |
% \begin{macro}{\@inputx} |
| 611 |
% \begin{macrocode} |
| 612 |
\def\@inputx#1{{\def\bibcite##1##2{\relax}\@input{#1}}} |
| 613 |
% \end{macrocode} |
| 614 |
% \end{macro} |
| 615 |
% |
| 616 |
% This macro write an |\@inputx| of the given file into the \texttt{.aux} file. |
| 617 |
% \begin{macro}{\AddInputInAux} |
| 618 |
% \begin{macrocode} |
| 619 |
\newcommand{\AddInputInAux}[1]{% |
| 620 |
\iprotected@write\@auxout |
| 621 |
{% |
| 622 |
\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}% |
| 623 |
{\string\@inputx{#1}% |
| 624 |
}% |
| 625 |
}% |
| 626 |
% \end{macrocode} |
| 627 |
% \end{macro} |
| 628 |
% |
| 629 |
% \begin{macro}{\ExportPageLayout} |
| 630 |
% This macro is just a list of exportations of the lengths defining the |
| 631 |
% page layout, because it would be so boring to type all that! |
| 632 |
% It also exports some parameters and counters related to page layout |
| 633 |
% and float management. |
| 634 |
% Note that \cs{mathindent} is exported only if it is defined, i.e. when the |
| 635 |
% \texttt{fleqn} class option is used. |
| 636 |
% \begin{macrocode} |
| 637 |
\newcommand{\ExportPageLayout}{% |
| 638 |
\PackageInfo{export}{\MessageBreak |
| 639 |
Exportation of the PageLayout\MessageBreak}% |
| 640 |
\PreciseExportLength{hsize} |
| 641 |
\PreciseExportLength{vsize} |
| 642 |
\PreciseExportLength{hoffset} |
| 643 |
\PreciseExportLength{voffset} |
| 644 |
\PreciseExportLength{linewidth} |
| 645 |
\PreciseExportLength{columnwidth} |
| 646 |
\PreciseExportLength{columnsep} |
| 647 |
\PreciseExportLength{columnseprule} |
| 648 |
\PreciseExportLength{parindent} |
| 649 |
\ExportLength{parskip} |
| 650 |
\PreciseExportLength{hoffset} |
| 651 |
\PreciseExportLength{voffset} |
| 652 |
\PreciseExportLength{oddsidemargin} |
| 653 |
\PreciseExportLength{evensidemargin} |
| 654 |
\PreciseExportLength{headheight} |
| 655 |
\PreciseExportLength{headsep} |
| 656 |
\PreciseExportLength{textheight} |
| 657 |
\PreciseExportLength{textwidth} |
| 658 |
\PreciseExportLength{paperheight} |
| 659 |
\PreciseExportLength{paperwidth} |
| 660 |
\PreciseExportLength{marginparsep} |
| 661 |
\PreciseExportLength{marginparwidth} |
| 662 |
\PreciseExportLength{marginparpush} |
| 663 |
\PreciseExportLength{footskip} |
| 664 |
\PreciseExportLength{topmargin} |
| 665 |
\PreciseExportLength{topskip} |
| 666 |
\PreciseExportLength{jot} |
| 667 |
\@ifundefined{mathindent}{}{\PreciseExportLength{mathindent}} |
| 668 |
\ExportLength{abovedisplayskip} |
| 669 |
\ExportLength{belowdisplayskip} |
| 670 |
\ExportLength{abovedisplayshortskip} |
| 671 |
\ExportLength{belowdisplayshortskip} |
| 672 |
\ExportLength{floatsep} |
| 673 |
\ExportLength{textfloatsep} |
| 674 |
\ExportLength{dblfloatsep} |
| 675 |
\ExportLength{dbltextfloatsep} |
| 676 |
\ExportLength{intextsep} |
| 677 |
\Export{topnumber} |
| 678 |
\Export{dbltopnumber} |
| 679 |
\Export{bottomnumber} |
| 680 |
\Export{totalnumber} |
| 681 |
\PreciseExportLength{footnotesep} |
| 682 |
\ExportParameter{topfraction} |
| 683 |
\ExportParameter{bottomfraction} |
| 684 |
\ExportParameter{textfraction} |
| 685 |
\ExportParameter{floatpagefraction} |
| 686 |
\ExportParameter{dbltopfraction} |
| 687 |
\ExportParameter{dblfloatfraction} |
| 688 |
\ExportLength{baselineskip} |
| 689 |
\ExportLength{normalbaselineskip} |
| 690 |
\ExportParameter{baselinestretch} |
| 691 |
\PackageInfo{export}{\MessageBreak |
| 692 |
End of exportation of the PageLayout\MessageBreak}}% |
| 693 |
% \end{macrocode} |
| 694 |
% \end{macro} |
| 695 |
% |
| 696 |
% \begin{macro}{\ExportArrayParams} |
| 697 |
% This macro is just a list of exportations of the lengths and |
| 698 |
% parameters defining the layout in \texttt{array} and |
| 699 |
% \texttt{tabular} environments. |
| 700 |
% \begin{macrocode} |
| 701 |
\newcommand{\ExportArrayParams}{% |
| 702 |
\PackageInfo{export}{\MessageBreak |
| 703 |
Exportation of the ArrayParams\MessageBreak}% |
| 704 |
\PreciseExportLength{arraycolsep} |
| 705 |
\PreciseExportLength{tabcolsep} |
| 706 |
\PreciseExportLength{arrayrulewidth} |
| 707 |
\PreciseExportLength{doublerulesep} |
| 708 |
\ExportParameter{arraystretch} |
| 709 |
\PackageInfo{export}{\MessageBreak |
| 710 |
End of exportation of the ArrayParams\MessageBreak}}% |
| 711 |
% \end{macrocode} |
| 712 |
% \end{macro} |
| 713 |
% \Finale |
| 714 |
% \end{document} |
| 715 |
\endinput |