% \iffalse meta-comment % %%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % file makecubictable.dtx % % % % Process the file % % makecubictable.ins % % with tex to get LaTeX % % style file and doc % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%% % % CVS revision Id % $Id: makecubictable.dtx,v 1.1.1.1 2000/04/26 07:22:48 peyre Exp $ % % This file is not a standard part of the LaTeX2e system % it is distributed without ANY WARRANTY of any kind % % \fi % % \def\fileversion{v1.0} % \def\filedate{1999/10/19} % \changes{v1.0}{1999/10/19}{Creation of the file} % % \MakeShortVerb{\"} % % \begin{abstract} % The output of the programs we use are given % as columns of an array. We use this package % to accumulate the rows befor compiling them. % \end{abstract} % % \tableofcontents % % \section{Introduction} % This file should be used with the % \texttt{amsart} class, to typeset files % obtained with one of the programs \texttt{constant} % or \texttt{try} % \par % Some of the macros are included for compatibilities % with older versions of the programs. % % As an example of the use of the package, % let us assume that you have two files % \texttt{TEST1.output} and \texttt{TEST2.output} % which contain respectively the first and second columns % and the first and third columns of a table % (See section \ref{subsect:example} for the exact content of % the files) % % Then the instructions % \begin{verbatim} % \createnewtable{TEST}{14} % \forTEST % \input TEST1.output % \input TEST2.output % \showTESTcolumns % \end{verbatim} % % yields % \createnewtable{TEST}{14} % \forTEST % \normalinput{TEST1.output} % \normalinput{TEST2.output} % \showTESTcolumns % % \section{The user interface} % % \DescribeMacro{\createnewtable} % The main command is "\createnewtable" it takes two % parameters, the first of which should be a sequence of letters % like |{TEST}| and the second a number like |{129}|. % The first is the name of the table, the second the number of rows. % Let us assume that the first parameter is indeed |TEST|, then % the macro creates four commands namely |\forTEST|, % |\FirstTESTcolumn|, |\addTESTcolumn| and |\showTESTcolumns|. % % \DescribeMacro{\forTEST} % This command initializes the lines of the table, setting them % to be empty. % % \DescribeMacro{\FirstTESTcolumn} % This command should be used for the first % column of the table. If repeated only the first % occurence is considered. It has as many parameters % as there are rows in the table. % % \DescribeMacro{\addTESTcolumn} % This macro append a column to the table. % It has as many parameters as there are rows in the table. % % \DescribeMacro{\showTESTcolumn} % This macro insert the table. % % \DescribeMacro{\tablename} % This is the name of the current table. % You should not use this directly except % for very special purposes. % % \DescribeMacro{\tablesize} % This is the number of rows of the current table. % You should not modify it directly. % % \DescribeEnv{info} % Depending on |\ifShowInfo| the set of tokens which are % enclosed between |\begin{info}| and |\end{info}| are % shown or hidden. However they are expanded, but % global definitions are disabled so that numbers % of equations, sections\dots are not increased. % % \section{The documentation} % \subsection{The driver file} % % First of all here is the code of the driver % file for the documentation. We begin with % the preamble. % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \usepackage{amsmath} \usepackage{doc} \usepackage{makecubictable} \EnableCrossrefs \CodelineIndex \RecordChanges \GetFileInfo{makecubictable.sty} % \end{macrocode} % We need a few notations, % \begin{macrocode} \DeclareMathOperator{\Det}{Det} \DeclareMathOperator{\Pic}{Pic} \DeclareMathOperator{\im}{Im} \DeclareMathOperator{\Spec}{Spec} \DeclareMathOperator{\Hom}{Hom} \DeclareMathOperator{\NS}{NS} \DeclareMathOperator{\Fr}{Fr} \DeclareMathOperator{\re}{Re} \DeclareMathOperator{\rk}{rk} \DeclareMathOperator{\Br}{Br} \DeclareMathOperator{\Gal}{Gal} \DeclareMathOperator{\Id}{Id} \DeclareMathOperator{\Inv}{inv} \renewcommand{\mod}{\mathrel{\text{\rm mod}}} % \end{macrocode} % nicer inequalities, % \begin{macrocode} \renewcommand{\leq}{\leqslant} \renewcommand{\geq}{\geqslant} % \end{macrocode} % better indices, % \begin{macrocode} \def\greeksubscript#1{{\mathchoice{}{}% {\lower.2ex\hbox{$\scriptstyle #1$}}% {\lower.4ex\hbox{$\scriptscriptstyle #1$}}}} % \end{macrocode} % and a few more notations. % \begin{macrocode} \newcommand{\Ceff}{\Lambda_{\text{\rm eff}}} \newcommand{\di}[1]{\mathrm d#1\,} \newcommand{\omegaH}{\boldsymbol\omega_\greeksubscript{\mathbf H}} \newcommand{\omegaHv}{\boldsymbol\omega_\greeksubscript{\mathbf H,v}} \newcommand{\omegaHp}{\boldsymbol \omega_\greeksubscript{\mathbf H,\frak p}} \newcommand{\thetaH}{\boldsymbol\theta_\greeksubscript{\mathbf H}} % \end{macrocode} % We need to input usual \TeX files. % \begin{macro}{\normalinput} % \begin{macrocode} \newcommand{\normalinput}[1]{\MakePercentComment\input{#1}\MakePercentIgnore} % \end{macrocode} % \end{macro} % Then comes the header of the driver file. % \begin{macrocode} \title{\filename} \date{\fileversion\space\filedate} \author{Emmanuel Peyre and Yuri Tschinkel} \begin{document} \maketitle % \end{macrocode} % We use the macros of babel for line numbers % within the sections % \begin{macrocode} \makeatletter \@addtoreset{CodelineNo}{section} \renewcommand\theCodelineNo{% \reset@font\scriptsize\thesection.\arabic{CodelineNo}} % \end{macrocode} % which should also be visible in the index; hence this % redefinition of a macro from \texttt{doc.sty}. % \begin{macrocode} \renewcommand\codeline@wrindex[1]{\if@filesw \immediate\write\@indexfile {\string\indexentry{#1}% {\filesep\number\c@section.\number\c@CodelineNo}}\fi} \renewcommand\special@index[1]{\if@filesw \immediate\write\@indexfile {\string\indexentry{#1}% {\filesep\number\c@section.\number\c@CodelineNo}}\fi} \makeatother % \end{macrocode} % Here comes the main part of the file. % \begin{macrocode} \DocInput{makecubictable.dtx} \PrintIndex \PrintChanges \end{document} % % \end{macrocode} % % Note that the index has to be compiled using the instructions % \begin{verbatim} % makeindex -s bbind.ist makecubictable % makeindex -s bbglo.ist -o makecubictable.gls makecubictable.glo % \end{verbatim} % where the files \texttt{bbind.ist} and \texttt{bbglo.ist} % are the index and glossary formats coming with \texttt{babel}. % % \subsection{The examples} % \label{subsect:example} % % We also generate the files \texttt{TEST1.output} % \begin{macrocode} %<*testone> \begin{info} \section{Information} This is a test file only. \end{info} \FirstTESTcolumn {\text{Surface}}% {H}% {n_\greeksubscript{U,\mathbf H}(H)}% {C_{\Br}}% {H^1(\mathbf Q,\Pic(\overline V))}% {\zeta^*_{\mathbf Q(q^{1/3})}(1)}% {\lambda'_3\omegaH(V(\mathbf Q_3))}% {\lambda'_q\omegaH(V(\mathbf Q_q))}% {C_1}% {C_2}% {C_3}% {\omegaH(V(\mathbf R))}% {\thetaH(V)}% {n_\greeksubscript{U,\mathbf H}(H)/\thetaH(V)H}% \addTESTcolumn {S_5}% {99999}% {205431}% {0.333333}% {3.000000}% {0.814624}% {1.333333}% {0.750000}% {0.954038}% {0.989387}% {0.830682}% {4.921515}% {2.086108}% {0.984767}% % % \end{macrocode} % and \texttt{TEST2.output}. % \begin{macrocode} %<*testtwo> \FirstTESTcolumn {\text{Surface}}% {H}% {n_\greeksubscript{U,\mathbf H}(H)}% {C_{\Br}}% {H^1(\mathbf Q,\Pic(\overline V))}% {\zeta^*_{\mathbf Q(q^{1/3})}(1)}% {\lambda'_3\omegaH(V(\mathbf Q_3))}% {\lambda'_q\omegaH(V(\mathbf Q_q))}% {C_1}% {C_2}% {C_3}% {\omegaH(V(\mathbf R))}% {\thetaH(V)}% {n_\greeksubscript{U,\mathbf H}(H)/\thetaH(V)H}% \addTESTcolumn {S_6}% {99999}% {115582}% {0.333333}% {3.000000}% {1.017615}% {0.888889}% {1.000000}% {0.976203}% {0.989279}% {0.306638}% {4.295619}% {1.191539}% {0.970032}% % % \end{macrocode} % \section{Definition of the macros} % \subsection{Identification part} % % First a few declarations about the file and the package. % \begin{macrocode} %<*dtx> \ProvidesFile{makecubictable.dtx} % %<*style> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{makecubictable}[1999/10/19 V1.0 table for output] % \end{macrocode} % % \subsection{Gathering} % % This is a dirty trick of Knuth to append new % instructions to a macro. % % \begin{macro}{\gaddtomacro} % \begin{macrocode} \newtoks\temporary \long\def\gaddtomacro#1#2{% \begingroup \temporary\expandafter{#1#2}% \xdef#1{\the\temporary} \endgroup} % \end{macrocode} % \end{macro} % % \subsection{Counters and variables} % % \begin{macro}{\linenumber} % This counter is increasing, giving the line to handle. % \begin{macrocode} \newcount\linenumber % \end{macrocode} % \end{macro} % \begin{macro}{\tobedone} % This counter is decreasing, giving % the number of lines remaining to be done. % \begin{macrocode} \newcount\tobedone % \end{macrocode} % \end{macro} % \begin{macro}{\tablesize} % Size of the current table, by default 1. % \begin{macrocode} \newcount\tablesize \tablesize 1 % \end{macrocode} % \end{macro} % \begin{macro}{\tablename} % Name of the current table, by default |default|. % \begin{macrocode} \def\tablename{default} % \end{macrocode} % \end{macro} % \begin{macro}{\thelinenumber} % Deduces the name of the line from its number. This limits % the size of the table in a stupid way, should be modified. % \begin{macrocode} \def\thelinenumber{\ifcase\linenumber zero\or one\or two\or three\or four\or five\or six\or seven\or eight\or nine\or ten\or eleven\or twelve\or thirteen\or fourteen\or fifteen\or sixteen\or seventeen\or eighteen\or nineteen\or twenty\or twentyone\or twentytwo\or twentythree\or twentyfour\or twentyfive\or twentysix\or twentyseven\or twentyeight\or twentynine\fi} % \end{macrocode} % \end{macro} % % \subsection{Elementary actions repeated} % % Now comes the elementary operations which shall % be repeated on the lines. % \begin{macro}{\clearone} % Clear the current line. % \begin{macrocode} \def\clearone{% \expandafter\def\csname\tablename\thelinenumber\endcsname{}% \advance\linenumber by 1} % \end{macrocode} % \end{macro} % \begin{macro}{\newone} % Append the parameter to the current line. % \begin{macrocode} \def\newone#1{% \expandafter\gaddtomacro\csname\tablename \thelinenumber\endcsname{#1}% \advance\linenumber by 1} % \end{macrocode} % \end{macro} % \begin{macro}{\expandone} % Execute one line. % \begin{macrocode} \def\expandone{\csname\tablename\thelinenumber\endcsname \global\advance\linenumber by 1} % \end{macrocode} % \end{macro} % Now we turn to the macros to repeat the actions. % \begin{macro}{\repeatgobble} % Do nothing except reading |\tobedone| arguments. % Used to make |\FirstTESTcolumn| obsolete. % \begin{macrocode} \def\repeatgobble#1{\advance\tobedone by -1 \ifnum\the\tobedone>0\def\mynext{\repeatgobble}\else \def\mynext{\relax}\fi\mynext} % \end{macrocode} % \end{macro} % \begin{macro}{\repeatclear} % Each of the following lines follow the same model. % We give them without more comments. In fact should be modified % and use only one macro. % \begin{macrocode} \def\repeatclear{\clearone\advance\tobedone by -1 \ifnum\the\tobedone>0\def\mynext{\repeatclear}\else \def\mynext{\relax}\fi\mynext} % \end{macrocode} % \end{macro} % \begin{macro}{\repeatnewone} % \begin{macrocode} \def\repeatnewone#1{\newone{#1}% \advance\tobedone by -1 \ifnum\the\tobedone>0\def\mynext{\repeatnewone}\else \def\mynext{\relax}\fi\mynext} % \end{macrocode} % \end{macro} % \begin{macro}{\repeatconstant} % Add the same tokens to each line. % \begin{macrocode} \def\repeatconstant#1{\newone{#1}% \advance\tobedone by -1 \ifnum\the\tobedone>0\def\mynext{\repeatconstant{#1}}\else \def\mynext{\relax}\fi\mynext} % \end{macrocode} % \end{macro} % \begin{macro}{\repeatexpandone} % \begin{macrocode} \def\repeatexpandone{\expandone \global\advance\tobedone by -1 \ifnum\the\tobedone>0% \def\mynext{\crcr\tablerule\repeatexpandone}\else \def\mynext{\crcr\tablerule}\fi\mynext} % \end{macrocode} % \end{macro} % \begin{macro}{\dogobble} % Init |\tobedone| and call |\repeatgobble|. % Again this is several times the same construction. % \begin{macrocode} \def\dogobble{\tobedone\tablesize \linenumber 1 \repeatgobble} % \end{macrocode} % \end{macro} % \begin{macro}{\doclear} % \begin{macrocode} \def\doclear{\tobedone\tablesize \linenumber 1 \repeatclear} % \end{macrocode} % \end{macro} % \begin{macro}{\doconstant} % \begin{macrocode} \def\doconstant#1{\tobedone\tablesize \linenumber 1 \repeatconstant{#1}} % \end{macrocode} % \end{macro} % \begin{macro}{\doaddcolumn} % \begin{macrocode} \def\doaddcolumn{\tobedone\tablesize \linenumber 1 \repeatnewone} % \end{macrocode} % \end{macro} % \begin{macro}{\docolumns} % \begin{macrocode} \def\docolumns{\global\tobedone\tablesize \global\linenumber 1 \repeatexpandone} % \end{macrocode} % \end{macro} % \begin{macro}{\doinit} % Init the table % \begin{macrocode} \def\doinit#1#2{\def\tablename{#1}% \tablesize#2 \doclear} % \end{macrocode} % \end{macro} % % \subsection{Defining the table} % \begin{macro}{\tablerule} % Insert a horizontal rule. % \begin{macrocode} \def\tablerule{\noalign{\hrule}} % \end{macrocode} % \end{macro} % \begin{macro}{\linebegin} % |\linebegin| is used instead of |&|. % \begin{macrocode} \def\linebegin{\global\def\intercolumn{\global\def\intercolumn{&}}} \newcommand{\bigstrut}{\vphantom{$\Bigl)$}} % \end{macrocode} % \end{macro} % \begin{macro}{\createnewtable} % Create everything. The instructions for the table % are defined thrice hence the |########|. % \begin{macrocode} \def\createnewtable#1#2{% \expandafter\def\csname for#1\endcsname{% \doinit{#1}{#2}% \doconstant{\linebegin} % \expandafter\def\csname add#1column\endcsname{% \def\tablename{#1}% \tablesize #2 \expandafter\def\csname First#1column\endcsname{% \def\tablename{#1}% \tablesize #2 \dogobble} \doconstant{\intercolumn} \doaddcolumn} % \expandafter\def\csname First#1column\endcsname{% \csname add#1column\endcsname} % \expandafter\def\csname show#1columns\endcsname{% \def\tablename{#1}% \tablesize #2 \[\hbox to\hsize{\hss\vbox{% \halign{\vrule\hskip1em\bigstrut $########$\hfil\hskip1em\vrule \tabskip=0pt% &&\hskip0.5em\bigstrut$########$\hfil \hskip0.5em\vrule\crcr\tablerule \docolumns }}\hss}\] }}} % \end{macrocode} % \end{macro} % \begin{macro}{\forHB} % \begin{macro}{\FirstHBcolumn} % \begin{macro}{\addHBcolumn} % \begin{macro}{\showHBcolumns} % \begin{macro}{\forCTKS} % \begin{macro}{\FirstCTKScolumn} % \begin{macro}{\addCTKScolumn} % \begin{macro}{\showCTKScolumns} % These instructions are defined for historical reasons. % Indeed they were given in the output in older version of \texttt{constant} % they correspond to tables of fourteen lines and seventeen respectively. % The now provide an example about the normal way to use the style. % \begin{macrocode} \createnewtable{HB}{14} \createnewtable{CTKS}{17} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \subsection{A forgettable environment} % % \begin{macro}{\trash} % if |\ifShowInfo| is false everything is dumped % in the trash box. % \begin{macrocode} \newbox\trash % \end{macrocode} % \end{macro} % \begin{macro}{\ifShowInfo} % \begin{macro}{\ShowInfotrue} % \begin{macro}{\ShowInfofalse} % By default the info is hidden, it is needed only in the earlier % stage. By the way these instructions can be nested. But they % should be improved in terms of memory. % \begin{macrocode} \newif\ifShowInfo \ShowInfofalse % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \begin{environment}{info} % We define |\global| to be empty which is a very dirty % trick to disable global change of counters. Anyway % wizards are not supposed to read this text. % \begin{macrocode} \newenvironment{info}{\ifShowInfo\def\next{}\else \def\next{\begingroup \def\global{}% \setbox\trash\vtop\bgroup}\fi\next}% {\ifShowInfo\else\egroup\endgroup\fi} % % \end{macrocode} % \end{environment} % \Finale \endinput