texlive[68020] Master/texmf-dist: numerica-tables (23aug23)
commits+karl at tug.org
commits+karl at tug.org
Wed Aug 23 00:46:09 CEST 2023
Revision: 68020
http://tug.org/svn/texlive?view=revision&revision=68020
Author: karl
Date: 2023-08-23 00:46:08 +0200 (Wed, 23 Aug 2023)
Log Message:
-----------
numerica-tables (23aug23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/numerica-tables/README.txt
trunk/Master/texmf-dist/doc/latex/numerica-tables/numerica-tables.pdf
trunk/Master/texmf-dist/doc/latex/numerica-tables/numerica-tables.tex
trunk/Master/texmf-dist/tex/latex/numerica-tables/numerica-tables.sty
Modified: trunk/Master/texmf-dist/doc/latex/numerica-tables/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/numerica-tables/README.txt 2023-08-22 22:45:59 UTC (rev 68019)
+++ trunk/Master/texmf-dist/doc/latex/numerica-tables/README.txt 2023-08-22 22:46:08 UTC (rev 68020)
@@ -9,13 +9,18 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-This is version 2.0.0 of numerica-tables (but the first stand-alone
-version). The packages numerica, booktabs, l3kernel, l3packages,
-amsmath and mathtools are required. numerica-tables allows the
-creation of possibly multi-column tables of mathematical function
-values in a wide variety of formats. See numerica-tables.pdf for
-details on how to use the package.
+numerica-tables allows the creation of possibly multi-column
+tables of mathematical function values in a wide variety of
+formats.
+Version 3.0.0 requires version 3 of numerica and the booktabs
+package. numerica must be loaded before numerica-tables.
+Version 3.0.0 of numerica-tables allows non-uniformly stepped
+row-variable values, and comma lists of numbers or expressions
+to serve as row variable values. Table entries can now also be
+presented in fraction form. See numerica-tables.pdf for details
+on how to use the package.
+
Manifest
%%%%%%%%
README.txt this document
Modified: trunk/Master/texmf-dist/doc/latex/numerica-tables/numerica-tables.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/numerica-tables/numerica-tables.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/numerica-tables/numerica-tables.tex 2023-08-22 22:45:59 UTC (rev 68019)
+++ trunk/Master/texmf-dist/doc/latex/numerica-tables/numerica-tables.tex 2023-08-22 22:46:08 UTC (rev 68020)
@@ -1,4 +1,4 @@
-%% LyX 2.4.0-alpha3 created this file. For more info, see https://www.lyx.org/.
+%% LyX 2.4.0-beta3-devel created this file. For more info, see https://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,tableposition=top]{report}
\usepackage{lmodern}
@@ -13,13 +13,12 @@
\definecolor{shadecolor}{rgb}{0.667969, 1, 1}
\usepackage{babel}
\usepackage{array}
-\usepackage{float}
\usepackage{booktabs}
\usepackage{framed}
\usepackage{url}
\usepackage{multirow}
\usepackage{amsmath}
-\usepackage[unicode=true,pdfusetitle,
+\usepackage[pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
breaklinks=false,pdfborder={0 0 1},backref=section,colorlinks=true]
{hyperref}
@@ -32,7 +31,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\newenvironment{centred}%
- {\begin{center}\baselineskip=13pt\parskip=1pt}{\end{center}}
+ {\begin{center}}{\end{center}}
\newenvironment{lyxcode}
{\par\begin{list}{}{
\setlength{\rightmargin}{\leftmargin}
@@ -45,6 +44,7 @@
{\end{list}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
+\usepackage{numerica}
\usepackage{numerica-tables}
\usepackage{numerica-plus}
\newcommand\rel{\,\varrho\;}
@@ -51,7 +51,7 @@
\DeclareMathOperator{\erf}{erf}
\DeclareMathOperator{\gd}{gd}
\usepackage{upquote}
-
+\usepackage{xfrac}
\reuse{}
\makeatother
@@ -58,96 +58,101 @@
\begin{document}
\title{\texttt{numerica-tables}~\\
-}
+{\large version 3.0.0}}
\author{Andrew Parsloe\\
(\url{ajparsloe at gmail.com})}
\maketitle
\begin{abstract}
-The \verb`numerica-tables` package defines a command which enables
-the creation of (possibly multi-column) mathematical tables of function
-values. \emph{Key=value} settings allow presentation in a wide variety
-of table styles within the `formal table' framework of the \texttt{booktabs}
-package. \\
-\\
+The \texttt{numerica-tables} package defines a command \verb`\nmcTabulate`
+which enables the creation of multi-column tables of mathematical
+function values. Key\textendash value assignments allow presentation
+in a wide variety of table styles within the `formal table' framework
+of the \texttt{booktabs} package. \texttt{numerica-tables} requires
+the \texttt{numerica} package to be loaded.\medskip{}
+\end{abstract}
+\noindent{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%
-
-\paragraph*{Note:}
\begin{itemize}
-\item {\normalsize This document applies to version 2.0.0 of }{\normalsize\texttt{numerica-tables}}{\normalsize .}{\small\par}
-\item {\normalsize A version of }{\normalsize\texttt{numerica}}{\normalsize{}
-from or later than 2021/12/07 is required; (}{\normalsize\texttt{numerica}}{\normalsize{}
-requires }{\normalsize\texttt{amsmath}}{\normalsize , }{\normalsize\texttt{mathtools}}{\normalsize{}
-and the \LaTeX 3 bundles }{\normalsize\texttt{l3kernel}}{\normalsize{}
-and }{\normalsize\texttt{l3packages}}{\normalsize ).}{\small\par}
-\item {\normalsize The }{\normalsize\texttt{booktabs}}{\normalsize{} package
-is required.}{\small\par}
-\item {\normalsize I refer many times in this document to }{\normalsize\emph{Handbook
-of Mathematical Functions}}{\normalsize , edited by Milton Abramowitz
-and Irene A. Segun, Dover, 1965. This is abbreviated to }{\normalsize\emph{HMF}}{\normalsize ,
-often followed by a reference to a specific table like Table 1.2.}{\small\par}
-\item {\normalsize Version 2 of }{\normalsize\texttt{numerica-tables}}{\small\par}
+\item This document applies to version 3.0.0 of \texttt{numerica-tables}.
+\item Version 3 of \texttt{numerica} needs to be loaded before \texttt{numerica-tables};
+(\texttt{numerica} requires \texttt{amsmath}, \texttt{mathtools} and
+a reasonably recent \LaTeX{} system).
+\item The \texttt{booktabs} package is required.
+\item I refer many times in this document to \emph{Handbook of Mathematical
+Functions}, edited by Milton Abramowitz and Irene A. Stegun, Dover,
+1965, abbreviated to \emph{HMF}, and often followed by a reference,
+like Table 1.2, to a specific table.
+\item Version 3.0.0 of \texttt{numerica-tables}
\begin{itemize}
-\item {\normalsize is the first stand-alone version (in v.1 of }{\normalsize\texttt{numerica}}{\normalsize{}
-the }{\normalsize\texttt{\textbackslash nmcTabulate}}{\normalsize{}
-command was available with the }{\normalsize\texttt{tables}}{\normalsize{}
-package option);}{\small\par}
-\item {\normalsize restricts the third item in }{\normalsize\texttt{rspec}}{\normalsize{}
-to }{\normalsize\texttt{rows}}{\normalsize{} only (}{\normalsize\texttt{rstop}}{\normalsize{}
-is no longer accepted there);}{\small\par}
-\item {\normalsize restricts the third item in }{\normalsize\texttt{cspec}}{\normalsize{}
-to }{\normalsize\texttt{cols}}{\normalsize{} only (}{\normalsize\texttt{cstop}}{\normalsize{}
-is no longer accepted there);}{\small\par}
-\item {\normalsize allows an additional row, if wanted, between table title
-and the column header row;}{\small\par}
-\item {\normalsize removes the }{\normalsize\texttt{DEL}}{\normalsize{} column
-function;}{\small\par}
-\item {\normalsize amends documentation.}{\small\par}
+\item adds the ability to use numbers or expressions from
+\begin{itemize}
+\item a comma list for row-variable values, either as values or verbatim;
+\item a macro containing a comma list for row-variable values, either as
+values or verbatim;
+\item a file for row-variable values, either as values or verbatim;
\end{itemize}
+\item adds the ability to use functions of a stepped variable to generate
+varyingly stepped row-variable values;
+\item adds the ability to suppress the header row;
+\item is compatible with the additional features of \texttt{numerica} version
+3.0.0,
+\begin{itemize}
+\item including the decimal comma if the \verb`comma` package option is
+used with \texttt{numerica}; and
+\item fraction-form row variables, or fraction-form output if the \verb`/`
+or \verb`//` `triggers' are used in the number-format option;
\end{itemize}
+\item amends and adds to documentation.
+\end{itemize}
+\end{itemize}
\end{shaded}%
\end{minipage}
\tableofcontents{}
-\end{abstract}
\chapter{Introduction}
Entering
-\begin{lyxcode}
-~\textbackslash usepackage\{numerica-tables\}
-\end{lyxcode}
+\begin{verbatim}
+ \usepackage[<options>]{numerica}
+ \usepackage{numerica-tables}
+\end{verbatim}
\noindent in the preamble of a document gives access to a command
-\verb`\nmcTabulate` for creating tables of function values in a wide
-variety of styles. (Since \verb`numerica-tables` requires \textendash{}
-and loads \textendash{} the \verb`numerica` package, all commands
-of that package are also available.) All tables are `formal tables'
-in the sense of the \texttt{booktabs} package, which is loaded automatically.
-Such tables have no vertical rules and few horizontal rules.
+for creating tables of function values in a wide variety of styles.
+Contrary to previous practice, for version 3.0.0 of \texttt{numerica-tables},
+the \texttt{numerica} package is not loaded automatically but must
+be loaded explicitly (as above), with options if desired, \emph{before}
+\texttt{numerica-tables}. It is \emph{essential} that the version
+of \texttt{numerica} loaded is version 3.
+All tables are `formal tables' in the sense of the \texttt{booktabs}
+package, which is loaded automatically. Such tables have no vertical
+rules and few horizontal rules.
+
\section{Table structure}
I take as my source of models of mathematical tables those presented
in \emph{Handbook of Mathematical Functions}, edited by Milton Abramowitz
-and Irene A. Segun, Dover, 1965, not because the typesetting is elegant
+and Irene A. Stegun, Dover, 1965, not because the typesetting is elegant
(it often isn't) but because \emph{HMF} displays a wide variety of
table styles. The editors of that volume were faced with a host of
different problems requiring a host of different solutions. The \verb`\nmcTabulate`
-command aims to reproduce most of those different solutions, within
-\verb`booktabs` elegance.
+command of \texttt{numerica-tables} aims to reproduce most of those
+different solutions, within \verb`booktabs` elegance.
-To create a table we need to specify a function to tabulate. The values
-this function takes will generally depend on a primary parameter and,
-possibly, a number of secondary parameters (which is where much of
-the complexity comes from). Mathematical tables are structured in
-\emph{columns}. We (nearly always) read \emph{down} a column as the
-primary parameter is incremented, generally in regular steps. We need
-to decide on the range of values the primary parameter will take and
-how fine-grained the tabulation will be \textendash{} what the step
-size of its increments will be. Assigning different values to a second
-parameter generates a second, third,\ldots{} column. Sometimes rather
-than a second parameter, a second, third, \ldots{} function of the
-first parameter is tabulated in the successive columns.
+To create a table we need to specify a function or functions to tabulate.
+The values a function takes will generally depend on a primary parameter
+and, possibly, a number of secondary parameters (which is where much
+of the complexity comes from). Mathematical tables are structured
+in \emph{columns}. We (nearly always) read \emph{down} a column as
+the primary parameter is incremented, generally in regular steps.
+We need to decide on the range of values the primary parameter will
+take and how fine-grained the tabulation will be \textendash{} what
+the step size of its increments will be. Assigning different values
+to a second parameter generates a second, third,\ldots{} column. Sometimes
+rather than a second parameter, a second, third, \ldots{} function
+of the first parameter is tabulated in the successive columns.
In this document the first parameter is called the \emph{row variable}
\textendash{} its value determines which row we are in; the second
@@ -169,84 +174,56 @@
The \verb`\nmcTabulate` command (short-name form \verb`\tabulate`)
shares the syntax of \verb`\nmcEvaluate` (see \texttt{numerica.pdf}).
When all options are used the command looks like
-\begin{lyxcode}
-\noindent \textbackslash nmcTabulate{*}{[}settings{]}\{expr.\}{[}vv-list{]}{[}num.~format{]}
-\end{lyxcode}
+\begin{verbatim}
+ \nmcTabulate*[settings]{expr.}[vv-list][num. format]
+\end{verbatim}
+\selectlanguage{english}%
\begin{enumerate}
\item \verb`*` optional switch; if present ensures a single number output
with no formatting, or an appropriate error message if the single
number cannot be produced; see \xA7\ref{sec:Star-option};
-\item \verb`[settings]` comma-separated list of \emph{key=value }settings,
-at the heart of creating a table of function values; see Chapter~\ref{chap:=00005CnmcTabulate-settings};
+\item \verb`[settings]` comma-separated list of \emph{key=value }settings;
+this option is at the heart of creating a table of function values;
+see Chapter~\ref{chap:=00005CnmcTabulate-settings};
\item \verb`{expr.}` mandatory argument specifying the mathematical expression
or expressions in \LaTeX{} form to be tabulated;
-\item \verb`[vv-list]` comma-separated list of \emph{variable=value }items,
-in particular containing the initial value of the row variable (and
-column variable if one is used);
+\item \verb`[vv-list]` comma-separated list (or semicolon-sepaprated list
+if the \verb`comma` package option is used with \texttt{numerica})
+of \emph{variable=value }items, in particular containing the initial
+value of the row variable, and column variable if one is used;
\item \verb`[num. format]` optional format specification for presentation
of the numerical results (rounding, padding with zeros, scientific
-notation); see \xA7\ref{subsec:Trailing-optional-argument}.
+notation, fraction-form output); see \xA7\ref{subsec:Trailing-optional-argument}.
\end{enumerate}
-Unlike \verb`\nmcEvaluate` (from\texttt{ }{\ttfamily\verb`numerica`}\texttt{)},
-for \verb`\nmcTabulate`
-\begin{itemize}
-\item math delimiters are irrelevant \textendash{} it makes no difference
-to the display of the result whether the command wraps around math
-delimiters, is wrapped within math delimters, or if there are no math
-delimiters involved whatever;
-\item the two apparently optional arguments straddling the main argument
-(\verb`settings` and \verb`vv-list`) are \emph{essential}. Although
-both are delimited by square brackets, that is in order to draw on
-the code from {\ttfamily\verb`numerica`} for \verb`\nmcEvaluate`.
-Each argument contains items \emph{necessary} for the construction
-of any table of function values.
-\end{itemize}
+Unlike \verb`\nmcEvaluate` (the main command in\texttt{ numerica}),
+for \verb`\nmcTabulate` the two apparently optional arguments straddling
+the main argument (\verb`settings` and \verb`vv-list`) are \emph{essential}.
+Although both are delimited by square brackets, that is in order to
+draw on the {\ttfamily\verb`numerica`} code. Each argument
+contains items \emph{necessary} for the construction of any table
+of function values.
-\subsection{Settings inherited from \texttt{numerica}}
+Should \texttt{numerica} be loaded with the \verb`comma` package
+option, numbers in tables will be displayed with a decimal comma.
+In this case items in the vv-list \emph{must} be separated by a semicolon
+since the decimal comma is likely to feature there. Similarly, $n$-ary
+functions \textendash{} \verb`\max`, \verb`\min` and \verb`\gcd`
+\textendash{} must use the semicolon as their argument separator.
-\label{subsec:Inherited-settings}
+Math environments are significant for \verb`\nmcEvaluate`. They are
+essentially irrelevant for \verb`\nmcTabulate`, although an external
+environment may determine how a table is positioned on the page (\verb`\[ <table> \]`
+for instance will centre the table between the margins). Environments
+specified in the main argument (the formula) should be avoided. \verb`$ $`,
+\verb`\( \)` or \verb`\[ \]` will not cause error, but a \verb`\begin`\textendash \verb`\end`
+environment there will.
-Most of the settings available to the command \verb`\nmcEvaluate`
-from \verb`numerica` are also available to \verb`\nmcTabulate`.
-To save switching between documents I reproduce the table of relevant
-options found in \verb`numerica.pdf` (only the punctuation \verb`p`
-setting is missing), although for discussion of the options you will
-need to refer to that document. (Note that the setting \verb`vvmode`
-of v.1 of \verb`numerica` is still available; it is equivalent to
-the \verb`vv@` setting.) The \verb`dbg` (and \verb`view`) keys
-have been disabled for \verb`\nmcTabulate` at present (but might
-be enabled in the future).
+Just as the syntax is shared, so the settings available to the command
+\verb`\nmcEvaluate` in \texttt{numerica} are also available to \verb`\nmcTabulate`,
+although not all will be relevant. See the associated document \texttt{numerica.pdf}
+for a list of these and associated discussion. I will point out instances
+of their use in the following examples.
-\begin{table}[h]
-\noindent \centering{}\caption{\protect\label{tab:introSettingsInherited}Settings options inherited
-from \texttt{\textbackslash nmcEvaluate}}
-\noindent \begin{center}
-\begin{tabular}{ll>{\raggedright}p{4cm}>{\raggedright}p{4cm}}
-\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
-\midrule
-{\small\texttt{dbg}} & {\small int} & {\small debug `magic' integer} & {\small\texttt{0}}\tabularnewline
-{\small\texttt{view}} & & {\small equivalent to }{\small\texttt{dbg=1}} & \tabularnewline
-{\small\texttt{\textasciicircum}} & {\small char} & {\small exponent mark for sci. notation input} & {\small\texttt{e}}\tabularnewline
-{\small\texttt{xx}} & {\small int (}{\small\texttt{0}}{\small /}{\small\texttt{1}}{\small )} & {\small multi-token variable switch} & {\small\texttt{1}}\tabularnewline
-{\small\texttt{()}} & {\small int (}{\small\texttt{0}}{\small /}{\small\texttt{1}}{\small /}{\small\texttt{2}}{\small )} & {\small trig. function arg. parsing} & {\small\texttt{0}}\tabularnewline
-{\small\texttt{o}} & & {\small degree switch for trig. functions} & \tabularnewline
-{\small\texttt{log}} & {\small num} & {\small base of logarithms for }{\small{\small\verb`\log`}} & {\small\texttt{10}}\tabularnewline
-{\small\texttt{vv@}} & {\small int (0/1)} & {\small vv-list calculation mode} & {\small\texttt{0}}\tabularnewline
-{\small\texttt{vvd}} & {\small tokens} & {\small vv-list display-style spec.} & {\small\texttt{\{,\}\textbackslash mskip 12mu plus 6mu minus 9mu(vv)}}\tabularnewline
-{\small\texttt{vvi}} & {\small tokens} & {\small vv-list text-style spec.} & {\small\texttt{\{,\}\textbackslash mskip 36mu minus 24mu(vv)}}\tabularnewline
-{*} & & {\small suppress equation numbering if }{\small\texttt{\textbackslash\textbackslash}}{\small{}
-in }{\small\texttt{vvd}} & \tabularnewline
-{\small\texttt{S+}} & {\small int} & {\small extra rounding for stopping criterion for sums} & {\small\texttt{2}}\tabularnewline
-{\small\texttt{S?}} & {\small$\text{int}\ge0$} & {\small stopping criterion query terms for sums} & {\small\texttt{0}}\tabularnewline
-{\small\texttt{P+}} & {\small int} & {\small extra rounding for stopping criterion for products} & {\small\texttt{2}}\tabularnewline
-{\small\texttt{P?}} & {\small$\text{int}\ge0$} & {\small stopping criterion query terms for products} & {\small\texttt{0}}\tabularnewline
-\bottomrule
-\end{tabular}
-\par\end{center}
-\end{table}
-
-
\chapter{\texttt{\textbackslash nmcTabulate} settings}
\label{chap:=00005CnmcTabulate-settings}In addition to the shared
@@ -260,6 +237,10 @@
\section{Row-variable settings}
\label{sec:Row-variable-settings}
+
+\subsection{Row-variable specification: uniform case}
+
+\label{subsec:Row-var-spec-uniform}
\begin{table}[b]
\centering{}\caption{Row-variable specification}
\begin{center}
@@ -267,9 +248,9 @@
\toprule
{\small key} & {\small type} & {\small meaning} & {\small comment}\tabularnewline
\midrule
-{\small\texttt{rvar}} & {\small token(s)} & {\small row-variable} & \tabularnewline
+{\small\texttt{rvar}} & {\small token(s)} & {\small row variable} & \tabularnewline
{\small\texttt{rstep}} & {\small real num.} & {\small step size} & \tabularnewline
-{\small\texttt{rstop}} & {\small real num.} & {\small stop value} & \multirow{2}{3cm}{use only one of {\small\texttt{rstop}}{\small{} or }{\small\texttt{rows}}}\tabularnewline
+{\small\texttt{rstop}} & {\small real num.} & {\small stop value} & \multirow{2}{3cm}{{\small use only one of rstop or rows}}\tabularnewline
{\small\texttt{rows}} & {\small int} & {\small number of rows} & \tabularnewline
{\small\texttt{rspec}} & {\small comma list} & {\small\texttt{\{rvar}}{\small , }{\small\texttt{step}}{\small , }{\small\texttt{rows\}}} & {\small short form spec.}\tabularnewline
\bottomrule
@@ -279,11 +260,17 @@
Deciding on a function to tabulate (entered in the main or mandatory
argument of \verb`\nmcTabulate`) will inevitably also mean deciding
on the tabulation variable, the \emph{row} variable, \verb`rvar`,
-what value to start tabulating from (which is specified in the vv-list),
-what value to tabulate to, \verb`rstop`, and how fine-grained the
-tabulation is to be, the step size \verb`rstep`.
+what value to start tabulating from \textendash{} \emph{that} is specified
+in the vv-list and so does not need a specific key \textendash{} what
+value to tabulate to, \verb`rstop`, and how fine-grained the tabulation
+is to be, the step size \verb`rstep`. In the uniform case (which
+makes up the overwhelming majority of cases in \emph{HMF} for instance)
+the step size is constant. It does not change as the value of the
+row variable changes. (The non-uniform case, available from version
+3.0.0 of \texttt{numerica-tables}, is discussed in \xA7\ref{subsec:Row-var-spec-nonuniform}
+below. Quite different keys are required.)
-The two tables in the first example below tabulate $\sin x$ and $\cos x$
+The two tables in the example below tabulate $\sin x$ and $\cos x$
between $0$ and $1$ in increments of $0.2$. Note that the start
value of the tabulation variable is entered in the vv-list. The reason
for placing it there is that for more complicated functions other
@@ -294,17 +281,22 @@
it \textendash{} lie to the right of it \textendash{} in the list.
In the vv-list, the start value of the row variable may be a \LaTeX{}
-expression. Both \verb`rstep` and \verb`rstop` can also be \LaTeX{}
-expressions. However, they are evaluated \emph{after} the vv-list
-is evaluated and so may depend on the values of variables in the vv-list,
-including the initial value of the row variable.
+expression. Both \verb`rstep` and \verb`rstop` may also be \LaTeX{}
+expressions. They are evaluated \emph{after} the vv-list is evaluated
+and so may depend on the values of variables in the vv-list, including
+the \emph{initial} value of the row variable. Thus setting \verb`rstep=1/x`,
+where \verb`x` is the row variable, will give a \emph{constant} step
+size equal to the reciprocal of the \emph{initial }value of the row
+variable.
-The difference in appearance of the two tables below results from
-padding with zeros in the second (the asterisk in the trailing optional
-argument has the same effect in \verb`\nmcTabulate` as in \verb`\nmcEvaluate`).
+The difference in appearance of the two tables results from padding
+with zeros in the second (the asterisk in the trailing optional argument
+has the same effect in \verb`\nmcTabulate` as in \verb`\nmcEvaluate`).
As you can see, padding applies not only to the values of the function
-but also to the values of the row variable \textendash{} and makes
-an obvious improvement to the table's appearance.
+but also to the values of the row variable, although that has been
+padded to only $1$ decimal place rather than the $6$ of the function
+values. Padding makes an obvious improvement to the appearance. (How
+many digits to pad to in the row variable column is discussed in \xA7\ref{subsec:Row-var-col-formatting}.)
\begin{verbatim}
\tabulate[rvar=x,rstep=0.2,rstop=1]
{ \sin x }[x=0]\qquad
@@ -317,21 +309,21 @@
{ \cos x }[x=0][*]\medskip{}
Sometimes (perhaps often) it may prove more convenient to specify
-the number of rows, \verb`rows`, explicitly rather than a stop value.
+the number of rows, \verb`rows`, to tabulate rather than a stop value.
Only one of \verb`rows` and \verb`rstop` should be given, but if
both (inadvertently) are present, it is the value of \verb`rows`
that prevails. The first of the following three tables shows an example
-of use.
+where \verb`rows` is specified.
The second and third tables use an abbreviated form of the row-variable
specification, \verb`rspec`. This is a three-element comma list,
\verb`{rvar,rstep,rows}`. The second table gives a straightforward
-example of use. In the third table a \LaTeX{} expression has been inserted
+example. In the third table a \LaTeX{} expression has been inserted
for \verb`rows` in the \verb`rspec` comma list. Like \verb`rstep`
and \verb`rstop`, \verb`rows` can be a \LaTeX{} expression, but it
is evaluated \emph{before} the vv-list and therefore, unlike \verb`rstep`
and \verb`rstop`, cannot depend on quantites specified there like
-the row variable.
+the initial row variable value.
\begin{verbatim}
\tabulate[rvar=x,rstep=0.2,rows=6]
{ \sin x/\cos x }[x=0][*] \qquad
@@ -347,19 +339,174 @@
\tabulate[rspec={x,0.2,1+(1/0.2)}]
{ \sqrt{\sec^2 x - 1} }[x=0][*]\medskip{}
-\noindent\begin{minipage}[t]{1\columnwidth}%
-\begin{shaded}%
-In version 1 of \verb`numerica` (when \verb`\nmcTabulate` became
-available with the package option \verb`tables`), the third item
-in \verb`rspec` was not restricted to \verb`rows` but could also
-be \verb`rstop`; parentheses placed around the third item assigned
-it to \verb`rows` rather than \verb`rstop`. On reflection, this
-now seems obscure and open to error. In v.2 of \verb`numerica-tables`
-(in fact its first version as a separate package) the third item of
-\verb`rspec` is restricted to \verb`rows` only, which no longer
-needs to be parenthesized.\end{shaded}%
-\end{minipage}
+\subsection{Row variable specification: non-uniform case}
+
+\label{subsec:Row-var-spec-nonuniform}
+\begin{table}[b]
+\centering{}\caption{Non-uniform row-variable specification}
+\begin{center}
+\begin{tabular}{ll>{\raggedright}p{4cm}>{\raggedright}p{3cm}}
+\toprule
+{\small key} & {\small type} & {\small meaning} & {\small comment}\tabularnewline
+\midrule
+{\small\texttt{rdata}} & {\small comma list} & {\small list of row-var. values } & {\small comma list may be stored in a macro}\tabularnewline
+{\small\texttt{rfile}} & {\small chars} & {\small filepath/name} & {\small file of comma separated values}\tabularnewline
+{\small\texttt{rverb}} & {\small int (}{\small\texttt{0}}/\texttt{1}) & {\small display }{\small\texttt{rdata }}{\small or}{\small\texttt{ rfile}}{\small{}
+values verbatim} & {\small initialized to }{\small\texttt{0}}\tabularnewline
+{\small\texttt{rfunc}} & {\small token(s)} & {\small function of a stepped variable} & \tabularnewline
+\bottomrule
+\end{tabular}
+\par\end{center}
+\end{table}
+Occasionally one wants to form a table in which the row variable does
+not increase or decrease in regular steps; for examples, see \emph{HMF}
+Tables 1.1 and 3.1. (Tables 9.7, 10.5, 10.10 use two step values and
+could also be handled with these settings.) For instance, one might
+want a table of values of simple functions of a list of constants,
+or a table of function values at $\pi$, $\pi/2$, $\pi/3$, $\pi/4$,
+$\dots$, or at $1$, $10$, $100$, $1000$, $\dots$, or a table
+of function values at thoroughly irregular, perhaps experimentally
+determined, values.
+
+\texttt{numerica-tables} provides two means of specifying such row
+variables, either by means of a row-variable function (\verb`rfunc`),
+when the row-variable values change in a non-uniform but formulaic
+way, or by explicitly listing the row-variable values in a comma list
+(\verb`rdata`, \verb`rfile`). In this latter case, a setting \verb`rverb`
+enables the row-variable column to be displayed either as a sequence
+of \emph{values} or verbatim as a sequence of \emph{expressions} \textendash{}
+like fractions of $\pi$.
+
+\subsubsection{\texttt{rfunc}}
+
+Suppose \textendash{} perhaps with an interest in the distribution
+of prime numbers \textendash{} that we want to create a small table
+of values of $n/\ln n$ for, say, $n=10$, $100$, 1000, $10000$,
+$\ldots$ The prospective row variable $n$ is not increasing in constant
+steps, although clearly in a regular manner. We handle such cases
+with the \verb`rfunc` setting; in the present instance \verb`rfunc=10^n`
+where now \verb`n` does increment by a constant amount:
+\begin{verbatim}
+ \tabulate[rpos=1,rfunc=10^n,rvar=n,rstep=1,
+ rows=7,rround=0]
+ { n/\ln n }[n=1][0]
+\end{verbatim}
+$\Longrightarrow$ \tabulate[rpos=1,rfunc=10^n,rvar=n,rstep=1,
+ rows=7,rround=0]
+ { n/\ln n }[n=1][0]\medskip{}
+
+The variable \verb`n` has two different meanings here. Initially
+it is the variable of a simple step function incrementing by $1$
+at each step. The function takes values \verb`10^n`. Once the table
+is compiled however \verb`n` is used to denote these successive function
+values, $10,100,\ldots,10000000$. To the \emph{reader} of the table,
+only this latter meaning is evident. Yes, it would be possible to
+add further keys to specify a distinct step function variable and
+its start, step and stop values, but the list of keys to specify a
+table is already large. The `double usage' implemented, perhaps
+confusing initially, economizes on keys and is invisible to the reader
+of the table. The initial value \verb`n=1` in the vv-list applies
+to the row-variable function \verb`10^n`, not to the function being
+tabulated (so the error-producing expression \verb`1/\ln 1` does
+not arise).
+
+\subsubsection{\texttt{rdata}, \texttt{rfile}, \texttt{rverb}}
+
+\label{subsec:rdata-rfile-rverb}One source of difficulty in reading
+the previous table is working out just how many zeros there are in
+the larger numbers in the left column. It would be more readable `at
+a glance' if we could write those in scientific notation. To do that
+we use the \verb`rdata` and \verb`rverb` keys. In the first of the
+examples below, \verb`rverb` is absent (corresponding to the default
+\verb`rverb=0`); in the second \verb`rverb=1`, the effect of which
+is to use verbatim the row-variable values provided in the \verb`rdata`
+comma list:
+\begin{verbatim}
+ \tabulate[rdata={10,100,1000,10^4,10^5,10^6,10^7},
+ rvar=n,rround=0,ralign=l]
+ { n/\ln n }[0]\qquad
+ \tabulate[rdata={10,100,1000,10^4,10^5,10^6,10^7},
+ rverb=1,rvar=n,rround=0,ralign=l]
+ { n/\ln n }[0]
+\end{verbatim}
+$\Longrightarrow$ \tabulate[rdata={10,100,1000,10^4,10^5,10^6,10^7},
+ rvar=n,rround=0]
+ { n/\ln n }[0]\qquad
+ \tabulate[rdata={10,100,1000,10^4,10^5,10^6,10^7},
+ rverb=1,rvar=n,rround=0]
+ { n/\ln n }[0]\medskip{}
+
+\verb`rverb` is particularly useful if you want to make a table of
+simple functions of constants. In the following example, with its
+initial setting (\verb`rverb=0`), the constants would be listed in
+the first column as numbers and repeated in the second column (perhaps
+to a different number of decimal places), which would all be rather
+pointless. With \verb`rverb=1`, the constants are listed verbatim
+in the first column against their numerical values in the second.
+In the example, the data has been stored in macros, \verb`\mydatai`
+and \verb`\mydataii`, prior to calling the \verb`\tabulate` command.
+\verb`\mydataii` uses the \verb`\sfrac` command from the \texttt{xfrac}
+package. By setting \verb`rdata` equal to these macros, the \verb`\tabulate`
+command gains access to the values stored in them.
+\begin{verbatim}
+ \def\mydatai{\tfrac12\pi,\tfrac13\pi,\tfrac23\pi,
+ \tfrac14\pi,\tfrac34\pi}
+ \renewcommand\arraystretch{1.2}
+ \tabulate[rdata=\mydatai,rverb=1,rvar=k,header=0]
+ { k }[6*]
+ \renewcommand\arraystretch{1} \qquad
+ \def\mydataii{\sfrac\pi2,\sfrac\pi3,\sfrac{2\pi}3,
+ \sfrac\pi4,\sfrac{3\pi}4}
+ \tabulate[rdata=\mydataii,rverb=1,rvar=k,header=0]
+ { k }[6*]
+\end{verbatim}
+$\Longrightarrow$ \renewcommand\arraystretch{1.2}
+ \def\mydatai{\tfrac12\pi,\tfrac13\pi,
+ \tfrac23\pi,\tfrac14\pi,\tfrac34\pi}
+ \tabulate[rdata=\mydatai,rverb=1,rvar=k,header=0 ]
+ { k }[6*]
+ \renewcommand\arraystretch{1} \qquad
+ \def\mydataii{\sfrac\pi2,\sfrac\pi3,
+ \sfrac{2\pi}3,\sfrac\pi4,\sfrac{3\pi}4}
+ \tabulate[rdata=\mydataii,rverb=1,rvar=k,header=0]
+ { k }[6*]\medskip{}
+
+The setting \verb`header=0` (see \xA7\ref{subsec:Header-row-suppress})
+means the tables have no header row. To accommodate the tower of \verb`\tfrac`-s
+in the first column of the first table, \verb`\arraystretch` has
+been used to add more space between the rows (and re-set afterwards).
+Through the virtues of \verb`\sfrac` it is unnecessary in the second
+table which is neater and more readable to my eye. But even better
+is the example at \xA7\ref{subsec:rfracFraction-form-rvar}.
+
+Note that the row variable can be chosen arbitrarily \textendash{}
+I earlier used \verb`n` and have used \verb`k` here but it could
+be anything. Nor does the function tabulated need to be the identity
+\textendash{} see the earlier $n/\ln n$ example or a later example
+in a multi-column setting in \xA7\ref{subsec:Headerstyle:-multi-column-case}.
+The identity function was appropriate for tables showing the decimal
+values of symbolic constants, as was the \verb`rverb=1` setting.
+The \verb`rverb` setting applies \emph{only} to the \verb`rdata`
+and \verb`rfile` keys. It has no effect otherwise.
+
+In addition to a comma list or macro, data for the row variable can
+also be stored in a file of comma-separated values \textendash{} say
+\verb`mydata.txt`. If \verb`mydata.txt` is placed in the directory
+of the current document and \verb`rfile=mydata.txt` entered in the
+settings option of the \verb`\tabulate` command, the file will be
+found and the values used for the row variable. Alternatively, the
+file could be placed in your \verb`texmf` tree and your \TeX{} distro
+alerted to its presence (by refreshing the filename database). Again
+\verb`rfile=mydata.txt` in the settings option will ensure the file
+is found and the contents used for the row-variable values. Or, the
+file could be stored elsewhere and the \verb`rfile` key equated to
+the full path and filename \textendash{} something like \verb`rfile=e:/mydocs/mydatafiles/mydata.txt`.
+This ensures the file will be found and the contents used for the
+row variable values. Note that even in Windows systems (where file
+paths use backslashes) the path requires that forward slashes only
+be used.
+
\subsection{Row-variable column formatting}
\label{subsec:Row-var-col-formatting}The padding option ({*}) of
@@ -370,13 +517,13 @@
column be at the left of the table, or the right \textendash{} or
both? These and related questions are answered by assigning values
to the keys listed in Table~\ref{tab:Formatting-the-row-variable}.
-\begin{table}[H]
+\begin{table}[tb]
\centering{}\caption{\protect\label{tab:Formatting-the-row-variable}Formatting the row-variable
column}
\begin{center}
\begin{tabular}{ll>{\raggedright}p{4cm}l}
\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
+{\small key} & {\small type} & {\small meaning} & {\small initial}\tabularnewline
\midrule
{\small\texttt{rround}} & {\small int} & {\small rounding} & {\small\texttt{1}}\tabularnewline
{\small\texttt{ralign}} & {\small char (}{\small\texttt{r/c/l}}{\small )} & {\small horizontal alignment} & {\small\texttt{r}}\tabularnewline
@@ -388,6 +535,7 @@
{\small\texttt{rhead'}} & {\small tokens} & {\small header of 2nd rv col. (if it exists)} & {\small\texttt{rvar'}}\tabularnewline
{\small\texttt{rhnudge'}} & int & {\small nudge 2nd rv col. header }{\small{\small\verb`<int>`}}{\small{}
mu} & {\small\texttt{0}}\tabularnewline
+{\small\texttt{rfrac}} & {\small int (}{\small\texttt{0}}{\small\ldots 5)} & {\small fraction form} & {\small\texttt{0}}\tabularnewline
\bottomrule
\end{tabular}
\par\end{center}
@@ -396,13 +544,16 @@
\subsubsection{Rounding: \texttt{rround}}
-After studying the previous tables, we might decide to adjust the
-step size, say from $0.2$ to $0.25$. But changing \texttt{rstep}
-to the new value gives a disconcerting result (the first table below).
-\texttt{numerica-tables} uses a default rounding value of $1$ for
-the row variable and has rounded $0.25$ down to $0.2$ and $0.75$
-up to $0.8$ accordingly. The second table corrects matters by adjusting
-the row-variable rounding (\texttt{rround}) to \texttt{2}.
+After studying some of the previous tables, we might decide to adjust
+the step size, say from $0.2$ to $0.25$. But changing \verb`rstep`
+to the new value gives a disconcerting result. \texttt{numerica-tables}
+uses a default rounding value of $1$ for the row variable and has
+rounded $0.25$ down to $0.2$, then $0.2+0.25=0.45$ down to $0.4$,
+then $0.4+0.25=0.65$ down to $0.6$, then $0.6+0.25=0.85$ down to
+$0.8$, at which point it stops since $0.8+0.85>1$ which is the stopping
+value. The rounded-down values are the values used for caclulating
+the sines. The second table corrects matters by adjusting the row-variable
+rounding with \verb`rround=2`.
\begin{verbatim}
\tabulate[rvar=x,rstep=0.25,rstop=1]
{ \sin x }[x=0][*] (Eh???) \quad
@@ -424,10 +575,10 @@
the second table in the last example, you might prefer to centre the
headers for both the row and function-value columns. These alignments
are independently set. For the row-variable column the default alignment
-is to the right \texttt{ralign=r}; \texttt{ralign=l} (lowercase L)
-aligns entries in the row-variable column to the left, and \texttt{ralign=c}
+is to the right \verb`ralign=r`; \verb`ralign=l` (lowercase L) aligns
+entries in the row-variable column to the left, and \verb`ralign=c`
centres entries in the row-variable column. The tables of the next
-example use a \texttt{c} alignment to centre the row-variable column
+example use a \verb`c` alignment to centre the row-variable column
header. The third of those tables shows how minus signs spoil the
effect.
@@ -445,24 +596,21 @@
In the second and third tables, the header for the row-variable column
has also been bolded. The default header is the row-variable symbol.
-That can be replaced by giving a value to the key \texttt{rhead}.
-I have used \texttt{rhead=\textbackslash boldsymbol\{x\}} (rather
-than \verb`\mathbf{x}`) in order to get an italicized bold symbol.
-Note that you do not need to include math delimiters in the specification.
-It is assumed that \verb`rhead` will sit between \verb`$ $` delimiters
-which are inserted automatically by \verb`numerica-tables`.
+That can be replaced by giving a value to the key \verb`rhead`. I
+have used \verb`rhead=\boldsymbol{x}` (rather than \verb`\mathbf{x}`)
+in order to get an italicized bold symbol. Note that you do not need
+to include math delimiters in the specification. It is assumed that
+\verb`rhead` will sit between \verb`$ $` delimiters which are inserted
+automatically by \verb`numerica-tables`.
\begin{verbatim}
- \tabulate
- [rvar=x,rstep=0.25,rstop=1,
- rround=2,ralign=c]
+ \tabulate[rvar=x,rstep=0.25,rstop=1,
+ rround=2,ralign=c]
{ \sin x }[x=0][*]\qquad
- \tabulate
- [rvar=x,rstep=0.25,rstop=1,rround=2,
- ralign=c,rfont=bf,rhead=\boldsymbol{x}]
+ \tabulate[rvar=x,rstep=0.25,rstop=1,rround=2,
+ ralign=c,rfont=bf,rhead=\boldsymbol{x}]
{ \sin x }[x=0][*]\qquad
- \tabulate
- [rvar=x,rstep=0.25,rstop=0.5,rround=2,
- ralign=c,rfont=bf,rhead=\boldsymbol{x}]
+ \tabulate[rvar=x,rstep=0.25,rstop=0.5,rround=2,
+ ralign=c,rfont=bf,rhead=\boldsymbol{x}]
{ \sin x }[x=-0.5][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -485,13 +633,11 @@
The first table below does this. The second table incorporates kerning
into the header to achieve the same effect:
\begin{verbatim}
- \tabulate
- [rvar=x,rstep=0.25,rstop=0.5,rround=2,
- rfont=bf,rhead=\boldsymbol{x}\hphantom{0}]
+ \tabulate[rvar=x,rstep=0.25,rstop=0.5,rround=2,
+ rfont=bf,rhead=\boldsymbol{x}\hphantom{0}]
{ \sin x }[x=-0.5][*]\qquad
- \tabulate
- [rvar=x,rstep=0.25,rstop=0.5,rround=2,
- rfont=bf,rhead=\boldsymbol{x}\mkern 9 mu]
+ \tabulate[rvar=x,rstep=0.25,rstop=0.5,rround=2,
+ rfont=bf,rhead=\boldsymbol{x}\mkern 9 mu]
{ \sin x }[x=-0.5][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -529,14 +675,12 @@
in the example) it is brought back to a centred position in the row-variable
column.
\begin{verbatim}
- \tabulate
- [rvar=x,rstep=0.25,rstop=0.5,rround=2,
- rfont=bf,rhead=\boldsymbol{x},rhnudge=9]
+ \tabulate[rvar=x,rstep=0.25,rstop=0.5,rround=2,
+ rfont=bf,rhead=\boldsymbol{x},rhnudge=9]
{ \sin x }[x=-0.5][4*]\qquad
- \tabulate
- [rvar=x_{\text{int}},rstep=1,rstop=4,
- rround=0,rfont=bf,rhnudge=-12,
- rhead=\boldsymbol{x_{\text{int}}}]
+ \tabulate[rvar=x_{\text{int}},rstep=1,rstop=4,
+ rround=0,rfont=bf,rhnudge=-12,
+ rhead=\boldsymbol{x_{\text{int}}}]
{ \sin x_{\text{int}} }[x_{\text{int}}=0][4*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -563,12 +707,46 @@
column a user-defined function of the first; see \xA7\ref{subsec:Second-row-var-col};
\item Any other integer acts like \texttt{rpos=1}.
\end{itemize}
-An example with \texttt{rpos=3} is given shortly below, \xA7\ref{subsec:Multiple-function-tables}.
+An example with \texttt{rpos=3} is given shortly below, \xA7\ref{sec:Multiple-function-tables}.
\subsubsection{\texttt{rvar'}, \texttt{rhead'}, \texttt{rhnudge'}}
These settings become relevant only when \texttt{rpos=4}; see \xA7\ref{subsec:Second-row-var-col}.
+\subsubsection{Fraction-form values: rfrac}
+
+\label{subsec:rfracFraction-form-rvar}By giving the setting \verb`rfrac`
+an integer value between $1$ and $5$ inclusive it is possible to
+render the row-variable values as fractions with no more than \verb`rround`
+digits in the denominator. Initially \verb`rfrac=0`, which gives
+decimal output.
+\begin{itemize}
+\item \verb`rfrac=1` produces a slash fraction like $2/3$;
+\item \verb`rfrac=2` produces a scalable \verb`\frac`-tion like $\frac{2}{3}$
+in textstyle and $\dfrac{2}{3}$ in displaystyle;
+\item \verb`rfrac=3` produces a non-scalable \verb`\tfrac` like $\tfrac{2}{3}$;
+\item \verb`rfrac=4` produces a non-scalable \verb`\dfrac` like $\dfrac{2}{3}$;
+\item \verb`rfrac=5` produces a slash fraction like $\sfrac 23$ (by means
+of the \verb`\sfrac` command) in text- and displaystyles if the \texttt{xfrac}
+package is loaded and like $\scriptstyle 2/3$ if it isn't; when used
+as a super- or sub-script, the fractions reduce in size like $e^{\sfrac23}$
+or $e^{{\scriptscriptstyle 2/3}}$.
+\end{itemize}
+The following table repeats an earlier table from \xA7\ref{subsec:rdata-rfile-rverb},
+but more neatly, through using \verb`\sfrac` (with the \verb`rfrac=5`
+call) instead of \verb`\tfrac`, and moving $\pi$ from the row-variable
+column into the formula:
+\begin{verbatim}
+ \def\mydataii{1/2,1/3,2/3,1/4,3/4}
+ \tabulate[rdata=\mydataii,rpos=1,
+ rvar=k,rfrac=5,rhnudge=6,chnudge=18]
+ { k\pi }[k=0][6*]
+\end{verbatim}
+$\Longrightarrow$ \def\mydataii{1/2,1/3,2/3,1/4,3/4}
+ \tabulate[rdata=\mydataii,rpos=1,
+ rvar=k,rfrac=5,rhnudge=6,chnudge=18]
+ { k\pi }[k=0][6*]
+
\subsection{Adjoined multi-function tables}
\label{subsec:Adjoining-tables}How might one tabulate multiple functions
@@ -585,14 +763,11 @@
the \verb`\tabulate` commands if you want the tables to abut exactly.
Omitting them results in a space between the tables.
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6}]
+ \tabulate[rspec={x,0.2,6}]
{ \sin x }[x=0][*]%
- \tabulate
- [rpos=0,rspec={x,0.2,6}]
+ \tabulate[rpos=0,rspec={x,0.2,6}]
{ \cos x }[x=0][*]%
- \tabulate
- [rpos=2,rspec={x,0.2,6}]
+ \tabulate[rpos=2,rspec={x,0.2,6}]
{ \tan x }[x=0][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -605,27 +780,21 @@
[rpos=2,rspec={x,0.2,6}]
{ \tan x }[x=0][*]\medskip{}
-However, tabulating more than one function at a time is too common
-a need to have to resort to a fudge like adjoining tables. \verb`numerica-tables`
-offers a systematic way of doing this; see \xA7\ref{subsec:Multiple-function-tables}.
+\noindent However, tabulating more than one function at a time is
+too common a need to have to resort to a fudge like adjoining tables.
+\verb`numerica-tables` offers a systematic way of doing this; see
+\xA7\ref{sec:Multiple-function-tables}.
\section{Column-variable settings}
-\label{sec:Column-variable-settings}When a function of \emph{two}
-variables is being tabulated, we generally think of one variable as
-the primary variable and the other as a parameter. To tabulate such
-a function, one way to proceed, is to create and adjoin separate tables,
-one per parameter value, but that is clumsy. A more systematic procedure
-is to specify, in addition to the row variable, a \emph{column} variable
-and its start, step and stop values.
-
-\begin{table}[t]
+\label{sec:Column-variable-settings}
+\begin{table}
\caption{Column-variable specification}
\centering{}\begin{center}
\begin{tabular}{ll>{\raggedright}p{4cm}l}
\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
+{\small key} & {\small type} & {\small meaning} & {\small comment}\tabularnewline
\midrule
{\small\texttt{cvar}} & {\small token(s)} & {\small column-variable} & \tabularnewline
{\small\texttt{cstep}} & {\small real num.} & {\small step size} & \tabularnewline
@@ -636,6 +805,14 @@
\end{tabular}
\par\end{center}
\end{table}
+When a function of \emph{two} variables is being tabulated, we generally
+think of one variable as the primary variable and the other as a parameter.
+To tabulate such a function, one way to proceed, as we have seen,
+is to create and adjoin separate tables, one per parameter value,
+but that is clumsy. A more systematic procedure is to specify, in
+addition to the row variable, a \emph{column} variable and its start,
+step and stop values.
+
In the following example \verb`cvar=k` is the column variable. I
have chosen a step size \verb`cstep=2` and a stop value \verb`cstop=9`.
As with the row variable, the start value ({\ttfamily\verb`k=3`})
@@ -648,9 +825,8 @@
of the table that the numerical values displayed in the column headers
are values of \verb`k`. This usage occurs throughout \emph{HMF}.
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},rhead=x\backslash k,
- cvar=k,cstep=2,cstop=9]
+ \tabulate[rspec={x,0.2,6},rhead=x\backslash k,
+ cvar=k,cstep=2,cstop=9]
{ \sin kx }[k=3,x=0][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -668,54 +844,45 @@
It is worth pointing out explicitly that if \verb`cols` is specified,
then it is possible to have a \emph{zero} step size, \verb`cstep=0`.
-An example where this is useful is presented in \xA7\ref{subsec:Footer-functions}.
(A similar comment applies to \verb`rows` and \verb`rstep`.)
And again, as with the row variable, it is possible to condense the
specification into a comma list with the key \verb`cspec`. This is
-a $3$-element comma list of the form \verb`{cvar,cstep,cols}`.\footnote{This is a change from v.1 of \texttt{numerica}; see the boxed comment
-at the end of \xA7\ref{sec:Row-variable-settings}.} Thus, for the preceding table I could have written
+a $3$-element comma list of the form \verb`{cvar,cstep,cols}`. Thus,
+for the preceding table I could also have written
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},rhead=x\backslash k,
- cvar=k,cstep=2,cols=4]
+ \tabulate[rspec={x,0.2,6},rhead=x\backslash k,
+ cvar=k,cstep=2,cols=4]
{ \sin kx }[k=3,x=0][*]
\end{verbatim}
-or
+or more succinctly
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},rhead=x\backslash k,
- cspec={k,2,4}]
+ \tabulate[rspec={x,0.2,6},rhead=x\backslash k,
+ cspec={k,2,4}]
{ \sin kx }[k=3,x=0][*]
\end{verbatim}
and produced the same table.
-\verb`cstep`, \verb`cstop` and \verb`cols` can all be \LaTeX{} expressions.
-The first two are evaluated \emph{after }the vv-list; \verb`cols`
-is evaluated \emph{before }the vv-list. Hence \verb`cstep` and \verb`cstop`
-may depend on the row and column variables, which are given their
-initial values in the vv-list.
+As with the row equivalents, \verb`cstep`, \verb`cstop` and \verb`cols`
+can all be \LaTeX{} expressions. Again like the row equivalents, the
+first two are evaluated \emph{after }the vv-list and so may depend
+not only on numbers and constants but also the initial values of the
+row and column variables, which are given those values in the vv-list.
+\verb`cols` is evaluated \emph{before }the vv-list; it may be a \LaTeX{}
+expression but cannot depend on the row or column variable.
\subsection{Column header formatting}
-\label{subsec:Column-header-formatting}There are four built-in style
-settings for the header to the column-variable (or function-value)
-columns (the `ch' prefix evoking `column header'). If these don't
-meet your needs or otherwise satisfy, then it is possible to define
-your own header to the function value columns using the key \verb`chead`.
-First I discuss the built-in styles.
-
-\subsubsection{Header style: single-column case}
-
-\begin{table}
+\label{subsec:Column-header-formatting}
+\begin{table}[b]
\centering{}\caption{Formatting the column-variable header}
\begin{center}
\begin{tabular}{ll>{\raggedright}p{4cm}l}
\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
+{\small key} & {\small type} & {\small meaning} & {\small initial}\tabularnewline
\midrule
{\small\texttt{chstyle}} & {\small int (0\ldots 4)} & {\small header style} & {\small\texttt{0}}\tabularnewline
-{\small\texttt{ctitle}} & {\small tokens} & {\small single col. alternative header} & \tabularnewline
+{\small\texttt{ctitle}} & {\small tokens} & {\small single col. alt. header} & \tabularnewline
{\small\texttt{chead}} & {\small tokens} & {\small user-defined header} & \tabularnewline
{\small\texttt{calign}} & {\small char (r/c/l)} & {\small column alignment} & {\small\texttt{r}}\tabularnewline
{\small\texttt{chnudge}} & {\small int} & {\small nudge header }{\small{\small\verb`int`}}{\small{} mu} & {\small\texttt{0}}\tabularnewline
@@ -724,6 +891,14 @@
\end{tabular}
\par\end{center}
\end{table}
+There are four built-in style settings for the header to the column-variable
+(or function-value) columns (the `ch' prefix evoking `column header').
+If these don't meet your needs or otherwise satisfy, then it is possible
+to define your own header to the function value columns using the
+key \verb`chead`. First I discuss the built-in styles.
+
+\subsubsection{Header style: single-column case}
+
When there is only one column of function values, the function being
tabulated is by default set as the header to the column. This corresponds
to setting \texttt{ctitle={*}} (see \xA7\ref{subsec:Title:-ctitle-setting}
@@ -741,7 +916,8 @@
If you want some more complicated header, perhaps not constrained
by the \verb`$` delimiters, then give \texttt{chead} a value. This
key I discuss below in \xA7\ref{subsec:chead}. \texttt{chead} is entirely
-up to the user to specify, including any math environment and positioning.
+up to the user to specify, including any math delimiters and positioning
+(nudging) of elements.
If both \texttt{ctitle} and \texttt{chead} are given, the \texttt{chead}
value prevails.
@@ -748,46 +924,48 @@
\subsubsection{Header~style: multi-column case}
-\texttt{chstyle=0} which is the default gives a header of the form
-displayed in the last example, with only the column-variable \emph{value}
-at the head of each column. This style generally requires the row-variable
-header to indicate what the values denote, as in the example above
-where \texttt{rhead=x\textbackslash backslash k}, the backslash separating
-row from column variable. \emph{HMF} contains a multitude of instances
-of this style; see Tables~9.7, 17.5, 21.1, 24.3, 27.4, etc. for examples.
+\label{subsec:Headerstyle:-multi-column-case}\texttt{chstyle=0} which
+is the default gives a header of the form displayed in the last example,
+with only the column-variable \emph{value} at the head of each column.
+This style generally requires the row-variable header to indicate
+what the values denote, as in the example above where \texttt{rhead=x\textbackslash backslash
+k}, the backslash separating row from column variable. \emph{HMF}
+contains a multitude of instances of this style; see Tables~9.7,
+17.5, 21.1, 24.3, 27.4, etc. for examples.
\texttt{chstyle=1} changes the header of the \emph{first} function
value column to the form \emph{variable=value} \textendash{} in the
-example below, to $k=3$. This may be an appropriate choice when a
+example below, to $k=1$. This may be an appropriate choice when a
small rounding value is being used and the resulting columns are narrow.
-I can find only one real instance in \emph{HMF}, Table~26.7. Note
-that the row-variable setting \texttt{rhead} no longer needs the \texttt{\textbackslash backslash
-k} part since the column variable is now explicitly indicated. (The
-first table in the example below.)
+I can find only one real instance in \emph{HMF}, Table~26.7. In the
+example I have used the \verb`rdata` setting to collect an assortment
+of nonsense values and for some weird reason wish to tabulate the
+sines of multiples of these oddballs. Note that the row-variable setting
+\texttt{rhead} (producing $X\backslash k$) is no longer needed since
+the column variable is now explicitly indicated. (But the table is
+lacking a title \textendash{} what on earth are we calculating with
+this strange group of numbers?)
+\begin{verbatim}
+ \tabulate[rdata={-e^2,1.234e2,3.1416,\pi/\gamma,1/9},
+ ^,rvar=X,rverb=1,cspec={k,1,3},chstyle=1]
+ { \sin kX }[k=1][3*]
+\end{verbatim}
+$\Longrightarrow$ \tabulate[rdata={-e^2,1.234e2,3.1416,\pi/\gamma,1/9},
+ ^,rvar=X,rverb=1,cspec={k,1,3},chstyle=1]
+ { \sin kX }[k=1][3*]\medskip{}
\texttt{chstyle=2} changes the header of all function-value columns
to the form \emph{variable=value}.\emph{ }In \emph{HMF} examples are
Tables~7.4, 7.9, 10.10, 16.6, etc. Again, the row-variable setting
\texttt{rhead} no longer needs the \texttt{\textbackslash backslash
-k} part since the column variable is now explicitly indicated (the
-second table in the example).
+k} part since the column variable is now explicitly indicated.
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},chstyle=1]
- { \sin kx }[k=3,x=0][3*]\quad
- \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},chstyle=2]
+ \tabulate[rspec={x,0.2,6},
+ cspec={k,2,3},chstyle=2]
{ \sin kx }[k=3,x=0][3*]
\end{verbatim}
-$\Longrightarrow$ \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},chstyle=1]
- { \sin kx }[k=3,x=0][3*]\quad
- \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},chstyle=2]
+$\Longrightarrow$ \tabulate[rspec={x,0.2,6},
+ cspec={k,2,3},chstyle=2]
{ \sin kx }[k=3,x=0][3*]\medskip{}
\texttt{chstyle=3} fills each column-variable header with the expression
@@ -796,9 +974,8 @@
Note that if the column-variable value is \verb`1`, the \verb`1`
will be displayed:
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},chstyle=3]
+ \tabulate[rspec={x,0.2,6},
+ cspec={k,2,3},chstyle=3]
{ \sin kx }[k=1,x=0][4*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -807,13 +984,12 @@
{ \sin kx }[k=1,x=0][4*]\medskip{}
In this last example you may not want the \verb`1` displayed. To
-achieve that result put \texttt{chstyle=4}. This results in a header
+achieve that effect put \texttt{chstyle=4}. This results in a header
as for \texttt{chstyle=3} but if the column variable takes the value
\verb`1`, it has an empty replacement:
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},chstyle=4]
+ \tabulate[rspec={x,0.2,6},
+ cspec={k,2,3},chstyle=4]
{ \sin kx }[k=1,x=0][4*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -834,21 +1010,19 @@
This differs from the practice for \verb`rhead`, but \verb`chead`
is potentially far more complicated. Thus for $k+\sin kx$,
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},
- cspec={k,2,3},
- chead=$1+\sin x$&$3+\sin3x$&$5+\sin 5x$]
+ \tabulate[rspec={x,0.2,6},cspec={k,2,3},
+ chead=$1+\sin x$&$3+\sin3x$&$5+\sin 5x$]
{ k+\sin kx }[k=1,x=0][4*]
\end{verbatim}
$\Longrightarrow$ \tabulate
[rspec={x,0.2,6},
- cspec={k,2,3},
+ cspec={k,2,3},
chead=$1+\sin x$&$3+\sin3x$&$5+\sin 5x$]
{ k+\sin kx }[k=1,x=0][4*]\medskip{}
\noindent Non-empty content for the \verb`chead` key overrides any
\verb`chstyle` setting and, in the case of a table with only a single
-function-value column, overrides any \verb`ctitle` setting.$ $
+function-value column, overrides any \verb`ctitle` setting.
\subsubsection{Alignment: \texttt{calign}}
@@ -858,9 +1032,8 @@
alignment with {\ttfamily\verb`chstyle=2`} in a previous
example table gives
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},ralign=c,
- cspec={k,2,3},chstyle=2,calign=c]
+ \tabulate[rspec={x,0.2,6},ralign=c,
+ cspec={k,2,3},chstyle=2,calign=c]
{ \sin kx }[k=3,x=0][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -884,9 +1057,8 @@
the header but leaving the function values with their (potentially)
awkward minus signs right aligned.
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},ralign=c,
- cspec={k,2,3},chstyle=2,chnudge=12]
+ \tabulate[rspec={x,0.2,6},ralign=c,
+ cspec={k,2,3},chstyle=2,chnudge=12]
{ \sin kx }[k=3,x=0][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -901,9 +1073,8 @@
of $100$ to ensure this circumstance. To centre the column headers
I have used \verb`chnudge=-9`.
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},ralign=c,
- cspec={k,2,3},chstyle=2,chnudge=-9]
+ \tabulate[rspec={x,0.2,6},ralign=c,
+ cspec={k,2,3},chstyle=2,chnudge=-9]
{ \sin kx }[k=100,x=0][3*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -923,9 +1094,8 @@
is {\ttfamily\verb`chround`}. For a step size of $0.25$
the appropriate setting is {\ttfamily\verb`chround=2`}.
\begin{verbatim}
- \tabulate
- [rspec={x,0.2,6},ralign=c,
- cspec={k,0.25,3},chstyle=2,chround=2]
+ \tabulate[rspec={x,0.2,6},ralign=c,
+ cspec={k,0.25,3},chstyle=2,chround=2]
{ \sin kx }[k=3,x=0][*]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -935,78 +1105,66 @@
\section{Multiple functions in a single table}
-\label{subsec:Multiple-function-tables}As already noted in \xA7\ref{subsec:Adjoining-tables},
+\label{sec:Multiple-function-tables}As already noted in \xA7\ref{subsec:Adjoining-tables},
tabulating more than one function at a time is too common a need to
-have to resort to a fudge like adjoining tables. There is a systematic
-way of handling this task available in \verb`numerica-tables`. In
-v.1 of \verb`numerica`, it sufficed to enter the functions in the
-main argument separated by commas, and to \emph{precede the first
-function with a comma}, which was the signal \texttt{numerica} needed
-to make the internal adjustments for a multi-function table. In v.2
-of \verb`numerica-tables` this option is still available, but rather
-than use a `trick' like preceding the first function with a comma,
-the preferred option now is to use a new (with v.2) setting, \verb`multifn`.
+have to resort to a fudge like adjoining tables. The systematic way
+of handling this task is to enter the functions in the main argument
+of a \verb`\tabulate` command separated by a specified mark then
+alert \verb`\tabulate` that this has happened with the \verb`ff`
+key in the settings option.
-The first table below uses the old `trick' of starting the main
-argument with a comma; the second table uses the \verb`multifn` setting
-(and note in both the \verb`o` setting indicating that the arguments
-of $\sin$ and $\cos$ are in degrees):
+By default the multi-formula delimiter is the comma if the decimal
+point is a dot (or period), or the semicolon if the decimal point
+is a comma (\texttt{numerica} loaded with the \verb`comma` package
+option). If you are content with the default delimiter then it suffices
+to enter \verb`ff` in the settings option. If not, then enter \verb`ff=<mark>`
+there. For example \verb`ff=|` would make the `pipe' character
+\verb`|` the multi-formula delimiter. If the \verb`ff` key is overlooked
+then multiple formulas in the main argument of \verb`\tabulate` will
+almost certainly cause a \LaTeX{} error.
+
+In the following example, using the default comma, note first the
+\verb`ff` setting, and then the \verb`o` setting indicating that
+the arguments of the trig functions are in degrees and (just to amuse
+myself) I have put the row variable column on both sides with the
+\verb`rpos=3` setting:
\begin{verbatim}
- \tabulate[o, rround=0,
+ \tabulate[ff,o,rpos=3,rround=0,
rvar=\theta,rstep=10,rstop=90]
- { ,\sin \theta,\cos \theta }[\theta=0][*]
- \quad
- \tabulate[o,multifn,rpos=2,rround=0,
+ { \sin \theta, \cos \theta }[\theta=0][*]
+\end{verbatim}
+$\Longrightarrow$ \tabulate[ff,o,rpos=3,rround=0,
rvar=\theta,rstep=10,rstop=90]
- { \sin \theta,\cos \theta }[\theta=0][*]
-\end{verbatim}
-$\Longrightarrow$ \tabulate[o,rvar=\theta,rstep=10,rstop=90,
- rround=0]
- { ,\sin \theta,\cos \theta }[\theta=0][*]
- \quad
- \tabulate[o,multifn,rpos=2,rvar=\theta,rstep=10,
- rstop=90,rround=0]
- { \sin \theta,\cos \theta }[\theta=0][*]\medskip{}
+ { \sin \theta, \cos \theta }[\theta=0][*]\medskip{}
-These tables suggest a space saving possibility: since $\sin$ and
-$\cos$ are complementary functions ($\cos\theta=\sin(90-\theta)$),
-the values in the bottom half of the table duplicate values in the
-top half, only with the columns reversed. This is the reason for the
-space saving \texttt{rpos=4} setting (\xA7\ref{subsec:Second-row-var-col})
-which enables complementary functions to be tabulated in `half tables'
-(for examples see \emph{HMF} Tables 4.10\textendash 4.12 for the trigonometric
-functions).
+The tables suggest a space saving possibility: since $\sin$ and $\cos$
+are complementary functions ($\cos\theta=\sin(90-\theta)$), the values
+in the bottom half of the table duplicate values in the top half,
+only with the columns reversed. This is the reason for the space saving
+\verb`rpos=4` setting (\xA7\ref{subsec:Second-row-var-col}) which enables
+complementary functions to be tabulated in `half tables' (for examples
+see \emph{HMF} Tables 4.10\textendash 4.12 for the trigonometric functions).
-A comma may not always be a convenient separator \textendash{} it
-may occur in one of the functions being tabulated (perhaps in \verb`\max`
-or \verb`\min`). By assigning a value to the setting \verb`multifn`,
-\begin{lyxcode}
-multifn=<char>
-\end{lyxcode}
-the assisgned character can be used to separate the functions. In
-the following example, a semicolon is used. Further, the row-variable
-column is duplicated on the right by using the \verb`rpos=3` setting,
-and the table gives another illustration of the use of \verb`chead`:
+In the next example, the row-variable column is again duplicated,
+left and right, with the \verb`rpos=3` setting, and a centred alignment
+is used for the function values. Because $\sin$ and $\cos$ are complementary,
+I have stopped the table at \verb`rstop=45` since continuing to \verb`90`
+would simply give a mirror reflection of the preceding values. Visually,
+the table has an unsatisfactory, sprawling appearance \textendash{}
+which directs attention to how tables might be titled (\xA7\ref{subsec:Title:-ctitle-setting}):
\begin{verbatim}
- \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
+ \tabulate[ff=|,o,rpos=3,rround=0,
+ rvar=\theta,rstep=10,rstop=45,calign=c]
+ { \max(\sin \theta,\cos \theta)|
\min(\sin \theta,\cos \theta) }
[\theta=0][*]
\end{verbatim}
-$\Longrightarrow$ \tabulate[o,multifn=;,rpos=3,rvar=\theta,
- rstep=10,rstop=90,rround=0,
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
+$\Longrightarrow$ \tabulate[ff=|,o,rpos=3,rround=0,
+ rvar=\theta,rstep=10,rstop=45,calign=c]
+ { \max(\sin \theta,\cos \theta)|
\min(\sin \theta,\cos \theta) }
- [\theta=0][*] \medskip{}
+ [\theta=0][*]
-The glaring omission in the table is any explicit statement of what
-the functions are that are being tabulated. Maximum and minimum, yes,
-but of what? That is (potentially) remedied with the \verb`ctitle`
-setting discussed next; see \xA7\ref{subsec:Title:-ctitle-setting}.
-
\section{Whole-of-table formatting}
\label{sec:Whole-of-table-formatting}There are a number of settings
@@ -1016,20 +1174,21 @@
rules or of a collective column title or of a footer row. I discuss
these here.
-\begin{table}[H]
-\noindent \centering{}\caption{\protect\label{tab:Table-formatting-settings}Table formatting}
-\noindent \begin{center}
+\begin{table}
+\centering{}\caption{\protect\label{tab:Table-formatting-settings}Table formatting}
+\begin{center}
\begin{tabular}{ll>{\raggedright}p{4cm}l}
\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
+{\small key} & {\small type} & {\small meaning} & {\small initial}\tabularnewline
\midrule
{\small\texttt{ctitle}} & {\small token(s)} & {\small collective title for function-value columns} & \tabularnewline
-{\small\texttt{cmidrow}} & {\small token(s)} & {\small inter-header/title row for} {\small function-value columns} & \tabularnewline
-{\small\texttt{rules}} & {\small char(s)} & {\small horizontal rules template} & {\small\texttt{ThB}}\tabularnewline
-{\small\texttt{foot}} & {\small token(s)} & {\small content of footer line} & \tabularnewline
-{\small\texttt{rpos}} & {\small int (}{\small\texttt{0}}{\small\ldots}{\small\texttt{4}}{\small )} & {\small row-variable column position(s)} & {\small\texttt{1}}\tabularnewline
-{\small\texttt{rbloc}} & {\small comma list} & {\small division of rows into blocks} & \tabularnewline
-{\small\texttt{rblocsep}} & {\small length} & {\small extra spacing between blocks of rows} & {\small\texttt{1 ex}}\tabularnewline
+{\small\texttt{csubttl}} & {\small token(s)} & {\small subtitle row for} {\small function- value cols} & \tabularnewline
+{\small\texttt{header}} & {\small int (}{\small\texttt{0/1}}{\small )} & {\small suppress/show header row} & {\small\texttt{1}}\tabularnewline
+{\small\texttt{foot}} & {\small token(s)} & {\small table-wide footer row} & \tabularnewline
+{\small\texttt{rules}} & {\small char(s)} & {\small horizontal rule spec.} & {\small\texttt{ThB}}\tabularnewline
+{\small\texttt{rpos}} & {\small int (}{\small\texttt{0}}{\small\ldots}{\small\texttt{4}}{\small )} & {\small row-variable col. position(s)} & {\small\texttt{1}}\tabularnewline
+{\small\texttt{rbloc}} & {\small integer comma list} & {\small row block specification} & \tabularnewline
+{\small\texttt{valign}} & {\small char (}{\small\texttt{t}}/{\small\texttt{m}}/{\small\texttt{b}}{\small )} & {\small vertical alignment of table relative to text baseline} & {\small\texttt{m}}\tabularnewline
\bottomrule
\end{tabular}
\par\end{center}
@@ -1043,146 +1202,139 @@
settings discussed in previous sections, but it can also be helpful
to have a collective title for these columns. We saw the need in the
last example. The need is met with the \verb`ctitle` key. This can
-be set to whatever you like (e.g. \texttt{ctitle=\textbackslash text\{Fred\}})
-but, to more purpose, I use the setting to clarify the last example:
+be set to whatever you like (e.g. \verb`ctitle=\text{Fred}`) but,
+to more purpose, I shall use the setting to improve the look of the
+table in the last example. Note that the content of the \verb`ctitle`
+key is enclosed in braces. This is to shield the commas there from
+being misinterpreted as item separators in the settings option. For
+an analogous reason I have specified the semicolon (\verb`ff=;`)
+as the function separator in the main argument:
\begin{verbatim}
- \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle=\sin\theta{,}\,\cos\theta,
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]
+ \tabulate[ff=;,o,rpos=3,rround=0,
+ rvar=\theta,rstep=10,rstop=45,
+ ctitle={\max,\min(\sin\theta,\cos\theta)},
+ chead=max\hphantom{00} & min\hphantom{00}]
+ { \max(\sin \theta,\cos \theta);
+ \min(\sin \theta,\cos \theta) } [\theta=0][*]
\end{verbatim}
-$\Longrightarrow$ \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle=\sin\theta{,}\,\cos\theta,
- chead=max\hphantom{00} & min\hphantom{00}]
+$\Longrightarrow$ \tabulate[ff=;,o,rpos=3,rround=0,
+ rvar=\theta,rstep=10,rstop=45,
+ ctitle={\max,\min(\sin\theta,\cos\theta)},
+ chead=max\hphantom{00} & min\hphantom{00}]
{ \max(\sin \theta,\cos \theta);
\min(\sin \theta,\cos \theta) }
[\theta=0][*]\medskip{}
-\noindent Now it is clearer what is being tabulated, although the
-reader is still being asked to interpret rather than read what the
-table is showing.
+\noindent Now it is clearer what is being tabulated and the wide separation
+of the function-value columns is reduced.
-There are two in-built settings for \verb`ctitle`: \verb`ctitle=*`,
-which makes the formula the title, and \verb`ctitle=**`, which makes
-a title of the formula and vv-list. Surely, \verb`ctitle=*` is what
-we want:
+There are two built-in values for the \verb`ctitle` key: \verb`ctitle=*`,
+which forms the title from the function being tabulated, and \verb`ctitle=**`
+which uses the function and vv-list for the title. Obviously these,
+particularly the latter, could easily become too long to be useful.
+An example of \verb`ctitle=**` is presented below in \xA7\ref{subsec:Rules:-rules-setting}.
+In the following example, inclusion of the vv-list in the title is
+pointless since the variables there form the row and column variables
+of the table; \verb`ctitle=*` is all that is needed:
\begin{verbatim}
- \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle=*,
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]
+ \tabulate[rspec={n,1,5},rround=0,
+ cspec={m,1,4},chstyle=2,ctitle=*]
+ { \cos(m\pi/n) }[n=3,m=2][*4]
\end{verbatim}
-$\Longrightarrow$ \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle=*,
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]\medskip{}
+$\Longrightarrow$ \selectlanguage{english}%
+ \tabulate[rspec={n,1,5},rround=0,
+ cspec={m,1,4},chstyle=2,ctitle=*]
+ { \cos(m\pi/n) }[n=3,m=2][*4]
+\selectlanguage{english}%
-\noindent Well, that is clear but the length of the title distorts
-the table. This is where the \verb`cmidrow` key can help (see below)
-but we can also use an \verb`aligned` environment within \verb`ctitle`:
-\begin{verbatim}
- \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle={\begin{aligned}
- \max(\sin\theta,\cos\theta)\\[-0.7ex]
- \min(\sin\theta,\cos\theta)
- \end{aligned}},
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]
-\end{verbatim}
-$\Longrightarrow$ \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle={\begin{aligned}
- \max(\sin\theta,\cos\theta)\\[-0.7ex]
- \min(\sin\theta,\cos\theta)
- \end{aligned}},
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]\medskip{}
+\subsection{Between header \& title: \texttt{csubttl}}
-The table is no longer distorted in width. Note the \verb`\\[-0.7ex]`
-within the \verb`aligned` environment. This shrinks the vertical
-space between the two lines of the title. Without it, the lines are
-too far apart.
-
-\subsection{Inter-header/title row: \texttt{cmidrow}}
-
-Some tables need to fit more header material or title material into
-their rows than can be comfortably accommodated there. For examples,
+Some tables need to fit more header or title material into their rows
+than can be comfortably accommodated in either row alone. For examples,
see \emph{HMF} Tables 7.9 (error function for complex arguments),
17.7 (Jacobian zeta function), 21.1 (eigenvalues of spheroidal wave
functions), and 26.7 (probability integrals). One way of handling
this problem is to resort to more complicated environments in header
and title rows. Another, more direct way, is to insert a row between
-the header row and title row.
+the header and title rows.
-I have chosen \verb`cmidrow` for the key name, in the sense of a
-row `mid header and title rows'. The initial `c' emphasizes that
-it is constrained to the span of the column-variable (or function-value)
-columns only (like \verb`chead` and \verb`ctitle`). The entire content
-is the responsibility of the user,
-\begin{lyxcode}
-cmidrow=<tokens>
-\end{lyxcode}
-including insertion of the necessary number of tab characters, \verb`&`,
-and any math delimiters required.
+I have chosen \verb`csubttl`, a contraction of `column variable
+subtitle' for the key name. (In version 2 of \texttt{numerica-tables}
+the name \verb`cmidrow` was used; that will still work but \verb`csubttl`
+gives a clearer indication of what the key does.) The initial `c'
+emphasizes that like \verb`chead` and \verb`ctitle` it is constrained
+to the span of the column-variable (or function-value) columns only.
+The content of \verb`csubttl` is entirely the responsibility of the
+user, including insertion of the necessary number of tab characters,
+\verb`&`, and any math delimiters required.
\begin{verbatim}
- \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle=\max(\sin\theta{,}\cos\theta),
- cmidrow=\multicolumn{2}{c}
- {$\min(\sin\theta,\cos\theta)$},
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]
+ \tabulate[ff,rspec={x,1,7},rround=0,chnudge=18,
+ ctitle=\text{Hyperbolic functions},
+ csubttl=\multicolumn{3}{c}{$\sinh x=\tfrac12
+ (e^x-e^{-x}),\ \cosh x=\tfrac12(e^x+e^{-x})$}]
+ { \tfrac12e^x, \sinh x, \cosh x }
+ [{x}=0][8*]
\end{verbatim}
-$\Longrightarrow$ \tabulate[o,multifn=;,rpos=3,rround=0,
- rvar=\theta,rstep=10,rstop=90,
- ctitle=\max(\sin\theta{,}\cos\theta),
- cmidrow=\multicolumn{2}{c}
- {$\min(\sin\theta,\cos\theta)$},
- chead=max\hphantom{00} & min\hphantom{00}]
- { \max(\sin \theta,\cos \theta);
- \min(\sin \theta,\cos \theta) }
- [\theta=0][*]\medskip{}
+$\Longrightarrow$ \tabulate[ff,rspec={x,1,7},rround=0,chnudge=18,
+ ctitle=\text{Hyperbolic functions},
+ csubttl=\multicolumn{3}{c}{$\sinh x=\tfrac12
+ (e^x-e^{-x}),\ \cosh x=\tfrac12(e^x+e^{-x})$}]
+ { \tfrac12e^x, \sinh x, \cosh x }
+ [{x}=0][8*]
-\noindent The display looks the same as in the previous example but
-was obtained perhaps more straightforwardly.
+\subsection{Suppress/show header row}
+\label{subsec:Header-row-suppress}Usually the header row in a table
+is shown. It carries essential information as to the table's contents.
+However, there are occasions when it should be suppressed. An example
+where this is appropriate is given in \xA7\ref{subsec:rdata-rfile-rverb}
+where a table listing fractions of $\pi$ and their values is shown.
+As in that example, to suppress the header enter the setting \verb`header=0`.
+(Otherwise tables default to \verb`header=1`.)
+
+\subsection{Footer row: \texttt{foot} }
+
+Some tables have a footer row and \verb`numerica-tables` allows such
+a row to be inserted, but its entire content, with one exception,
+is the responsibility of the user, including insertion of the necessary
+number of tab characters \verb`&`. This will usually be $1$ less
+than the total number of columns (including row-variable columns)
+in the table \textendash{} or some adjustment thereof if you use \verb`\multicolumn`.
+You can put into the footer what you wish: \verb`foot=<tokens>`.
+(\emph{HMF} uses the footer mainly for cryptic descriptions of the
+accuracy and needs of interpolation methods.)
+
+The one exception is when \verb`foot=*`. This will fill the footer
+with the header, but \emph{reversed}. This is useful for tabulating
+complementary functions like the sine and cosine or, more generally,
+$f(x)$ and $g(x)$ where $g(x)=f(k-x)$ for some constant $k$. Values
+for the complementary function are read from the bottom up and require
+a reversed row-variable column on the right of the table; see \xA7\ref{subsec:Second-row-var-col}.
+
+\noindent{}%
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
+
+\subsubsection{Footer functions}
+
+In previous versions of \texttt{numerica-tables} it was possible to
+perform certain simple operations on columns \textendash{} calculate
+the sum, the average and maximum and minimum values. This is no longer
+so in version 3. Not only does it seem tangential to the primary function
+of the \verb`\tabulate` command but it was also acutely dependent
+on the format of the numbers being operated on. A simple change in
+the number-format option could cause a \LaTeX{} error.\end{shaded}%
+\end{minipage}
+
\subsection{Horizontal rules: \texttt{rules}}
-\label{subsec:Rules:-rules-setting}The \texttt{booktabs} package
-which \texttt{numerica} uses is most emphatic that one should `1.
-Never, ever use vertical rules. 2. Never use double rules.' Most
-of the tables proper in \emph{HMF} lack rules of any kind although
-closer inspection shows smaller tables within the text generally \emph{are}
-delimited by horizontal rules (often also with vertical rules).\footnote{The tables in \emph{HMF} are often inelegantly typeset, and sometimes
-ugly. For all that, I have used it as a valuable source for the variety
-of structures that the editors found necessary, or at least useful,
-for presenting a multitude of different kinds of numerical data.} I have used horizontal rules in the various examples in the present
-document because these too are tables within text. Some form of delineation
-seems necessary.
-
-\begin{table}
-\noindent \centering{}\caption{\protect\label{tab:Rules}Rules. {\small (In the \textquoteleft span\textquoteright{}
+\label{subsec:Rules:-rules-setting}
+\begin{table}[!b]
+\centering{}\caption{\protect\label{tab:Rules}Rules. {\small (In the \textquoteleft span\textquoteright{}
column, \textquoteleft f-v\textquoteright =function-value; \textquoteleft r-v\textquoteright =row-variable;
\textquoteleft$<$~table\textquoteright{} indicates that the rule
spans the table but is trimmed at each end.)}}
-\noindent \begin{center}
+\begin{center}
\begin{tabular}{lll>{\raggedright}p{3cm}l}
\toprule
{\small char} & {\small rule} & {\small position} & {\small span} & {\small default rule thickness}\tabularnewline
@@ -1189,53 +1341,80 @@
\midrule
{\small\texttt{T}} & {\small top} & {\small above table} & {\small table} & {\small\texttt{\textbackslash heavyrulewidth=.08em}}\tabularnewline
{\small\texttt{t}} & {\small title} & {\small below title} & {\small f-v cols} & {\small\texttt{\textbackslash cmidrulewidth =.03em}}\tabularnewline
-{\small m} & {\small midrow} & {\small below midrow} & {\small f-v cols (if $1$ r-v col.)}{\small\par}
+{\small\texttt{s}} & {\small subtitle} & {\small below subtitle} & {\small f-v cols (if $1$ r-v col.)}{\small\par}
{\small$<$ table (if $2$ r-v cols)} & {\small\texttt{\textbackslash cmidrulewidth =.03em}}\tabularnewline
{\small\texttt{h}} & {\small header} & {\small below header} & {\small table} & {\small\texttt{\textbackslash lightrulewidth=.05em}}\tabularnewline
-{\small\texttt{f}} & {\small footer} & {\small above footer} & {\small table} & {\small\texttt{\textbackslash cmidrulewidth =.03em}}\tabularnewline
+{\small\texttt{f}} & {\small footer} & {\small above footer} & {\small < table} & {\small\texttt{\textbackslash cmidrulewidth =.03em}}\tabularnewline
{\small\texttt{B}} & {\small bottom} & {\small below table} & {\small table} & {\small\texttt{\textbackslash heavyrulewidth=.08em}}\tabularnewline
\bottomrule
\end{tabular}
\par\end{center}
\end{table}
-The \verb`rules` key enables precisely which rules are used to be
-specified. The value of the key is a `word' \textendash{} a sequence
+The \texttt{booktabs} package which \texttt{numerica} uses is most
+emphatic that one should `1. Never, ever use vertical rules. 2. Never
+use double rules.' Most of the tables proper in \emph{HMF} lack rules
+of any kind although closer inspection shows smaller tables within
+the text generally \emph{are} delimited by horizontal rules (often
+also with vertical rules). In the various examples in the present
+document I have used horizontal rules because these too are tables
+within text. Some form of delineation seems necessary. (Although many
+of \emph{HMF}'s tables are inelegantly typeset, I have used it as
+a valuable source for the variety of structures that one might need
+for presenting a multitude of different kinds of numerical data.)
+
+The \verb`rules` key allows one to specify precisely which rules
+are used. The content of the key is a `word' \textendash{} a sequence
of letters \textendash{} where the characters have the significance
and default thicknesses (from \texttt{booktabs}) shown in Table~\ref{tab:Rules}.
-The default setting is \texttt{rules=ThB}. To insert a rule beneath
-the title, for example, change this to \texttt{rules=TthB}. If in
-addition you are using a footer row and want a rule above it, then
-the specification is \texttt{rules=TthfB} and if you are using a row
-between header and title rows (a `midrow') and want a rule beneath
-that too, then the spec. is \texttt{rules=TtmhfB}. To my eye that
-is too many rules; at most only one of title and midrow rules should
-be used.
+The default setting is \verb`rules=ThB`. To insert a rule beneath
+the title, for example, change this to \verb`rules=TthB`.
-The midrow rule changes its behaviour depending on whether there are
-two row-variable columns \textendash{} on the left and right of the
-table \textendash{} or not. If there is only one row-variable column
-then, like the title rule, the midrow rule spans only the function-value
-columns. If there are two row-variable columns then the midrow rule
-spans the table but is trimmed by 0.5 em at each end. That degree
-of trim is the \verb`booktabs` default but can be changed by giving
-a different value to \verb`\cmidrulekern` in the preamble, e.g. \verb`\cmidrulekern=1em`.
-Note that the changed trim will also apply to the title rule.
+If you are using a subtitle row between header and title rows and
+want a rule beneath that too, then the spec. is \verb`rules=TtshB`.
+(For legacy reasons, \verb`m` \textendash{} from `midrow' \textendash{}
+can also be used instead of \verb`s`, as in version 2 of \texttt{numerica-tables}.)
+To my eye rules beneath both title and subtitle don't work; a rule
+beneath the subtitle alone gives a better result. The subtitle rule
+changes its behaviour depending on whether there are two row-variable
+columns \textendash{} on the left and right of the table \textendash{}
+or not. If there is only such column then, like the title rule, the
+subtitle rule spans only the function-value columns. If there are
+two row-variable columns then the subtitle rule spans the table but
+is trimmed by 0.5 em at each end. That degree of trim is the \verb`booktabs`
+default but can be changed by giving a different value to \verb`\cmidrulekern`
+in the preamble, e.g. \verb`\cmidrulekern=1em`. Note that the changed
+trim will also apply to the title rule.
+If you are using a footer row and want a rule above it, then add \verb`f`
+to the specification, e.g. \verb`rules=TthfB`. In version 3 of \texttt{numerica-tables}
+the rule is trimmed at each end. Visually, having two table-spanning
+rules close together, the \verb`f` and \verb`B` rules, doesn't work.
+The trimming makes a difference. (For the \verb`T` and \verb`h`
+rules, the occurrence of the table body beneath the \verb`h` rule
+seems to make a difference to the visual impact of the rules.) But
+the question should always be: is a rule necessary at all? Usually,
+less is more.
+
If you wish to change the thickness of a rule from its default, then
-enter new values for any or all of {\small\texttt{\textbackslash heavyrulewidth}},
-{\small\texttt{\textbackslash lightrulewidth}}, {\small\texttt{\textbackslash cmidrulewidth}}
-in the preamble. The values listed in Table~\ref{tab:Rules} are
-the default values in the \texttt{booktabs} package (except for the
-midrow and footer rules, which \texttt{booktabs} does not cover; in
-\texttt{numerica-tables} these rules are assigned a thickness of {\small\texttt{\textbackslash cmidrulewidth}}).
+enter new values for any or all of \verb`\heavyrulewidth`, \verb`\lightrulewidth`,
+\verb`\cmidrulewidth` in the preamble. The values listed in Table~\ref{tab:Rules}
+are the default values in the \texttt{booktabs} package (except for
+the midrow and footer rules, which \texttt{booktabs} does not cover;
+in \texttt{numerica-tables} these rules are assigned a thickness of
+\verb`\cmidrulewidth`).
+The order in which rules are placed in the specification doesn't matter.
+I have entered them in their `natural' order simply because it feels
+natural to do so, but it is their occurrence in the spec., not their
+position, that matters.
+
In the example table below, a rule for the column title has been specified
(the \verb`t` in the setting \verb`rules=TthB`). Also note the use
-of \texttt{ctitle={*}{*}}. The fornula contains an extra parameter
-$a$, assigned a value in the vv-list. It now makes sense to display
-the vv-list in the column title (but note the braces around \texttt{k}
-and \texttt{x} in the vv-list so that they don't display).
+of \verb`ctitle=**`. The formula contains an extra parameter $a$,
+assigned a value in the vv-list. It now makes sense to display the
+vv-list in the column title (but note the braces around \verb`k`
+and \verb`x` in the vv-list so that \emph{they} don't display).
\begin{verbatim}
\tabulate
[rspec={x,0.25,5},rround=2,rhnudge=9,
@@ -1246,78 +1425,13 @@
$\Longrightarrow$ \tabulate
[rspec={x,0.25,5},rround=2,rhnudge=9,
cspec={k,0.25,3},chstyle=2,chround=2,
- ctitle=**,rules=TthB]
+ ctitle=**,rules=TthB]
{ a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
-\subsection{Footer row: \texttt{foot} setting}
-
-Some tables have a footer row and \verb`numerica-tables` allows such
-a row to be inserted, but its entire content, with one exception,
-is the responsibility of the user, including insertion of the necessary
-number of tab characters \verb`&`. This will be $1$ less than the
-total number of columns (including row-variable columns) in the table
-\textendash{} or some adjustment thereof if you use \verb`\multicolumn`.
-You can put into the footer what you wish:
-\begin{lyxcode}
-foot=<tokens>
-\end{lyxcode}
-(\emph{HMF} uses the footer mainly for cryptic descriptions of the
-accuracy and needs of interpolation methods.)
-
-The one exception is when \texttt{foot={*}}. This will fill the footer
-with the header, but \emph{reversed}. This is useful for tabulating
-complementary functions like the sine and cosine or, more generally,
-$f(x)$ and $g(x)$ where $g(x)=f(k-x)$ for some constant $k$. Values
-for the complementary function are read from the bottom up and require
-a reversed row-variable column on the right of the table; see \xA7\ref{subsec:Second-row-var-col}.
-
-\subsubsection{Footer functions}
-
-\label{subsec:Footer-functions}It is also possible to use the footer
-for displaying the values of certain column functions. {\ttfamily\verb`numerica-tables`}
-provides four of these. They can be used in the footer (and only in
-the footer): \verb`SUM`, \verb`AVE` (average), \verb`MAX` and \verb`MIN`.
-These functions act on the function values of the column they are
-in. They \emph{do not} combine mathematically: entering \verb`MAX-MIN`
-in the footer of a given column will produce a footer entry containing
-two values (those of \verb`MAX` and \verb`MIN`) separated by a minus
-sign. The numerical output from each function is automatically wrapped
-in math delimiters (\verb`$`) so that minus signs display correctly.
-
-\noindent\begin{minipage}[t]{1\columnwidth}%
-\begin{shaded}%
-In v.1 of \verb`numerica`, tables supported \emph{five} footer functions.
-The fifth was \verb`DEL=MAX-MIN`. It is no longer supported. First,
-the name was unclear and in any case, it is easy to calculate from
-\verb`MAX` and \verb`MIN`.\end{shaded}%
-\end{minipage}
-
-In the following example, I have chosen a column variable step size
-of zero. This is possible because in the column spec., I have also
-specified the exact number of columns. Zeroing the step size means
-the same set of figures can be used for the four footer functions
-to act on.
-\begin{verbatim}
- \tabulate
- [rspec={x,0.25,(5)},rround=2,rhnudge=9,
- cspec={k,0,4},ctitle=**,
- chead=SUM\;&AVE\;&MAX\;&MIN\;,
- rules=TthfB,
- foot=&SUM&AVE&MAX&MIN ]
- { a\sin kx }[a=2/\pi,k=3.5,{x}=0][*]
-\end{verbatim}
-$\Longrightarrow$ \tabulate
- [rspec={x,0.25,(5)},rround=2,rhnudge=9,
- cspec={k,0,4},calign=r,ctitle=**,
- chead=SUM\;&AVE\;&MAX\;&MIN\;,
- rules=TthfB,
- foot=&SUM&AVE&MAX&MIN ]
- { a\sin kx }[a=2/\pi,k=3.5,{x}=0][*]
-
\subsection{Second row-variable column: \texttt{rpos=4}}
\label{subsec:Second-row-var-col}In \xA7\ref{subsec:Row-var-col-pos}
-I discussed the settings \verb`rpos=0,1,2` and in \xA7\ref{subsec:Multiple-function-tables}
+I discussed the settings \verb`rpos=0,1,2` and in \xA7\ref{sec:Multiple-function-tables}
gave an example of using {\ttfamily\verb`rpos=3`} where
repeating the row-variable column on the right is helpful. There is
another value available for this key, \verb`rpos=4`. Like {\ttfamily\verb`rpos=3`}
@@ -1336,17 +1450,17 @@
The example also gives an illustration of the use of an expression
in the third element of \verb`rspec`.
\begin{verbatim}
- \tabulate[o,multifn,rpos=4,
+ \tabulate[ff=;,o,rpos=4,
rspec={\theta,5,1+45/5},rround=0,
chnudge=14,rvar'=90-\theta,
rules=ThfB,foot=*]
- { \sin\theta,\cos\theta }[\theta=0][*]
+ { \sin\theta;\cos\theta }[\theta=0][*]
\end{verbatim}
-$\Longrightarrow$ \tabulate[o,multifn,rpos=4,
+$\Longrightarrow$ \tabulate[ff=;,o,rpos=4,
rspec={\theta,5,1+45/5},rround=0,
chnudge=14,rvar'=90-\theta,
rules=ThfB,foot=*]
- { \sin\theta,\cos\theta }[\theta=0][*]\medskip{}
+ { \sin\theta;\cos\theta }[\theta=0][*]\medskip{}
\noindent The values of sines from $0$ to $45$ degrees are read
downwards from the first column of function values, and from 45 to
@@ -1420,13 +1534,13 @@
In the next example I have divided the columns into blocks of $5$
rows by means of the setting \texttt{rbloc=5}.
\begin{verbatim}
- \tabulate[o,rspec={\theta,10,1+90/10},
- rround=0,rbloc=5]
- { ,\sin\theta, \cos\theta }[\theta=0][*]
+ \tabulate[ff=;,o,rspec={\theta,10,1+90/10},
+ rround=0,rbloc=5]
+ { \sin\theta; \cos\theta }[\theta=0][*]
\end{verbatim}
-$\Longrightarrow$ \tabulate[o,rspec={\theta,10,1+90/10},
+$\Longrightarrow$ \tabulate[ff=;,o,rspec={\theta,10,1+90/10},
rround=0,rbloc=5]
- { ,\sin \theta, \cos \theta}[\theta=0][*]
+ { \sin \theta; \cos \theta}[\theta=0][*]
\subsubsection{Adjusting the extra space\texttt{ rblocsep} }
@@ -1434,16 +1548,62 @@
rows at \verb`1 ex`. This value can easily by changed with the setting
\texttt{rblocsep=<length>}. The units need to be included in the specification.
-\section{Formatting function values}
+\subsection{Table placement}
+\label{sec:Table-placement}Tables can be nudged vertically with the
+\LaTeX{} commands \verb`\bigskip`, \verb`\medskip`, \verb`\smallskip`,
+usually about $1$, $\sfrac12$ and $\sfrac14$ line spaces (with
+stretch and shrink). \verb`booktabs` provides \verb`\abovetopsep`
+and \verb`\belowbottomsep`, both set by default to \verb`0ex` and
+easily changed by writing, e.g., \verb`\abovetopsep=1.25ex` if you
+want to insert \verb`1.25ex` of space above the table (perhaps to
+fit captions).
+
+\subsubsection{Vertical~alignment}
+
+\label{subsec:Verticalalignment}By writing\texttt{ }{\ttfamily\verb`valign=<char>`}
+where \verb`<char>` is one of \verb`t`, \verb`m` or \verb`b` the
+vertical alignment of the table can be set relative to the text baseline.\texttt{ }\verb`valign=t`\texttt{
+}aligns the top of the table with the text baseline, \verb`valign=b`
+the bottom of the table with the text baseline, \verb`valign=m` aligns
+the middle of the table with the text baseline. By default \verb`valign=m`
+is set. Repeating an example from earlier (\xA7\ref{sec:Row-variable-settings})
+I have added letters A, B, C to show where the baseline is. In the
+first table the top of the table aligns with the baseline; in the
+second table (default case) the middle of the table aligns with the
+baseline; in the third table, the bottom of the table aligns with
+the baseline.
+\begin{verbatim}
+ A \tabulate[valign=t,rvar=x,rstep=0.2,rows=6]
+ { \sin x/\cos x }[x=0][*] \quad
+ B \tabulate[rspec={x,0.2,1+(1/0.2)}]
+ { \tan x }[x=0][*] \quad
+ C \tabulate[valign=b,rspec={x,0.2,(6)}]
+ { \sqrt{\sec^2 x - 1} }[x=0][*]
+\end{verbatim}
+$\Longrightarrow$ A \tabulate[valign=t,rvar=x,rstep=0.2,rows=6,rstop=2]
+ { \sin x/\cos x }[x=0][*] \quad
+ B \tabulate[rspec={x,0.2,1+(1/0.2)}]
+ { \tan x }[x=0][*] \quad
+ C \tabulate[valign=b,rspec={x,0.2,6}]
+ { \sqrt{\sec^2 x - 1} }[x=0][*]\medskip{}
+
+As explained in \xA7\ref{subsec:Adjoining-tables}, tables can be adjoined
+to give the appearance of a single larger table. If tables with different
+numbers of rows are adjoined in this manner, then a middle alignment
+fails and a top alignment is necessary (so that the header rows of
+the tables align).
+
+\section{Function value formatting}
+
\label{sec:Function-value-formatting}
\begin{table}
-\noindent \centering{}\caption{\protect\label{tab:Function-value-formatting}Formatting function
+\centering{}\caption{\protect\label{tab:Function-value-formatting}Formatting function
values}
-\noindent \begin{center}
-\begin{tabular}{cc>{\raggedright}p{4cm}c}
+\begin{center}
+\begin{tabular}{cc>{\raggedright}p{5cm}c}
\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
+{\small key} & {\small type} & {\small meaning} & {\small initial}\tabularnewline
\midrule
{\small\texttt{(pad)}} & {\small int} & {\small (t-notation) phantom padding} & \tabularnewline
{\small\texttt{signs}} & {\small int} & {\small sign handling for function-values} & {\small\texttt{0}}\tabularnewline
@@ -1454,9 +1614,12 @@
\end{tabular}
\par\end{center}
\end{table}
-In the examples used so far, function values have been limited to
-a narrow range, generally $[-1,1]$. What happens when function values
-span orders of magnitude?
+In previous tables in this document, function values have generally
+been limited to a fairly narrow range of values. What happens when
+function values span orders of magnitude? Can we accommodate scientific
+notation, expressly designed to cope with such orders of magnitude,
+in a natural way? Or, in a different direction, can we form tables
+of function values in fraction form?
\subsection{Trailing optional argument}
@@ -1463,19 +1626,56 @@
\label{subsec:Trailing-optional-argument}The primary tool for function-value
formatting is the trailing optional argument of the \verb`\tabulate`
command where the rounding value is specified, padding with zeros
-is set or not (generally \emph{set}), and scientific notation is set
-or not. Elegant scientific notation, set with an \texttt{x} in the
-trailing optional argument, is generally not appropriate for use in
-tables; see the first table below. Repeating the \texttt{x} \textendash{}
-\verb`xx` \textendash{} in the trailing optional argument (the second
-table) so that scientific notation extends to numbers in the range
-$[1,10)$ helps, particularly with the \emph{left} alignment chosen
-for the function-value column, but the result is wasteful of space
-and the repetition of the `$\times10$' is distracting and would
-be more so for a larger table. The \texttt{x} specification should
-be used in tables, if at all, only for small tables \textendash{}
-a few function values at most.
+is set or not (generally \emph{set} in tables), scientific notation
+is set or not, and fraction-form output can be specified.
+
+\subsubsection{Fraction-form output}
+
+\label{subsec:Fraction-form-output}\xA7\ref{subsec:rfracFraction-form-rvar}
+showed the row variable in fraction form. Function values can also
+be presented in that form. The problem is that such output requires
+far more computation than other output since finding denominators
+at the specified accuracy is an iterative process that needs to be
+performed for every function value. However, it is feasible for small
+tables. In the tables below, approximations to small positive and
+inverse powers of $\pi$ are listed to $2$ and $4$ decimal places
+of accuracy. It is interesting that all the powers listed can be approximated
+to $4$-place accuracy by $3$-figure denominators (and $\pi^{2}$
+by a $2$-figure denominator).
\begin{verbatim}
+ \def\mydataiii{\pi,\pi^2,\pi^3,
+ \pi^{\sfrac12},\pi^{\sfrac13}}
+ \tabulate[rdata=\mydataiii,rverb=1,rpos=1,
+ rvar=k,ralign=l,chead={\small $2$ places}]
+ { k }[2/s] \qquad
+ \tabulate[rdata=\mydataiii,rverb=1,rpos=1,
+ rvar=k,ralign=l,chead={\small $4$ places}]
+ { k }[4/s]
+\end{verbatim}
+$\Longrightarrow$ \def\mydataiii{\pi,\pi^2,\pi^3,
+ \pi^{\sfrac12},\pi^{\sfrac13}}
+ \tabulate[rdata=\mydataiii,rverb=1,rpos=1,
+ rvar=k,ralign=l,chead={\small $2$ places}]
+ { k }[2/s]\qquad
+\tabulate[rdata=\mydataiii,rverb=1,rpos=1,
+ rvar=k,ralign=l,chead={\small $4$ places}]
+ { k }[4/s]
+
+\subsubsection{Scientific notation}
+
+Elegant scientific notation, set with an \verb`x` in the trailing
+optional argument, is generally not appropriate for use in tables;
+see the first table below. Repeating the \verb`x` \textendash{} \verb`xx`
+\textendash{} in the trailing optional argument (the second table)
+so that scientific notation extends to numbers in the range $[1,10)$
+helps, particularly with the \emph{left} alignment chosen for the
+function-value column, but the result is wasteful of space and the
+repetition of the `$\times10$' is distracting and would be more
+so for a larger table. The \verb`x` specification should be used
+in tables, if at all, only for \emph{small} tables and special cases.
+The \verb`t` option is much preferred; see \xA7\ref{subsec:t-option}
+below.
+\begin{verbatim}
\tabulate[rspec={x,1,2*3+1},rround=0]
{ e^x}[x=-5][*x]\qquad
\tabulate[rspec={x,1,2*3+1},rround=0,calign=l]
@@ -1488,11 +1688,11 @@
\subsubsection{The \texttt{t} option}
-\emph{HMF} uses a special notation for coping with function values
-spanning orders of magnitude. This notation can be invoked by inserting
-\texttt{t} in the trailing optional argument. Repeating the previous
-two tables, and adding a \texttt{chnudge} value, gives a more compact
-and visually appealing result:
+\label{subsec:t-option}\emph{HMF} uses a special notation for coping
+with function values spanning orders of magnitude. This notation can
+be invoked by inserting \verb`t` in the trailing optional argument.
+Repeating the previous two tables, and adding a \verb`chnudge` value,
+gives a more compact and visually appealing result:
\begin{verbatim}
\tabulate[rspec={x,1,2*3+1},rround=0,chnudge=24]
{ e^x}[x=-3][*t]\qquad
@@ -1500,28 +1700,28 @@
{ e^x}[x=-3][*tt]
\end{verbatim}
$\Longrightarrow$ \tabulate[rspec={x,1,2*3+1},rround=0,chnudge=24]
- { e^x}[x=-3][*t]\qquad
+ { e^x}[x=-3][*t] \qquad
\tabulate[rspec={x,1,2*3+1},rround=0,chnudge=24]
{ e^x}[x=-3][*tt]
-\subsection{Padding the exponent: \texttt{(pad)}}
+\subsubsection{Padding the exponent: \texttt{(pad)}}
In the second table of the last example some might quibble at the
lack of alignment of the left parentheses. \emph{HMF} tends to align
these and \verb`numerica-tables` offers the setting
-\begin{lyxcode}
-(pad)~=~<integer>
-\end{lyxcode}
+\begin{verbatim}
+ (pad) = <integer>
+\end{verbatim}
to achieve the effect. (The parentheses are part of the key \textendash{}
-a reminder of the \verb`t`-form of scientific notation.) \texttt{<integer>}
+a reminder of the \verb`t`-form of scientific notation.) \verb`<integer>`
is the number of digits/characters to pad to. Repeating the last two
-tables with the setting \texttt{(pad)=2} produces the following results:
+tables with the setting \verb`(pad)=2` produces the following results:
\begin{verbatim}
\tabulate[rspec={x,1,2*3+1},rround=0,
- chnudge=24,(pad)=2]
+ chnudge=24,(pad)=2]
{ e^x}[x=-3][*t]\qquad
\tabulate[rspec={x,1,2*3+1},rround=0,
- chnudge=24,(pad)=2]
+ chnudge=24,(pad)=2]
{ e^x}[x=-3][*tt]
\end{verbatim}
$\Longrightarrow$ \tabulate[rspec={x,1,2*3+1},rround=0,
@@ -1542,38 +1742,38 @@
\label{subsec:Signs}Instead of $e^{x}$ as the test function, use
$e^{x}-1.$ Now there are positive, zero and negative function values
to contend with. Recall that in the \verb`t`-notation the \emph{exponent}
-is the parenthesized integer part of a number, the \emph{significand}
+is the parenthesized integer part of a number and the \emph{significand}
the following decimal figures. \verb`numerica-tables` offers the
\verb`signs` key to align (or not) the exponents. The setting is
-\begin{lyxcode}
-signs~=~<integer>
-\end{lyxcode}
-There are four effective values for \texttt{<integer>} and the do-nothing
-default (\texttt{signs=0}):
+\begin{verbatim}
+ signs = <integer>
+\end{verbatim}
+Besides the do-nothing default \verb`(signs=0)`, there are four effective
+values for \verb`<integer>`:
\begin{itemize}
-\item \texttt{signs=2 }inserts a $+$ sign between exponent and significand
-of every non-negative number;
-\item \texttt{signs=1 }inserts a $+$ sign between exponent and significand
-of every non-negative number that immediately precedes or follows
-a negative number;
-\item \texttt{signs=-1 }inserts a $+$ sign between exponent and significand
-of any non-negative number that immediately precedes or follows a
-negative number, and inserts a \emph{phantom} $+$ sign between exponent
-and significand of every other non-negative number;
-\item \texttt{signs=-2 }inserts a \emph{phantom} $+$ sign between exponent
-and significand of every non-negative number;
+\item \verb`signs=2`\texttt{ }inserts a $+$ sign between exponent and
+significand of every non-negative number;
+\item \verb`signs=1`\texttt{ }inserts a $+$ sign between exponent and
+significand of every non-negative number that immediately precedes
+or follows a negative number;
+\item \verb`signs=-1`\texttt{ }inserts a $+$ sign between exponent and
+significand of any non-negative number that immediately precedes or
+follows a negative number, and inserts a \emph{phantom} $+$ sign
+between exponent and significand of every other non-negative number;
+\item \verb`signs=-2`\texttt{ }inserts a \emph{phantom} $+$ sign between
+exponent and significand of every non-negative number;
\end{itemize}
-In the following examples with \verb`signs=-2`, \verb`signs=-1`
-and \verb`signs=2`, all give acceptable results.
+In the following examples, \verb`signs=-2`, \verb`signs=-1` and
+\verb`signs=2`, all give acceptable results.
\begin{verbatim}
\tabulate[rspec={x,1,2*3+1},rround=0,
- (pad)=2,signs=-2]
+ (pad)=2,signs=-2]
{ e^x-1}[x=-3][4*tt]\qquad
\tabulate[rspec={x,1,2*3+1},rround=0,
- (pad)=2,signs=-1]
+ (pad)=2,signs=-1]
{ e^x-1}[x=-3][4*tt]\qquad
\tabulate[rspec={x,1,2*3+1},rround=0,
- (pad)=2,signs=2]
+ (pad)=2,signs=2]
{ e^x-1}[x=-3][4*tt]
\end{verbatim}
$\Longrightarrow$ \tabulate[rspec={x,1,2*3+1},rround=0,
@@ -1594,7 +1794,7 @@
values in the \verb`t`-notation:
\begin{verbatim}
\tabulate[rspec={x,1,2*3+1},rround=0,
- (pad)=2,signs=1]
+ (pad)=2,signs=1]
{ e^x-1}[x=-3][4*tt] \qquad
\end{verbatim}
$\Longrightarrow$ \tabulate[rspec={x,1,2*3+1},rround=0,
@@ -1620,7 +1820,7 @@
\tabulate[rspec={x,0.1,9},(pad)=2]
{ 10\sin 5x}[x=-0.4][*4]\medskip{}
-\noindent \emph{HMF} seems to use \verb`signs=2` when the sign of
+\noindent\emph{HMF} seems to use \verb`signs=2` when the sign of
the function values changes every few entries and \verb`signs=1`
when there are runs of entries of the same sign. Over the range tabulated
here for $10\sin5x$, they would use the middle table of the three,
@@ -1693,48 +1893,50 @@
You may wish to highlight or display in some special way a particular
function value or values. \verb`\nmcTabulate` has two related settings
-that enable this: \texttt{Q?=<tokens>} and \texttt{A!=<tokens>}. As
+that enable this: \verb`Q?=<tokens>` and \verb`A!=<tokens>`. As
the names suggest: Question? and Answer!
The question should be an expression that \texttt{l3fp} can digest
-and produce a boolean answer to (1 for `true' or 0 for `false').
-\emph{This is not a \LaTeX{} expression}; this is an \verb`l3fp` expression.\footnote{Documentation about \texttt{l3fp }can be found in \texttt{interface3.pdf},
-which is part of the \texttt{l3kernel} bundle.} \verb`numerica-tables` uses \texttt{@} to denote the current function
-value, so queries like \texttt{Q?=@<0} (Is the current function value
-negative?) or \texttt{Q?=\{}@\texttt{>=pi\}} (Is the current function
-value greater than or equal to $\pi$?) are valid questions. (Note
-the braces in the second question, used to hide the equality sign.)
-Other possible useful components of such questions are \texttt{exp(1)}
-for the number $e$, || for logical Or, \texttt{\&\&} for logical
-And, and \texttt{!} for logical Not,\texttt{ }as well as the familiar
-arithmetic symbols, \texttt{+},\texttt{ -},\texttt{ {*}},\texttt{
-/} and \texttt{\textasciicircum}, relation symbols \texttt{<},\texttt{
->},\texttt{ =} and their combinations like \texttt{!=},\texttt{ >=},\texttt{
-<=} etc., and parentheses. In addition to these components, \texttt{numerica-tables}
-offers \texttt{MAX} and \texttt{MIN} which are the maximum and minimum
-function values tabulated, so that, e.g., \texttt{Q?=\{@=MIN\}} (note
-the braces) is the question: Is the current function value equal to
-the minimum function value for the whole table?
+and produce a boolean answer to (1 for `true', 0 for `false').
+\emph{This is not a \LaTeX{} expression};\emph{ this is an }\verb`l3fp`
+\emph{expression}.\footnote{Documentation about \texttt{l3fp }can be found in \texttt{interface3.pdf},
+which is part of the \texttt{l3kernel} bundle.} For the user it should be enough to know that an expression formed
+from decimal numbers (but only with the dot decimal point), parentheses
+\verb`( )`, the familiar arithmetic symbols, \verb`+`,\texttt{ }\verb`-`,\texttt{
+}\verb`*`,\texttt{ }\verb`/` and \verb`^`, relation symbols \verb`<`,\texttt{
+}\verb`>`,\texttt{ }\verb`=` and combinations like \verb`!=` (for
+$\ne$),\texttt{ }\verb`>=` (for $\ge$), and\texttt{ }\verb`<=`
+(for $\le$) will be digested by \verb`l3fp`. In addition there are
+\verb`||` for logical Or, \verb`&&` for logical And, and \verb`!`
+for logical Not; \verb`exp(1)` for $e$ and \verb`pi` (no backslash)
+for $\pi$. \texttt{numerica-tables} provides \verb`MAX` and \verb`MIN`
+for the maximum and minimum function values tabulated, and uses \verb`@`
+to denote the current function value.
+So, a query might be \verb`Q?=@<0`, \emph{Is the current function
+value negative?}, or \verb`Q?={@>=pi}`, \emph{Is the current function
+value greater than or equal to $\pi$?} (The braces hide the equality
+sign in the \emph{key=value} settings option.) \verb`Q?={@=MIN}`
+(again note the braces) is the question: \emph{Is the current function
+value equal to the minimum function value for the whole table?}
+
The answer must be in the form of a \LaTeXe{} formatting statement,
-again using \texttt{@} to denote the current function value. Thus
-\texttt{A!=\textbackslash mathbf\{@\}} is a valid answer; so is \texttt{A!=\textbackslash color\{red\}\{@\}}
-(provided you have \texttt{\textbackslash usepackage\{color\}} in
-the preamble); and so is \texttt{A!=(@)}. Another valid answer is
-\texttt{A!=} , meaning that function values satisfying the \texttt{Q?}
-question are omitted from the output.
+again using \verb`@` to denote the current function value. Thus \verb`A!=\mathbf{@}`
+is a valid answer; so is \verb`A!=\color{red}{@}` (provided you have
+\verb`\usepackage{color}` in the preamble); and so is \verb`A!=(@)`.
+Another valid answer is \verb`A!= ` , meaning that function values
+satisfying the \verb`Q?` question are omitted from the output.
This can be useful to suppress `irrelevant' values in a particular
context. For example, suppose we wish to focus on the values of $\cos(m\pi/n)$
lying between $0$ and $\tfrac{1}{2}$ inclusive for certain values
of $m$ and $n$. Rather than cluttering the table with values outside
-that interval, we suppress them (the two occurrences of `\texttt{1e-14}'
+that interval, we suppress them (the two occurrences of `\verb`1e-14`'
in the query are there to prevent rounding errors confusing the result):
\begin{verbatim}
- \tabulate
- [rspec={n,1,1+(15-4)},rround=0,rpos=2,rules=Tth,
- cspec={m,1,1+(5-2)},ctitle=*,chstyle=2,
- Q?={@<-1e-14||@>0.5+1e-14},A!=]
+ \tabulate[rspec={n,1,1+(15-4)},rules=Tth,rround=0,
+ rpos=2,cspec={m,1,1+(5-2)},chstyle=2,
+ ctitle=*,Q?={@<-1e-14||@>0.5+1e-14},A!=]
{ \cos(m\pi/n) }[n=4,m=2][*4]
\end{verbatim}
$\Longrightarrow$ \tabulate
@@ -1743,7 +1945,7 @@
Q?={@<-1e-14||@>0.5+1e-14},A!=]
{ \cos(m\pi/n) }[n=4,m=2][*4]
-\section{Star option: \texttt{\textbackslash nmcTabulate{*}}}
+\subsubsection{Star option: \texttt{\textbackslash nmcTabulate{*}}}
\label{sec:Star-option}If the \verb`Q?` question is satisfied by
at least one function value then adding a star (asterisk) to the \verb`\tabulate`
@@ -1752,11 +1954,10 @@
\verb`\constants*`, \verb`\iter*`, \verb`\solve*` and \verb`\recur*`),
\verb`\tabulate*` outputs a single number. Using the star means
you do not need an answering \verb`A!` to the query \verb`Q?` since
-no formatting of table values is involved.
+no formatting of table values is involved.
\begin{verbatim}
- \tabulate*
- [rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)},
- Q?={@<-1e-14||@>0.5+1e-14}]
+ \tabulate*[rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)},
+ Q?={@<-1e-14||@>0.5+1e-14}]
{ \cos(m\pi/n) }[n=4,m=2][*4]
\end{verbatim}
$\Longrightarrow$ \tabulate*
@@ -1764,18 +1965,40 @@
Q?={@<-1e-14||@>0.5+1e-14}]
{ \cos(m\pi/n) }[n=4,m=2][*4]. Indeed, if you omit the \verb`Q?` and \verb`A!` settings from
the previous table so that all function values are visible then this
-is the value that follows $0.5000$ in the \texttt{m=2} column \textendash{}
-the first function value encountered either less than $0$ or greater
-than $0.5$.
+is the value that follows $0.5000$ in the \verb`m=2` column \textendash{}
+the first function value encountered outside the interval $[0,0.5]$.
-\subsection{Errors}
+If you want the \emph{maximum} value that has been tabulated then,
+from version 3 of \texttt{numerica-tables}, you do not even need the
+query: when \verb`\tabulate` is starred, \verb`Q?` is initialized
+behind the scenes to \verb`@=MAX`.\footnote{\noindent In the unlikely event that someone \emph{consistently} wanted
+some other query to be asked \textendash{} the minimum value perhaps,
+or first negative value or \ldots{} \textendash{} please let the author
+know. It would be straightforward to use a package option to give
+a choice in this matter.} Thus, repeating the example from \xA7\ref{sec:Column-variable-settings},
+\begin{verbatim}
+ \tabulate[rspec={x,0.2,6},rhead=x\backslash k,
+ cvar=k,cstep=2,cstop=9]
+ { \sin kx }[k=3,x=0]
+ \tabulate*[rspec={x,0.2,6},rhead=x\backslash k,
+ cvar=k,cstep=2,cstop=9]
+ { \sin kx }[k=3,x=0]
+\end{verbatim}
+$\Longrightarrow$ \tabulate
+ [rspec={x,0.2,6},rhead=x\backslash k,
+ cvar=k,cstep=2,cstop=9]
+ { \sin kx }[k=3,x=0][*]
+\tabulate*
+ [rspec={x,0.2,6},rhead=x\backslash k,
+ cvar=k,cstep=2,cstop=9]
+ { \sin kx }[k=3,x=0] [*]
-If \emph{no} function value satisfies the query then a message is
-generated:
+\paragraph{Errors}
+
+If \emph{no} function value satisfies a query then a message is generated:
\begin{verbatim}
- \tabulate*
- [rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)},
- Q?=@>1]
+ \tabulate*[rspec={n,1,1+(15-4)},
+ cspec={m,1,1+(5-2)},Q?=@>1]
{ \cos(m\pi/n) }[n=4,m=2][*4]
\end{verbatim}
$\Longrightarrow$ \tabulate*
@@ -1783,32 +2006,19 @@
Q?=@>1]
{ \cos(m\pi/n) }[n=4,m=2][*4]
-And if there is no query at all when the star option is chosen, another
-message is shown:
-\begin{verbatim}
- \tabulate*
- [rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)}]
- { \cos(m\pi/n) }[n=4,m=2][*4]
-\end{verbatim}
-$\Longrightarrow$ \tabulate*
- [rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)}]
- { \cos(m\pi/n) }[n=4,m=2][*4]
+\paragraph{Scientific notation}
-\subsection{Scientific notation}
-
If you want the number output in scientific notation when the star
option is chosen, then enter the exponent mark in the trailing number-format
option. This is straightforward for a letter like the commonly used
-\texttt{e}, but remember that if it is the \texttt{x} option that
-you enter, then you will need to place the \verb`\tabulate*` command
-between math delimiters, otherwise the \verb`\times` symbol resulting
-from the \texttt{x} option will generate a \LaTeX{} error (`Missing
-\$ inserted'):
+\verb`e`, but remember that if you enter the \verb`x` option you
+will need to place the \verb`\tabulate*` command between math delimiters,
+otherwise the \verb`\times` symbol resulting from the \verb`x` option
+will generate a \LaTeX{} error (`Missing \$ inserted'):
\begin{verbatim}
$
- \tabulate*
- [rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)},
- Q?={@<-1e-14||@>0.5+1e-14},A!=]
+ \tabulate*[rspec={n,1,1+(15-4)},cspec={m,1,1+(5-2)},
+ Q?={@<-1e-14||@>0.5+1e-14},A!=]
{ \cos(m\pi/n) }[n=4,m=2][*4x]
$
\end{verbatim}
@@ -1819,32 +2029,30 @@
{ \cos(m\pi/n) }[n=4,m=2][*4x]
$.
+\section{Other matters}
+
+Here I group items that do not fit naturally into the earlier categories.
+
\subsection{Nesting}
-A \verb`\tabulate` command can be nested within other commands from
-the wider \verb`numerica` package, and those other commands can be
-nested within a \verb`\tabulate` command.
+\label{subsec:Nesting}A \verb`\tabulate` command can be nested within
+other commands from the \verb`numerica` suite, and those other commands
+can be nested within a \verb`\tabulate` command.
-\subsubsection{Nesting of \texttt{\textbackslash nmcTabulate}}
-
-Occasionally one might want to extract a value \textendash{} perhaps
-a maximum or minimum \textendash{} from a table to insert in another
-command. This can be done by nesting a \verb`\tabulate*` command
-with an appropriate \verb`Q?` setting within the other command. In
-fact, from v.2 of \verb`numerica` we can omit (or forget to include)
-the star. All we require is that the \verb`Q?` setting is satisfied
-by at least one function value.
+Occasionally one might want to extract a value from a table to insert
+in another command. This can be done by nesting a \verb`\tabulate*`
+command with an appropriate \verb`Q?` setting within the other command.
+In fact, from version 2 of \verb`numerica` on, the star is unnecessary.
+All we require is that the \verb`Q?` setting is satisfied by at least
+one tabulated function value.
\begin{verbatim}
- \eval{$
- (\tabulate
- [rspec={n,1,15},cspec={m,1,5},
- Q?={@=MAX}]
- { \cos(m\pi/n) }[n=4,m=2][*4])\sinh t +
- (\tabulate
- [rspec={n,1,15},cspec={m,1,5},
- Q?={@=MIN}]
- { \sin(m\pi/n) }[n=4,m=2][*4])\cosh t
- $}[t=2][4]
+ \eval[env=$]{(\tabulate
+ [rspec={n,1,15},cspec={m,1,5},Q?={@=MAX}]
+ { \cos(m\pi/n) }[n=4,m=2][*4])\sinh t +
+ (\tabulate[rspec={n,1,15},cspec={m,1,5},
+ Q?={@=MIN}]
+ { \sin(m\pi/n) }[n=4,m=2][*4])\cosh t
+ }[t=2][4]
\end{verbatim}
$\Longrightarrow$ \eval{$
(\tabulate
@@ -1857,281 +2065,110 @@
{ \sin(m\pi/n) }[n=4,m=2][*4])\cosh t
$}[t=2][4].
-Evaluating the tables
+Forming the table
\begin{verbatim}
- \tabulate
- [rspec={n,1,15},rround=0,rpos=2,rules=Tth,
- cspec={m,1,5},ctitle=*,chstyle=2]
- { \cos(m\pi/n) }[n=4,m=2][*4]
+ \tabulate[rspec={n,1,15},rround=0,rpos=2,rules=Tth,
+ cspec={m,1,5},ctitle=*,chstyle=2]
+ { \cos(m\pi/n) }[n=4,m=2][*4]
\end{verbatim}
-for the cosine and
+for the cosine and the table
\begin{verbatim}
- \tabulate
- [rspec={n,1,15},rround=0,rpos=2,rules=Tth,
- cspec={m,1,5},ctitle=*,chstyle=2]
+ \tabulate[rspec={n,1,15},rround=0,rpos=2,rules=Tth,
+ cspec={m,1,5},ctitle=*,chstyle=2]
{ \sin(m\pi/n) }[n=4,m=2][*4]
\end{verbatim}
for the sine and checking the entries shows that indeed the maximum
and minimum values are $0.9397$ and $-1.0000$ respectively.
-If the \verb`Q?` setting is not satisfied by any function value an
-error message is shown; e.g.,
+If the \verb`Q?` setting is not satisfied by any function value a
+familiar error message is shown \textendash{} with a tweak:
\begin{verbatim}
- \eval{$
- (\tabulate
- [rspec={n,1,15},cspec={m,1,5},
- Q?=@>2]
- { \cos(m\pi/n) }[n=4,m=2][*4])\sinh t
+ \eval{$ (\tabulate
+ [rspec={n,1,15},cspec={m,1,5},Q?=@>2]
+ { \cos(m\pi/n) }[n=4,m=2][*4])\sinh t
$}[t=2][4]
\end{verbatim}
$\Longrightarrow$ \eval{$
(\tabulate
[rspec={n,1,15},cspec={m,1,5},
- Q?=@>2]
+ Q?=@>2]
{ \cos(m\pi/n) }[n=4,m=2][*4])\sinh t
$}[t=2][4]
-\noindent Here, `settings (1)' tells us that the message refers
-to the (or a) command at the first level of nesting.
+\noindent Here, the \verb`(2)` tells us that the message refers to
+a command at the second level, a \emph{nested} command.
-\subsubsection{Nesting within \texttt{\textbackslash nmcTabulate}}
-
Perhaps a more likely situation is to want to nest other commands
-within a \verb`\tabulate` command, in particular those from the associated
-package \verb`numerica-` \verb`plus`. In the documentation for that
-package, as an illustration of the use of those commands, I describe
-how they can be used to numerically investigate the timing of signals
-between points fixed on a rotating disk. and in particular how to
-look for three-point circuits with the property that, despite the
-rotation, signals take the same time traversing the circuit in one
-direction as the other.
+within a \verb`\tabulate` command. I give an example in the documentation
+to the associated package \verb`numerica-plus` around the timing
+of signals between points fixed on a rotating disk.
-I show a complicated expression below involving a \verb`\tabulate`
-command wrapped around a \verb`\solve` command (from \verb`numerica-plus`)
-wrapped around four \verb`\iter*` commands (also from \verb`numerica-plus`).
-I also show the table resulting from it all. On my High St laptop
-the table takes perhaps two minutes to compile \textendash{} I haven't
-timed it exactly but it is well over a minute. Two minutes is the
-blink of an eye in a lifetime but an age sitting staring at a computer
-screen. Hence I compiled the table separately, saved it to file using
-the \verb`\reuse` command (see the discussion below, \xA7\ref{sec:reuse-setting})
-and pasted the saved result into this document.
+\subsection{Saving tables to file}
-To explain the expression: suppose the three points on the disk have
-polar coordinates $(r,\pm\theta)$ and $(a,0)$ in a co-rotating coordinate
-system. In the underlying inertial system, the signal speed is $c$
-and the angular velocity $\omega$. The cosine rule for solving triangles
-gives for the travel times $t$ between the points
-\[
-t=c^{-1}\sqrt{r^{2}+a^{2}-2ra\cos(\theta\pm\omega t)}
-\]
- and
-\[
-t=c^{-1}r\sqrt{2-2\cos(2\theta\pm\omega t)}
-\]
-where the plus sign is for a signal in the direction of rotation and
-the minus sign for a signal against the rotation. Thus the travel
-times are fixed points of the expressions on the right. Fixed points
-are found with the \verb`\iter*` command, which is where those terms
-of the expression come from. The \verb`\solve` command is then used
-to find, for a given value of $\theta$, a value of $r$ for which
-the difference of the travel times is zero for the circuit traversed
-in the two directions. Finally, the \verb`\tabulate` command creates
-a table of $r$ values for different values of the row-variable $\theta$
-and column variable $a$.
+\label{sec:reuse-setting}In earlier versions of \texttt{numerica-tables}
+it was possible to save a table to file, or a row or a column or a
+particular value from a table, by giving a \emph{setting} \verb`reuse`
+a value. From version 3.0.0, in the interests of simplifying use (and
+avoiding code complications) the \verb`reuse` \emph{setting} has
+been discontinued. The \verb`\reuse` (or \verb`\nmcReuse`) \emph{command}
+remains (as part of the \texttt{numerica} package) and can be used
+to save the most recent table to file.
-As noted earlier, it takes a long time to compile this expression
-on an `ordinary' laptop, and so I have compiled the expression separately
-and pasted the result into this document:
+In the following example, a table is created and then saved to file
+and to the macro \verb`\mytable` by the subsequent \verb`\reuse`
+command:
\begin{verbatim}
-
- \tabulate[rspec={\theta,0.2,5},chstyle=2,
- cspec={a,5,3},ctitle=r_{\Delta t=0}]
- { \solve[var=r,vvi=,+=1]
- {% circuit 1231
- 2\times\iter*[var=t,+=1]{
- c^{-1}\sqrt{a^2+r^2-
- 2ar\cos(\theta-\omega t)} }[4]
- + \iter*[var=t,+=1]{
- c^{-1}r\sqrt{2-2\cos(2\theta+\omega t)} }[4]
- % circuit 1321
- - 2\times\iter*[var=t,+=1]{
- c^{-1}\sqrt{a^2+r^2-
- 2ar\cos(\theta+\omega t)} }[4]
- - \iter*[var=t,+=1]{
- c^{-1}r\sqrt{2-2\cos(2\theta-\omega t)} }[4]
- }[3]
- }[ c=30,r=a+10,a=10,
- \theta=0.2,\omega=0.2,t=1 ][3*]
-\end{verbatim}
-$\Longrightarrow$ \begin {tabular}{rccc}
-\toprule
-&\multicolumn {3}{c}{$r_{\Delta t=0}$}\tabularnewline
-$\theta $&$a=10$&$a=15$&$a=20$\tabularnewline
-\midrule
-${0.2}$&$10.21$&$15.31$&$20.43$\tabularnewline
-${0.4}$&$10.87$&$16.33$&$21.82$\tabularnewline
-${0.6}$&$12.15$&$18.31$&$24.55$\tabularnewline
-${0.8}$&$14.46$&$21.88$&$29.59$\tabularnewline
-${1.0}$&$18.82$&$28.86$&$39.82$\tabularnewline
-\bottomrule
-\end {tabular}
-\begin{verbatim}
-
-\end{verbatim}
-
-\section{Table placement}
-
-\label{sec:Table-placement}There is only one setting in this category
-that is part of \texttt{numerica-tables} as such, the tabular vertical
-alignment option; see \xA7\ref{subsec:Verticalalignment}. But \LaTeX{}
-allows one to insert vertical space with its \verb`\bigskip`, \verb`\medskip`,
-\verb`\smallskip`, usually about one line space, a half line space,
-and a quarter line space (with stretch and shrink), and \verb`booktabs`
-provides \verb`\abovetopsep` and \verb`\belowbottomsep`, both set
-by default to \verb`0ex` (or any other unit you care to use) and
-easily changed by writing, e.g., \verb`\abovetopsep=1.25ex` if you
-want to insert \verb`1.25ex` of space above the table (perhaps to
-fit captions).
-
-\subsection{Vertical~alignment}
-
-\label{subsec:Verticalalignment}By writing\texttt{ }
-\begin{lyxcode}
-valign~=~<char>~
-\end{lyxcode}
-where \texttt{<char>} is one of \texttt{t}, \texttt{m} or \texttt{b}
-the vertical alignment of the table can be set relative to the text
-baseline.\texttt{ valign=t }aligns the top of the table with the text
-baseline, \texttt{valign=b} the bottom of the table with the text
-baseline, \texttt{valign=m} aligns the middle of the table with the
-text baseline. By default \texttt{valign=m} is set. Repeating an example
-from earlier (\xA7\ref{sec:Row-variable-settings}) I have added letters
-A, B, C to show where the baseline is. In the first table the top
-of the table aligns with the baseline; in the second table (default
-case) the middle of the table aligns with the baseline; in the third
-table, the bottom of the table aligns with the baseline.
-\begin{verbatim}
- A \tabulate[valign=t,rvar=x,rstep=0.2,rows=6]
- { \sin x/\cos x }[x=0][*] \qquad
- B \tabulate[rspec={x,0.2,1+(1/0.2)}]
- { \tan x }[x=0][*] \qquad
- C \tabulate[valign=b,rspec={x,0.2,(6)}]
- { \sqrt{\sec^2 x - 1} }[x=0][*]
-\end{verbatim}
-$\Longrightarrow$ A \tabulate[valign=t,rvar=x,rstep=0.2,rows=6,rstop=2]
- { \sin x/\cos x }[x=0][*] \qquad
- B \tabulate[rspec={x,0.2,1+(1/0.2)}]
- { \tan x }[x=0][*] \qquad
- C \tabulate[valign=b,rspec={x,0.2,6}]
- { \sqrt{\sec^2 x - 1} }[x=0][*]\medskip{}
-
-As explained in \xA7\ref{subsec:Adjoining-tables}, tables can be adjoined
-to give the appearance of a single larger table. If tables with different
-numbers of rows are adjoined in this manner, then a middle alignment
-fails and a top alignment is necessary (so that the header rows of
-the tables align).
-
-\section{The \texttt{reuse} setting}
-
-\label{sec:reuse-setting}By entering
-\begin{lyxcode}
-reuse~=~<non-negative~integer>
-\end{lyxcode}
-it is possible to specify what is saved when the \verb`\tabulate`
-command is followed by a \verb`\reuse` command.
-\begin{itemize}
-\item \texttt{reuse=0} saves the table as displayed (the default);
-\item \texttt{reuse=n} saves the $n$-th \emph{column} of function values
-\begin{itemize}
-\item if \texttt{rpos} is non-zero: in a comma-separated list of braced
-pairs \texttt{\{row-variable value,function value}\};
-\item if \texttt{rpos=0}: in a comma-separated list of function values.
-\end{itemize}
-\item \texttt{reuse=-n} saves the $n$-th \emph{row} of function values
-in a comma-separated list that includes the row-variable value in
-its appropriate position(s) if \texttt{rpos} is non-zero.
-\end{itemize}
-In the following example the third row is saved to the control sequence
-\verb`\rowiii` by using the setting \verb`reuse=-3`.
-\begin{verbatim}
\tabulate
[rspec={x,0.25,5},rround=2,rhead=x,
ralign=r,rhnudge=9,
cspec={k,0.25,3},chstyle=2,
chround=2,calign=r,ctitle=**,
- rules=TthB,reuse=-3]
+ rules=TthB]
{ a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
- \reuse{rowiii}
+ \reuse{mytable}
\end{verbatim}
$\Longrightarrow$ \tabulate
[rspec={x,0.25,(5)},rround=2,
rhead=x,ralign=r,rhnudge=9,
cspec={k,0.25,(3)},chstyle=2,
- chround=2,calign=r,ctitle=**,rules=TthB,reuse=-3]
+ chround=2,calign=r,ctitle=**,rules=TthB]
{ a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
- \reuse[renew]{rowiii}\medskip{}
+ \reuse[renew]{mytable}\medskip{}
-\noindent Now test the content of the control sequence
-\begin{lyxcode}
-\noindent \verb`\rowiii`~$\Longrightarrow$~\rowiii ~
-\end{lyxcode}
-\noindent You can see that indeed the third row has been `captured
-for posterity'.
+\noindent Now test the content of the control sequence \medskip{}
-Alternatively, we could save the second column of function values
-in the control sequence \verb`\colii`:
-\begin{verbatim}
- \tabulate[rspec={x,0.25,5},rround=2,rhead=x,
- ralign=r,rhnudge=9,
- cspec={k,0.25,3},chstyle=2,
- chround=2,calign=r,ctitle=**,
- rules=TthB,reuse=2]
- { a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
- \reuse{colii}
-\end{verbatim}
-$\Longrightarrow$ \tabulate
- [rspec={x,0.25,(5)},rround=2,
- rhead=x,ralign=r,rhnudge=9,
- cspec={k,0.25,(3)},chstyle=2,
- chround=2,calign=r,ctitle=**,
- rules=TthB,reuse=2]
- { a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
- \reuse[renew]{colii}\medskip{}
+\noindent\verb`\mytable` $\Longrightarrow$ \mytable \medskip{}
-Now to see what is saved in \verb`\colii` I use \TeX 's \verb`\meaning`
-command to show that it is indeed braced pairs:
-\begin{verbatim}
- \meaning \colii
-\end{verbatim}
-$\Longrightarrow$ \meaning\colii
+\noindent Certainly \verb`\mytable` contains the table.
-Finally, let's use the default \verb`reuse` setting (\verb`reuse=0`)
-by not entering an explicit \verb`reuse` setting at all. This should
-save the whole table:
+If we use the \verb`view` setting with \verb`\reuse` we can see
+that \verb`\mytable` and its contents have also been saved to file:
\begin{verbatim}
- \tabulate[rspec={x,0.25,5},rround=2,rhead=x,
- ralign=r,rhnudge=9,
- cspec={k,0.25,3},chstyle=2,
- chround=2,calign=r,ctitle=**,
- rules=TthB]
- { a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
- \reuse{wholetable}
+ \reuse[view]{}
\end{verbatim}
-$\Longrightarrow$ \tabulate[rspec={x,0.25,5},rround=2,rhead=x,
- ralign=r,rhnudge=9,
- cspec={k,0.25,3},chstyle=2,
- chround=2,calign=r,ctitle=**,
- rules=TthB]
- { a\sin kx }[a=2/\pi,{k}=3,{x}=0][*]
- \reuse[renew]{wholetable}\medskip{}
-
+$\Longrightarrow$ \reuse[view]{}
-\noindent Now check that the whole table has been saved:\medskip{}
+The file that \verb`\mytable` is saved to is the \texttt{.nmc} file
+of the current document, hence \texttt{numerica-tables.nmc} in the
+present instance. The contents of this file can be edited in a text
+editor, or some limited file operations can be effected with the \verb`\reuse`
+command. These have been described in the associated document \texttt{numerica.pdf}.
-\noindent \verb`\wholetable` $\Longrightarrow$\wholetable\medskip{}
+\subsection{Viewing the \protect\LaTeX{} form}
-\noindent and, indeed it has.
+In previous versions of \texttt{numerica-tables} the \verb`dbg` and
+\verb`view` settings were disabled. In version 3, they have been
+enabled to the extent that the \LaTeX{} form of a table can be viewed
+by entering either \verb`dbg=11` or, less nerdishly, \verb`view`
+into the settings option of \verb`\nmcTabulate`. In the example I
+first create the table and then use the \verb`view` setting:
+\begin{verbatim}
+
+ \tabulate[view,rvar=x,rstep=0.2,rstop=1]
+ { \sin x }[x=0]
+\end{verbatim}
+$\Longrightarrow$ \tabulate [view,rvar=x,rstep=0.2,rstop=1]
+ { \sin x }[x=0]
\chapter{Reference summary}
@@ -2141,7 +2178,7 @@
\section{Settings for \texttt{\textbackslash nmcTabulate}}
-\subsubsection*{Row-variable specification \xA7\ref{sec:Row-variable-settings}}
+\subsubsection*{Row-variable specification: uniform case \xA7\ref{subsec:Row-var-spec-uniform}}
\begin{center}
\begin{center}
\begin{tabular}{ll>{\raggedright}p{4cm}>{\raggedright}p{3cm}}
@@ -2159,6 +2196,23 @@
\par\end{center}
\par\end{center}
+\subsubsection*{Row-variable specification: non-uniform case \xA7\ref{subsec:Row-var-spec-nonuniform}}
+\begin{center}
+\begin{center}
+\begin{tabular}{ll>{\raggedright}p{4cm}>{\raggedright}p{3cm}}
+\toprule
+{\small key} & {\small type} & {\small meaning} & {\small comment}\tabularnewline
+\midrule
+{\small\texttt{rdata}} & {\small comma list} & {\small list of row-var. values} & {\small may be stored in a macro}\tabularnewline
+{\small\texttt{rfile}} & {\small chars} & {\small file of row-var. values} & {\small file path/name}\tabularnewline
+{\small\texttt{rverb}} & {\small int (}{\small\texttt{0}}{\small /}{\small\texttt{1}}{\small )} & {\small display }{\small\texttt{rdata}}{\small{} or }{\small\texttt{rfile}}{\small{}
+values verbatim} & {\small default }{\small\texttt{0}}\tabularnewline
+{\small\texttt{rfunc}} & {\small token(s)} & {\small step function specifying row-var. values} & \tabularnewline
+\bottomrule
+\end{tabular}
+\par\end{center}
+\par\end{center}
+
\subsubsection*{Row-variable column formatting \xA7\ref{subsec:Row-var-col-formatting}}
\begin{center}
\begin{center}
@@ -2215,12 +2269,12 @@
{\small\texttt{chround}} & {\small int} & {\small column header rounding} & {\small\texttt{0}}\tabularnewline
\bottomrule
\end{tabular}
+\par\end{center}\newpage{}
\par\end{center}
-\par\end{center}
\subsubsection*{Function-value formatting \xA7\ref{sec:Function-value-formatting}.}
-\noindent \begin{center}
-\noindent \begin{center}
+\begin{center}
+\begin{center}
\begin{tabular}{cc>{\raggedright}p{4cm}c}
\toprule
{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
@@ -2235,36 +2289,28 @@
\par\end{center}
\par\end{center}
-\subsubsection*{\newpage Whole-of-table formatting \xA7\ref{sec:Whole-of-table-formatting}.}
-\noindent \begin{center}
-\noindent \begin{center}
+\subsubsection*{Whole-of-table formatting \xA7\ref{sec:Whole-of-table-formatting}.}
+\begin{center}
+\begin{center}
\begin{tabular}{ll>{\raggedright}p{4cm}l}
\toprule
{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
\midrule
{\small\texttt{ctitle}} & {\small token(s)} & {\small collective title for function-value columns} & \tabularnewline
-{\small\texttt{cmidrow}} & {\small token(s) } & {\small inter-header/title row} & \tabularnewline
+{\small\texttt{cmidrow}} & {\small token(s)} & {\small inter-header/title row for} {\small function-value columns} & \tabularnewline
+{\small\texttt{header}} & {\small int (}{\small\texttt{0/1}}{\small )} & {\small suppress/show header row} & {\small\texttt{1}}\tabularnewline
{\small\texttt{rules}} & {\small char(s)} & {\small horizontal rules template} & {\small\texttt{ThB}}\tabularnewline
{\small\texttt{foot}} & {\small token(s)} & {\small content of footer line} & \tabularnewline
{\small\texttt{rpos}} & {\small int (}{\small\texttt{0}}{\small\ldots}{\small\texttt{4}}{\small )} & {\small row-variable column position(s)} & {\small\texttt{1}}\tabularnewline
{\small\texttt{rbloc}} & {\small comma list} & {\small division of rows into blocks} & \tabularnewline
-{\small\texttt{rblocsep}} & {\small length} & {\small extra spacing between blocks of rows} & {\small\texttt{1 ex}}\tabularnewline
+{\small\texttt{valign}} & {\small char (}{\small\texttt{t}}/{\small\texttt{m}}/{\small\texttt{b}}{\small )} & {\small vertical alignment of table relative to text baseline} & {\small\texttt{m}}\tabularnewline
\bottomrule
\end{tabular}
\par\end{center}
\par\end{center}
-\subsubsection*{Miscellaneous settings \xA7\ref{subsec:Multiple-function-tables}, \ref{subsec:Verticalalignment}.}
-\noindent \begin{center}
-\noindent \begin{center}
-\begin{tabular}{cc>{\raggedright}p{4cm}c}
-\toprule
-{\small key} & {\small type} & {\small meaning} & {\small default}\tabularnewline
-\midrule
-{\small\texttt{multifn}} & {\small char} & {\small multi-function separator} & {\small\texttt{,}}\tabularnewline
-{\small\texttt{valign}} & {\small char (t/m/b)} & {\small vertical alignment} & {\small\texttt{m}}\tabularnewline
-\bottomrule
-\end{tabular}
-\par\end{center}
-\par\end{center}
+\subsubsection*{Miscellaneous settings}
+
+\verb`view`, equivalent to \verb`dbg=11`: show the \LaTeX{} expression
+for the table.
\end{document}
Modified: trunk/Master/texmf-dist/tex/latex/numerica-tables/numerica-tables.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/numerica-tables/numerica-tables.sty 2023-08-22 22:45:59 UTC (rev 68019)
+++ trunk/Master/texmf-dist/tex/latex/numerica-tables/numerica-tables.sty 2023-08-22 22:46:08 UTC (rev 68020)
@@ -7,22 +7,38 @@
%
% Andrew Parsloe (ajparsloe at gmail.com)
%
-\RequirePackage{numerica}[2021/12/07]
-\@ifpackagelater{numerica}{2021/12/07}
- {}
- {%
- \PackageError{numerica-tables}{Package numerica too old.}
- {Please update the package.}
- \endinput
- }
\RequirePackage{booktabs}
-%
\ProvidesExplFile
{numerica-tables.sty}
- {2021/12/07}
- {2.0.0}
+ {2023/08/21}
+ {3.0.0}
{Create mathematical tables of function values}
+
+\msg_new:nnn {numerica-tables} {version}
+ {
+ Package~too~old!~This~version~of~numerica-tables~requires~
+ numerica~version~3.0~(or~later).
+ }
+\msg_new:nnn {numerica-tables} {load-order}
+ {
+ Please~load~version~3.0~(or~later)~of~the~numerica~
+ package~before~numerica~tables.
+ }
+\cs_if_exist:NTF \c_nmc_version_tl
+ {
+ \int_compare:nNnT { \c_nmc_version_tl } < { 30 }
+ { \msg_fatal:nn {numerica-tables} {version} }
+ }
+ { \msg_fatal:nn {numerica-tables} {load-order} }
%----------------------------------------------------------
+\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF { V }
+\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNT { V }
+\cs_generate_variant:Nn \seq_set_from_clist:Nn { No }
+\cs_generate_variant:Nn \int_compare:nNnTF { v }
+\cs_generate_variant:Nn \int_compare:nNnT { v }
+\cs_generate_variant:Nn \int_case:nnTF { v }
+\cs_generate_variant:Nn \clist_pop:NN { cc }
+
\cs_new_protected:Npn \__nmc_table_prepad:Nnn #1#2#3
{
\tl_put_left:Nx #1 { \prg_replicate:nn
@@ -35,7 +51,7 @@
{ ( #2 )\,{ #1 } }
}
\cs_new:Npn \__nmc_sci_num_table_signs:n #1
- {
+ {
\int_compare:nNnF { \l__nmc_num_sgn_int } < { 0 }
{
\int_case:nn { \l__nmc_table_signs_int }
@@ -47,20 +63,19 @@
{ 2 } { + }
}
}
- #1
+ \exp_not:o { #1 }
}
+\cs_generate_variant:Nn \__nmc_sci_num_table_signs:n { x }
\cs_new:Npn \__nmc_table_rc:N #1
- { \tl_if_eq:NNTF #1 \c__nmc_r_tl { row } { column } }
+ { \str_if_eq:nVTF { #1 } \c__nmc_r_tl { row } { column } }
%--------------------------------------
\tl_new:N \l__nmc_x_tl
\seq_new:N \l_tmpd_seq
\tl_const:Nn \c__nmc_r_tl { r }
\tl_const:Nn \c__nmc_l_tl { l }
-\tl_new:N \l__nmc_table_fnsep_tl
\bool_new:N \l__nmc_table_multifn_bool
\seq_new:N \l__nmc_table_multifn_seq
\tl_new:N \l__nmc_table_valign_tl
-\seq_new:N \l_nmc_table_reuse_seq
\tl_new:N \l__nmc_table_rvar_tl
\tl_new:N \l__nmc_table_rvari_tl
@@ -67,6 +82,8 @@
\tl_new:N \l__nmc_table_rstop_tl
\tl_new:N \l__nmc_table_rstep_tl
\tl_new:N \l__nmc_table_rspec_tl
+\tl_new:N \l__nmc_table_rvfn_tl
+\bool_new:N \l__nmc_table_rvfn_bool
\fp_new:N \l__nmc_table_rstart_fp
\fp_new:N \l__nmc_table_rstop_fp
\tl_new:N \l__nmc_table_cspec_tl
@@ -73,9 +90,12 @@
\fp_new:N \l__nmc_table_rstep_fp
\fp_new:N \l__nmc_table_r_fp
\fp_new:N \l__nmc_table_c_fp
+\fp_new:N \l__nmc_table_fn_val_fp
\int_new:N \l__nmc_table_rnum_int
\clist_new:N \l__nmc_table_rspec_clist
\bool_new:N \l__nmc_table_rspec_bool
+\seq_new:N \l__nmc_table_rdata_seq
+\bool_new:N \l__nmc_table_rdata_bool
\tl_new:N \l__nmc_table_cvar_tl
\tl_new:N \l__nmc_table_cstop_tl
@@ -91,6 +111,7 @@
\seq_new:N \l__nmc_table_rvcol_seq
\seq_new:N \l__nmc_table_rvcoli_seq
\seq_new:N \l__nmc_table_this_col_seq
+\seq_new:N \l__nmc_table_recur_seq
\seq_new:N \l__nmc_table_body_cols_seq
\seq_new:N \l__nmc_table_body_rows_seq
@@ -143,15 +164,17 @@
\tl_new:N \l__nmc_table_query_tl
%------------------------------------------------
\nmc_define:NnN \nmcTabulate { table } \tabulate
+
\cs_gset_protected:Npn \__nmc_table_initialize:
{
\bool_set_false:N \l__nmc_allow_TF_out_bool
\int_set:Nn \l__nmc_table_rnum_int { -1 }
\int_set:Nn \l__nmc_table_cnum_int { -1 }
+ \bool_if:NT \l__nmc_num_only_bool
+ { \tl_set:Nn \l__nmc_table_Q_tl { @=MAX } }
}
-\cs_gset_protected:Npn \__nmc_table_settings_digest:
- {
- \int_zero:N \l__nmc_dbg_int
+\cs_gset_protected:Npn \__nmc_table_settings:
+ {
\int_compare:nTF { 0 <= \l__nmc_table_rpos_int <= 4 }
{
\int_compare:nNnT { \l__nmc_table_rpos_int } = { 4 }
@@ -158,11 +181,21 @@
{ \int_incr:N \l__nmc_table_rpos_int }
}
{ \int_set:Nn \l__nmc_table_rpos_int { 1 } }
- \clist_if_empty:NF \l__nmc_table_rspec_clist
- { \__nmc_table_settings_spec:N r }
+ \seq_if_empty:NTF \l__nmc_table_rdata_seq
+ {
+ \clist_if_empty:NF \l__nmc_table_rspec_clist
+ { \__nmc_table_settings_spec:N r }
+ }
+ {
+ \bool_set_true:N \l__nmc_table_rdata_bool
+ \int_set:Nn \l__nmc_table_rnum_int
+ { \seq_count:N \l__nmc_table_rdata_seq }
+ \int_if_zero:nF { \l__nmc_table_rverb_int }
+ { \int_set_eq:NN \l__nmc_table_rround_int \c_max_int }
+ \__nmc_table_rdata_fpstart:
+ }
\clist_if_empty:NF \l__nmc_table_cspec_clist
- { \__nmc_table_settings_spec:N c }
-
+ { \__nmc_table_settings_spec:N c }
\tl_if_empty:NT \l__nmc_table_rhead_tl
{ \tl_set_eq:NN \l__nmc_table_rhead_tl \l__nmc_table_rvar_tl }
\tl_if_empty:NTF \l__nmc_table_rheadi_tl
@@ -177,18 +210,13 @@
\tl_if_empty:NT \l__nmc_table_rvari_tl
{ \tl_set_eq:NN \l__nmc_table_rvari_tl \l__nmc_table_rvar_tl }
}
-
\tl_if_empty:NT \l__nmc_table_rhnudgei_tl
{ \tl_set_eq:NN \l__nmc_table_rhnudgei_tl \l__nmc_table_rhnudge_tl }
-
\tl_if_empty:NF \l__nmc_table_ctitle_tl
{ \l__nmc_table_settings_ctitle: }
\tl_if_empty:NTF \l__nmc_table_Q_tl
+ { \tl_set:Nn \l__nmc_table_query_tl { Missing~ } }
{
- \tl_set:Nn \l__nmc_table_query_tl
- { \__nmc_verb:n { \nmcTabulate* }~lacks~a~ }
- }
- {
\tl_set:Nn \l__nmc_table_query_tl { No~table~value~satisfies~ }
\__nmc_table_settings_QA:
}
@@ -206,11 +234,12 @@
{ \int_set_eq:NN \l__nmc_table_chstyle_int \c__nmc_table_chstyle_int }
\tl_if_empty:NF \l__nmc_table_footer_tl
{
- \tl_if_eq:VnTF \l__nmc_table_footer_tl { * }
+ \tl_if_eq:VnT \l__nmc_table_footer_tl { * }
{ \bool_set_true:N \l__nmc_table_foot_bool }
- { \__nmc_table_footerops:N \l__nmc_table_footer_tl }
}
- }
+ \int_compare:nNnF \l__nmc_dbg_int = { 11 }
+ { \int_zero:N \l__nmc_dbg_int }
+ }
\cs_new_protected:Npn \l__nmc_table_settings_ctitle:
{
\int_incr:N \l__nmc_table_ctitle_int % 1
@@ -224,7 +253,7 @@
\cs_new_protected:Npn \__nmc_table_settings_rules:
{
\clist_map_inline:nn
- { {T}{*2},{t}{*3},{m}{*5},{h}{*7},{f}{*11},{B}{*13} }
+ { {T}{*2},{t}{*3},{m}{*5},{s}{*5},{h}{*7},{f}{*11},{B}{*13} }
{ \tl_replace_once:Nnn \l__nmc_table_rules_tl ##1 }
\int_set:Nn \l__nmc_table_rules_int { 1 \l__nmc_table_rules_tl }
}
@@ -250,18 +279,8 @@
\fp_set:Nn \l__nmc_table_min_fp { inf }
}
}
-\cs_new_protected:Npn \__nmc_table_footerops:N #1
- {
- \tl_set_eq:NN \l_tmpa_tl #1
- \regex_replace_all:nnN { SUM } { \c{l__nmc_table_csum_tl} } #1
- \regex_replace_all:nnN { AVE } { \c{l__nmc_table_cave_tl} } #1
- \regex_replace_all:nnN { MAX } { \c{l__nmc_table_cmax_tl} } #1
- \regex_replace_all:nnN { MIN } { \c{l__nmc_table_cmin_tl} } #1
- \tl_if_eq:NNF \l_tmpa_tl #1
- { \bool_set_true:N \l__nmc_table_footops_bool }
- }
\cs_new_protected:Npn \__nmc_table_settings_spec:N #1
- {
+ {
\bool_set_true:c { l__nmc_table_ #1 spec_bool }
\clist_pop:cc { l__nmc_table_ #1 spec_clist } { l__nmc_table_ #1 var_tl }
\clist_pop:cc { l__nmc_table_ #1 spec_clist } { l__nmc_table_ #1 step_tl }
@@ -275,16 +294,18 @@
\int_div_truncate:nn { \l__nmc_table_rpos_int } { 3 } }
}
\cs_gset_protected:Npn \__nmc_table_vv_digest:N #1
- {
-
+ {
\bool_if:NTF \l__nmc_multitok_bool
{
- \clist_push:NV \l_nmc_formula_tl \l__nmc_table_cvar_tl
- \clist_push:NV \l_nmc_formula_tl \l__nmc_table_rvar_tl
+ \tl_if_empty:NF \l__nmc_table_cvar_tl
+ { \clist_push:NV \l__nmc_formula_tl \l__nmc_table_cvar_tl }
+ \tl_if_empty:NF \l__nmc_table_rvar_tl
+ { \clist_push:NV \l__nmc_formula_tl \l__nmc_table_rvar_tl }
\__nmc_vv_digest:N #1
- \clist_pop:NN \l_nmc_formula_tl \l__nmc_table_rvar_tl
+ \tl_if_empty:NF \l__nmc_table_rvar_tl
+ { \clist_pop:NN \l__nmc_formula_tl \l__nmc_table_rvar_tl }
\tl_if_empty:NF \l__nmc_table_cvar_tl
- { \clist_pop:NN \l_nmc_formula_tl \l__nmc_table_cvar_tl }
+ { \clist_pop:NN \l__nmc_formula_tl \l__nmc_table_cvar_tl }
}
{ \__nmc_vv_digest:N #1 }
\int_compare:nNnT { \l__nmc_table_ctitle_int } > { 1 }
@@ -291,20 +312,21 @@
{ \tl_set_eq:NN \l__nmc_table_ctitle_tl \l__nmc_formula_dup_tl }
\seq_gpop:NN \g__nmc_error_where_seq \l__nmc_toss_tl
\__nmc_table_get_ini_vals:
- \bool_if:nT
- {
- \int_if_zero_p:n { \l__nmc_table_rpos_int } &&
- \int_if_zero_p:n { \l__nmc_table_cnum_int }
- }
- { \__nmc_error_what:n { Null~table~specified~in } }
\bool_if:NF \g__nmc_error_bool
{
+ \bool_if:nT
+ {
+ \int_if_zero_p:n { \l__nmc_table_rpos_int } &&
+ \int_if_zero_p:n { \l__nmc_table_cnum_int }
+ }
+ { \__nmc_error_what:n { Null~table~specified~in } }
\int_compare:nNnT { \l__nmc_table_ctitle_int } = { 3 }
- {
- \exp_args:NNnx\tl_replace_once:Nnn \l__nmc_vv_inline_tl { vv }
- { \seq_use:Nn \l__nmc_vv_visible_seq { , } }
- \tl_put_right:Nn \l__nmc_table_ctitle_tl
- { \exp_not:o \l__nmc_vv_inline_tl }
+ {
+ \tl_put_right:Nx \l__nmc_table_ctitle_tl
+ {
+ \c__nmc_vv_delim_tl \mskip18muminus15mu(
+ \seq_use:Nn \l__nmc_vv_visible_seq { \c__nmc_vv_delim_tl } )
+ }
}
}
}
@@ -311,17 +333,20 @@
\cs_new_protected:Npn \__nmc_table_get_ini_vals:
{
\__nmc_error_where:n { settings }
- \__nmc_table_get_ini_vals_aux:N r
- \tl_if_empty:NTF \l__nmc_table_cvar_tl
- {
- \int_set:Nn \l__nmc_table_cnum_int
- {
- \int_compare:nNnTF { \l__nmc_table_cnum_int } = { -1 }
- { 1 } { \int_min:nn { 1 }
- { \int_abs:n { \l__nmc_table_cnum_int } } }
+ \__nmc_table_get_ini_vals_aux:N r
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \tl_if_empty:NTF \l__nmc_table_cvar_tl
+ {
+ \int_set:Nn \l__nmc_table_cnum_int
+ {
+ \int_compare:nNnTF { \l__nmc_table_cnum_int } = { -1 }
+ { 1 } { \int_min:nn { 1 }
+ { \int_abs:n { \l__nmc_table_cnum_int } } }
+ }
}
+ { \__nmc_table_get_ini_vals_aux:N c }
}
- { \__nmc_table_get_ini_vals_aux:N c }
\seq_gpop:NN \g__nmc_error_where_seq \l__nmc_toss_tl
}
\cs_new_protected:Npn \__nmc_table_get_ini_vals_aux:N #1
@@ -328,15 +353,15 @@
{
\prop_get:NvNTF \l__nmc_subst_var_prop
{ l__nmc_table_ #1 var_tl } \l_tmpa_tl
- {
+ {
\fp_set:cn { l__nmc_table_ #1 start_fp } { \l_tmpa_tl }
\bool_if:cTF { l__nmc_table_ #1 spec_bool }
{
- \__nmc_fpify_set:cv { l__nmc_table_ #1 step_fp }
+ \__nmc_fpify_set:cv { l__nmc_table_ #1 step_fp }
{ l__nmc_table_ #1 step_tl }
\int_compare:vNnT { l__nmc_table_ #1 num_int } = { -1 }
{
- \__nmc_fpify_set:cv { l__nmc_table_ #1 stop_fp }
+ \__nmc_fpify_set:cv { l__nmc_table_ #1 stop_fp }
{ l__nmc_table_ #1 stop_tl }
\l__nmc_table_calc_num:cnnn { l__nmc_table_ #1 num_int }
{ l__nmc_table_ #1 stop_fp } { l__nmc_table_ #1 start_fp }
@@ -345,9 +370,16 @@
}
{ \__nmc_table_get_individual_ini_vals:N #1 }
}
- {
- \__nmc_error_what:n { No~ \__nmc_table_rc:N #1
- \ variable~specified~in }
+ {
+ \tl_if_empty:cTF { l__nmc_table_ #1 var_tl }
+ {
+ \__nmc_error_what:n { No~ \__nmc_table_rc:N #1
+ \ variable~specified~in }
+ }
+ {
+ \__nmc_error_where:n { variable=value~list }
+ \__nmc_error_what:n { No~initial~value~for~\__nmc_table_rc:N #1\ variable~in }
+ }
}
}
\cs_new_protected:Npn \l__nmc_table_calc_num:Nnnn #1#2#3#4
@@ -358,21 +390,21 @@
\cs_generate_variant:Nn \l__nmc_table_calc_num:Nnnn { c }
\cs_new_protected:Npn \__nmc_table_get_individual_ini_vals:N #1
- {
+ {
\int_case:vnTF { l__nmc_table_ #1 num_int }
{
{ -1 }
{
- \__nmc_fpify_set:cv { l__nmc_table_ #1 step_fp }
- { l__nmc_table_ #1 step_tl }
+ \__nmc_fpify_set:cv { l__nmc_table_ #1 step_fp }
+ { l__nmc_table_ #1 step_tl }
\bool_if:NF \g__nmc_error_bool
- { \__nmc_fpify_set:cv { l__nmc_table_ #1 stop_fp }
- { l__nmc_table_ #1 stop_tl } }
+ { \__nmc_fpify_set:cv { l__nmc_table_ #1 stop_fp } }
+ { l__nmc_table_ #1 stop_tl }
\bool_if:NF \g__nmc_error_bool
{
\l__nmc_table_calc_num:cnnn { l__nmc_table_ #1 num_int }
- { l__nmc_table_ #1 stop_fp } { l__nmc_table_ #1 start_fp }
- { l__nmc_table_ #1 step_fp }
+ { l__nmc_table_ #1 stop_fp } { l__nmc_table_ #1 start_fp }
+ { l__nmc_table_ #1 step_fp }
}
}
{ 0 }
@@ -395,51 +427,72 @@
}
{
\int_compare:vNnTF { l__nmc_table_ #1 num_int } > { 1 }
- { \__nmc_fpify_set:cv { l__nmc_table_ #1 step_fp }
- { l__nmc_table_ #1 step_tl } }
+ {
+ \bool_if:NF \l__nmc_table_rdata_bool
+ {
+ \__nmc_fpify_set:cv { l__nmc_table_ #1 step_fp }
+ { l__nmc_table_ #1 step_tl }
+ }
+ }
{ \__nmc_error_what:n { Check~number~of~
\__nmc_table_rc:N #1s~specified~in } }
}
}
-%----------------------------------------------------------
+%%%%%%%%%%
+\cs_set_protected:Npn \__nmc_table_formula:
+ {
+ \tl_set:Nx \l_tmpa_tl { \tl_head:N \l__nmc_formula_tl }
+ \tl_if_in:nVT { $ \( \[ } \l_tmpa_tl
+ {
+ \tl_set:Nx \l__nmc_formula_tl
+ { \tl_range:Nnn \l__nmc_formula_tl {2}{-2} }
+ }
+ \tl_set_eq:NN \l__nmc_formula_dup_tl \l__nmc_formula_tl
+ }
+%%%%%%%%%%
\cs_gset_protected:Npn \__nmc_table_process:
{
\__nmc_error_where:n { formula }
\__nmc_table_calc_rvar_col:
- \seq_clear:N \l__nmc_table_header_seq
- \bool_if:NTF \l__nmc_table_multifn_bool
- { \__nmc_table_multifn: }
- {
- \tl_if_head_eq_charcode:VNT \l_nmc_formula_tl ,
- {
- \tl_set:Nn \l__nmc_table_fnsep_tl { , }
- \__nmc_table_multifn:
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \seq_clear:N \l__nmc_table_header_seq
+ \tl_if_in:NVT \l__nmc_formula_tl \l__nmc_multi_delim_tl
+ { \__nmc_table_multifn: }
+ \__nmc_table_calc_cvar_cols:
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \tl_clear:N \l__nmc_result_tl
+ \__nmc_table_form_body:N \l__nmc_result_tl
+ \tl_set_eq:NN \l__nmc_fp_expr_tl \l__nmc_fp_exprn_tl
+ \bool_if:NT \l__nmc_num_only_bool
+ {
+ \bool_if:NTF \l__nmc_table_num_only_bool
+ {
+ \tl_set_eq:NN \l__nmc_result_tl \l__nmc_table_num_only_tl
+ \tl_gset_eq:NN \g__nmc_reuse_tl \l__nmc_table_num_only_tl
+ \bool_gset_true:N \g__nmc_reuse_bool
+ }
+ {
+ \__nmc_error_where:n { settings }
+ \__nmc_error_what:n
+ { \l__nmc_table_query_tl~query~\__nmc_verb:n {Q?}~in }
+ \tl_clear:N \l__nmc_result_tl
+ }
+ }
}
}
- \__nmc_table_calc_cvar_cols:
- \tl_clear:N \l_nmc_result_tl
- \__nmc_table_form_body:N \l_nmc_result_tl
- \tl_set_eq:NN \l__nmc_fp_expr_tl \l__nmc_fp_exprn_tl
- \bool_if:NT \l__nmc_num_only_bool
+ \int_compare:nNnT \l__nmc_dbg_int = { 11 }
{
- \bool_if:NTF \l__nmc_table_num_only_bool
- {
- \tl_set_eq:NN \l_nmc_result_tl \l__nmc_table_num_only_tl
- \tl_gset_eq:NN \g__nmc_reuse_tl \l__nmc_table_num_only_tl
- }
- {
- \__nmc_error_where:n { settings }
- \__nmc_error_what:n
- { \l__nmc_table_query_tl ~query~\__nmc_verb:n {Q?}~in }
- \tl_clear:N \l_nmc_result_tl
- }
+ \__nmc_table_display:
+ \tl_set:NV \l__nmc_show_tl \l__nmc_result_tl
}
}
\cs_new_protected:Npn \__nmc_table_multifn:
- {
+ {
\bool_set_true:N \l__nmc_table_multifn_bool
- \exp_args:NNV \seq_set_split:NnV \l__nmc_table_multifn_seq
- \l__nmc_table_fnsep_tl \l_nmc_formula_tl
+ \seq_set_split:NVV \l__nmc_table_multifn_seq
+ \l__nmc_multi_delim_tl \l__nmc_formula_tl
\seq_remove_all:Nn \l__nmc_table_multifn_seq {}
\seq_set_eq:NN \l__nmc_table_header_seq \l__nmc_table_multifn_seq
\int_set:Nn \l__nmc_table_cnum_int
@@ -452,27 +505,115 @@
}
\cs_new_protected:Npn \__nmc_table_calc_rvar_col:
{
+ \bool_if:NTF \l__nmc_table_rdata_bool
+ {
+ \__nmc_table_rdata_fpstart:
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \seq_map_inline:Nn \l__nmc_table_rdata_seq
+ {
+ \tl_clear:N \l_tmpb_tl
+ \__nmc_fpify:nN { ##1 } \l_tmpb_tl
+ \fp_set:Nn \l__nmc_table_r_fp
+ {
+ \int_if_zero:nTF \l__nmc_table_rfrac_int
+ { round( \l_tmpb_tl, \l__nmc_table_rround_int ) }
+ { \l_tmpb_tl }
+ }
+ \__nmc_error_fpflag:
+ \bool_if:NT \g__nmc_error_bool
+ { \seq_map_break: }
+ \seq_put_right:NV \l__nmc_table_rvraw_seq \l__nmc_table_r_fp
+ }
+ }
+ }
+ {
+ \tl_if_empty:NTF \l__nmc_table_rfunc_tl
+ { \__nmc_table_runiform: }
+ { \__nmc_table_rfunc: }
+ }
+
+ }
+\cs_new_protected:Npn \__nmc_table_runiform:
+ {
\fp_set_eq:NN \l__nmc_table_r_fp \l__nmc_table_rstart_fp
\int_step_inline:nnnn { 1 } { 1 } { \l__nmc_table_rnum_int }
{
+ \int_if_zero:nT \l__nmc_table_rfrac_int
+ {
+ \fp_set:Nn \l__nmc_table_r_fp
+ { round( \l__nmc_table_r_fp, \l__nmc_table_rround_int ) }
+ }
\seq_put_right:NV \l__nmc_table_rvraw_seq \l__nmc_table_r_fp
\fp_add:Nn \l__nmc_table_r_fp { \l__nmc_table_rstep_fp }
}
}
+\cs_new_protected:Npn \__nmc_table_rdata_fpstart:
+ {
+ \seq_get_left:NN \l__nmc_table_rdata_seq \l_tmpa_tl
+ \tl_put_left:Nn \l_tmpa_tl { = }
+ \tl_put_left:NV \l_tmpa_tl \l__nmc_table_rvar_tl
+ \seq_set_from_clist:NN \l_tmpa_seq \l_tmpa_tl
+ \__nmc_vv_digest:N \l_tmpa_seq
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \prop_get:NVN \l__nmc_subst_var_prop \l__nmc_table_rvar_tl \l_tmpa_tl
+ \fp_set:Nn \l__nmc_table_rstart_fp { \l_tmpa_tl }
+ }
+ }
+\cs_new_protected:Npn \__nmc_table_rfunc:
+ {
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \__nmc_error_where:n { row-variable~function }
+ \fp_set_eq:NN \l__nmc_table_r_fp \l__nmc_table_rstart_fp
+ \seq_clear:N \l__nmc_table_rdata_seq
+ \int_step_function:nN { \l__nmc_table_rnum_int }
+ \__nmc_table_rfunc_step_fn:n
+ \seq_gpop:NN \g__nmc_error_where_seq \l__nmc_toss_tl
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \__nmc_table_rdata_fpstart:
+ \seq_set_eq:NN \l__nmc_table_rvraw_seq \l__nmc_table_rdata_seq
+ \bool_set_true:N \l__nmc_table_rdata_bool
+ }
+ }
+ }
+\cs_new_protected:Npn \__nmc_table_rfunc_step_fn:n #1
+ {
+ \bool_if:NF \g__nmc_error_bool
+ {
+ \__nmc_calc_fn_val:VNnN \l__nmc_table_rvar_tl
+ \l__nmc_table_rfunc_tl { \l__nmc_table_r_fp } \l_tmpa_fp
+ \int_if_zero:nTF \l__nmc_table_rfrac_int
+ {
+ \__nmc_num_format:nNnN { \l_tmpa_fp } \l_tmpb_tl
+ { \l__nmc_table_rround_int } \c_false_bool
+ }
+ { \tl_set:Nx \l_tmpb_tl { \fp_use:N \l_tmpa_fp } }
+ \seq_put_right:NV \l__nmc_table_rdata_seq \l_tmpb_tl
+ \fp_add:Nn \l__nmc_table_r_fp { \l__nmc_table_rstep_fp }
+ }
+ }
\cs_new:Npn \__nmc_table_calc_cvar_cols:
- {
+ {
\fp_set_eq:NN \l__nmc_table_c_fp \l__nmc_table_cstart_fp
\int_step_inline:nn { \l__nmc_table_cnum_int }
- {
- \bool_if:NTF \l__nmc_table_multifn_bool
- { \seq_pop:NN \l__nmc_table_multifn_seq \l_nmc_formula_tl }
- { \seq_put_right:NV \l__nmc_table_header_seq { \l__nmc_table_c_fp } }
+ {
\bool_if:NF \g__nmc_error_bool
{
- \seq_clear:N \l__nmc_table_this_col_seq
- \fp_set_eq:NN \l__nmc_table_r_fp \l__nmc_table_rstart_fp
- \int_step_function:nN { \l__nmc_table_rnum_int }
- \__nmc_table_rvar_step_fn:n
+ \__nmc_table_multifn_header:
+ \seq_clear:N \l__nmc_table_this_col_seq
+ \seq_map_inline:Nn \l__nmc_table_rvraw_seq
+ {
+ \__nmc_calc_fn_val:VNnN \l__nmc_table_rvar_tl
+ \l__nmc_formula_tl { ####1 } \l_tmpa_fp
+ \bool_if:NT \g__nmc_error_bool
+ { \seq_map_break: }
+ \seq_put_right:NV \l__nmc_table_this_col_seq \l_tmpa_fp
+ \bool_if:NT \l__nmc_table_QA_bool
+ { \__nmc_table_maxmin_do:n { \l_tmpa_fp } }
+ }
}
\bool_if:NF \g__nmc_error_bool
{
@@ -483,23 +624,20 @@
{ \prop_put:NVV \l__nmc_subst_var_prop }
{ \prop_put:NVV \l__nmc_vv_change_prop }
\l__nmc_table_rvar_tl \l__nmc_table_rstart_fp
-
- \__nmc_calc_fn_val:VNnN \l__nmc_table_cvar_tl \l_nmc_formula_tl
- { \l__nmc_table_c_fp } \l__nmc_table_fn_val_fp
+ \int_compare:nNnF { ##1 } > { \l__nmc_table_cnum_int }
+ {
+ \__nmc_calc_fn_val:VNnN \l__nmc_table_cvar_tl
+ \l__nmc_formula_tl { \l__nmc_table_c_fp }
+ \l__nmc_table_fn_val_fp
+ }
}
}
}
-\cs_new_protected:Npn \__nmc_table_rvar_step_fn:n #1
- {
- \bool_if:NF \g__nmc_error_bool
- {
- \__nmc_calc_fn_val:VNnN \l__nmc_table_rvar_tl
- \l_nmc_formula_tl { \l__nmc_table_r_fp } \l_tmpa_fp
- \seq_put_right:NV \l__nmc_table_this_col_seq \l_tmpa_fp
- \bool_if:NT \l__nmc_table_QA_bool
- { \__nmc_table_maxmin_do:n { \l_tmpa_fp } }
- \fp_add:Nn \l__nmc_table_r_fp { \l__nmc_table_rstep_fp }
- }
+\cs_new_protected:Npn \__nmc_table_multifn_header:
+ {
+ \bool_if:NTF \l__nmc_table_multifn_bool
+ { \seq_pop:NN \l__nmc_table_multifn_seq \l__nmc_formula_tl }
+ { \seq_put_right:NV \l__nmc_table_header_seq { \l__nmc_table_c_fp } }
}
\cs_new_protected:Npn \__nmc_table_maxmin_do:n #1
{
@@ -515,26 +653,38 @@
{
\bool_if:NF \l__nmc_num_only_bool
{
- \__nmc_table_headercnum:
- \tl_set:Nx \l__nmc_table_header_tl { \__nmc_table_header: }
+ \int_if_zero:nF \l__nmc_table_header_int
+ {
+ \__nmc_table_headercnum:
+ \tl_set:Nx \l__nmc_table_header_tl { \__nmc_table_header: }
+ }
\bool_if:NT \l__nmc_table_foot_bool
{
\seq_set_split:NnV \l_tmpa_seq { & }\l__nmc_table_header_tl
\seq_reverse:N \l_tmpa_seq
- \tl_set:Nx \l__nmc_table_footer_tl { \seq_use:Nn \l_tmpa_seq { & } }
+ \tl_set:Nx \l__nmc_table_footer_tl
+ { \seq_use:Nn \l_tmpa_seq { & } }
}
- \tl_put_left:Nx \l_nmc_result_tl
- {
+ \tl_put_left:Nx \l__nmc_result_tl
+ {
\__nmc_table_upper:
\exp_not:o \l__nmc_table_header_tl
- \tabularnewline
- \__nmc_if_mod_zero:nnT { \l__nmc_table_rules_int } { 7 }
- { \exp_not:N \midrule }
+ \int_if_zero:nF \l__nmc_table_header_int
+ {
+ \\~
+ \__nmc_if_mod_zero:nnT { \l__nmc_table_rules_int } { 7 }
+ { \exp_not:N \midrule }
+ }
}
- \tl_put_right:Nx \l_nmc_result_tl { \__nmc_table_form_lower: }
- \__nmc_table_reuse:
+ \tl_put_right:Nx \l__nmc_result_tl { \__nmc_table_form_lower: }
+ \bool_if:NF \l__nmc_num_only_bool
+ {
+ \bool_gset_false:N \g__nmc_reuse_bool
+ \tl_gset:Nx \g__nmc_reuse_tl { \exp_not:o \l__nmc_result_tl }
+ }
}
- \l_nmc_result_tl
+ \int_if_zero:nT \l__nmc_dbg_int
+ { \l__nmc_result_tl }
}
\cs_new:Npn \__nmc_table_upper:
{
@@ -585,29 +735,29 @@
#1 \exp_not:N \multicolumn
{ \int_eval:n { \l__nmc_table_cnum_int } } { c }
{ $ \exp_not:o { \l__nmc_table_ctitle_tl } $ }
- #2 \tabularnewline
+ #2 \\~
\__nmc_if_mod_zero:nnT { \l__nmc_table_rules_int } { 3 }
{ \exp_not:N \cmidrule(lr) { #3-\int_eval:n { #4 } } }
- \tl_if_empty:NF \l__nmc_table_cmidrow_tl
- { \__nmc_table_cmidrow: \tabularnewline }
+ \tl_if_empty:NF \l__nmc_table_csubttl_tl
+ { \__nmc_table_csubttl: \\~ }
\__nmc_if_mod_zero:nnT { \l__nmc_table_rules_int } { 5 }
- { \__nmc_table_cmidrow_rule:nn { #3 } { #4 } }
+ { \__nmc_table_csubttl_rule:nn { #3 } { #4 } }
}
%%%%%%%%%
-\cs_new:Npn \__nmc_table_cmidrow:
+\cs_new:Npn \__nmc_table_csubttl:
{
\int_if_zero:nF { \l__nmc_table_cnum_int }
{
\int_case:nnF { \l__nmc_table_rpos_int }
{
- { 0 } { \exp_not:o \l__nmc_table_cmidrow_tl }
- { 1 } { & \exp_not:o \l__nmc_table_cmidrow_tl }
- { 2 } { \exp_not:o \l__nmc_table_cmidrow_tl & }
+ { 0 } { \exp_not:o \l__nmc_table_csubttl_tl }
+ { 1 } { & \exp_not:o \l__nmc_table_csubttl_tl }
+ { 2 } { \exp_not:o \l__nmc_table_csubttl_tl & }
}
- { & \exp_not:o \l__nmc_table_cmidrow_tl & }
+ { & \exp_not:o \l__nmc_table_csubttl_tl & }
}
}
-\cs_new:Npn \__nmc_table_cmidrow_rule:nn #1#2
+\cs_new:Npn \__nmc_table_csubttl_rule:nn #1#2
{
\int_compare:nNnTF { \l__nmc_table_rpos_int } > { 2 }
{ \exp_not:N \cmidrule(lr) { 1-\__nmc_table_total_cols: } }
@@ -746,7 +896,7 @@
\cs_new:Npn \__nmc_table_header_nudge:Nnn #1#2#3
{ % #1=r(ow)/c(ol), #2=var, #3=nudge
- \tl_if_eq:cNTF { l__nmc_table_ #1 calign_tl } \c__nmc_r_tl
+ \tl_if_eq:cNTF { l__nmc_table_ #1 calign_tl } \c__nmc_r_tl
{ $ #2 #3 $ }
{
\tl_if_eq:cNTF { l__nmc_table_ #1 calign_tl } \c__nmc_l_tl
@@ -753,13 +903,30 @@
{ $ #3 #2 $ } { $ #2 $ }
}
}
-%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cs_new_protected:Npn \__nmc_table_form_body:N #1
- { % #1 \l_nmc_result_tl
+ { % #1 <== \l__nmc_result_tl
\int_if_zero:nF { \l__nmc_table_rpos_int }
- {
- \__nmc_table_form_rvcol:NN
- \l__nmc_table_rvraw_seq \l__nmc_table_rvcol_seq
+ {
+ \int_set_eq:NN \l__nmca_int \l__nmc_frac_out_int
+ \int_set_eq:NN \l__nmc_frac_out_int \l__nmc_table_rfrac_int
+ \int_set_eq:NN \l__nmc_table_rfrac_int \l__nmca_int
+ \int_if_zero:nTF { \l__nmc_table_rverb_int }
+ {
+ \seq_clear:N \l_tmpa_seq
+ \seq_map_inline:Nn \l__nmc_table_rvraw_seq
+ {
+ \__nmc_num_format:nNnN { ##1 } \l_tmpa_tl
+ { \l__nmc_table_rround_int } \c_false_bool
+ \seq_put_right:NV \l_tmpa_seq \l_tmpa_tl
+ }
+ \__nmc_table_form_rvcol:NN \l_tmpa_seq \l__nmc_table_rvcol_seq
+ }
+ {
+ \__nmc_table_form_rvcol:NN
+ \l__nmc_table_rdata_seq \l__nmc_table_rvcol_seq
+ }
+ \int_set_eq:NN \l__nmc_frac_out_int \l__nmc_table_rfrac_int
}
\int_zero:N \l__nmc_table_rbloc_int
\int_if_zero:nTF { \l__nmc_table_cnum_int }
@@ -771,11 +938,9 @@
\seq_clear:N \l_tmpb_seq
\seq_map_variable:NNn #1 \l_tmpa_tl
{
- \__nmc_num_format:nNnN \l_tmpa_tl \l_tmpb_tl
- { \l__nmc_table_rround_int } \c_false_bool
\seq_put_right:Nx \l_tmpb_seq
- { \exp_not:o \l__nmc_table_rfont_tl { \l_tmpb_tl } }
- }
+ { \exp_not:o \l__nmc_table_rfont_tl { \exp_not:o \l_tmpa_tl } }
+ }
\seq_set_eq:NN #2 \l_tmpb_seq
\int_compare:nNnTF { \l__nmc_table_rpos_int } > { 3 }
{ \__nmc_table_form_rvcoli:NN #1 #2 } % reverse/pivot
@@ -795,12 +960,12 @@
}
}
\cs_new_protected:Npn \__nmc_table_form_body_rvcol_only:N #1
- { % #1 = \l_nmc_result_tl
+ { % #1 = \l__nmc_result_tl
\seq_clear:N \l_tmpb_seq
\seq_map_variable:NNn \l__nmc_table_rvcol_seq \l_tmpa_tl
{
\tl_put_right:Nx #1
- { \exp_not:o \l_tmpa_tl \tabularnewline }
+ { \exp_not:o \l_tmpa_tl \\~ }
\__nmc_table_rbloc_spc:NN \l__nmc_table_rbloc_int \l_tmpa_bool
\bool_if:NT \l_tmpa_bool
{
@@ -810,18 +975,15 @@
}
}
\cs_new_protected:Npn \__nmc_table_form_body_cvcols:N #1
- { % #1 \l_nmc_result_tl
+ { % #1 \l__nmc_result_tl
\seq_clear:N \l_tmpd_seq
\seq_map_variable:NNn \l__nmc_table_body_cols_seq \l_tmpa_seq
- {
+ {
\seq_clear:N \l_tmpb_seq
\__nmc_table_form_cols:NN \l_tmpa_seq \l_tmpb_seq
\seq_put_right:NV \l_tmpd_seq \l_tmpb_seq
}
- \bool_if:NT \l__nmc_table_footops_bool
- { \__nmc_table_footops:N \l_tmpd_seq }
\__nmc_table_transpose:NN \l_tmpd_seq \l__nmc_table_body_rows_seq
-
\seq_map_variable:NNn \l__nmc_table_body_rows_seq \l_tmpa_seq
{
\__nmc_table_rbloc_spc:NN \l__nmc_table_rbloc_int \l_tmpa_bool
@@ -828,53 +990,12 @@
\tl_put_right:Nx #1
{
\seq_use:Nn \l_tmpa_seq { & }
- \tabularnewline
+ \\~
\bool_if:NT \l_tmpa_bool
{ \exp_not:o \addlinespace[\l__nmc_table_blocsep_tl] }
}
}
}
-\cs_new_protected:Npn \__nmc_table_footops:N #1
- {
- \group_begin:
- \seq_clear:N \l_tmpb_seq
- \seq_set_split:NnV \l_tmpa_seq { & } \l__nmc_table_footer_tl
- \int_if_odd:nT { \l__nmc_table_rpos_int }
- {
- \seq_pop:NN \l_tmpa_seq \l_tmpa_tl
- \seq_put_left:NV \l_tmpb_seq \l_tmpa_tl
- }
- \seq_mapthread_function:NNN #1 \l_tmpa_seq \__nmc_table_footops:nn
- \int_compare:nNnT { \l__nmc_table_rpos_int } > { 1 }
- {
- \seq_pop:NN \l_tmpa_seq \l_tmpa_tl
- \seq_put_right:NV \l_tmpb_seq \l_tmpa_tl
- }
- \tl_set:Nx \l__nmc_table_footer_tl { \seq_use:Nn \l_tmpb_seq { & } }
- \exp_args:NNNV
- \group_end:
- \tl_set:Nn \l__nmc_table_footer_tl \l__nmc_table_footer_tl
- }
-\cs_new_protected:Npn \__nmc_table_footops:nn #1#2
- {
- \tl_set:Nn \l_tmpc_seq { #1 }
- \tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l_tmpc_seq { + } }
- \fp_set:Nn \l_tmpa_fp { \l_tmpa_tl }
- \fp_set:Nn \l_tmpb_fp { \l_tmpa_fp / \l__nmc_table_rnum_int }
- \__nmc_num_format:nNnN \l_tmpa_fp \l__nmc_table_csum_tl
- { \l__nmc_round_int } \l__nmc_sci_num_out_bool
- \__nmc_num_format:nNnN \l_tmpb_fp \l__nmc_table_cave_tl
- { \l__nmc_round_int } \l__nmc_sci_num_out_bool
- \tl_set:Nx \l_tmpa_tl { max(\seq_use:Nn \l_tmpc_seq { , }) }
- \fp_set:Nn \l_tmpa_fp { \l_tmpa_tl }
- \__nmc_num_format:nNnN \l_tmpa_fp \l__nmc_table_cmax_tl
- { \l__nmc_round_int } \l__nmc_sci_num_out_bool
- \tl_set:Nx \l_tmpa_tl { min(\seq_use:Nn \l_tmpc_seq { , }) }
- \fp_set:Nn \l_tmpb_fp { \l_tmpa_tl }
- \__nmc_num_format:nNnN \l_tmpb_fp \l__nmc_table_cmin_tl
- { \l__nmc_round_int } \l__nmc_sci_num_out_bool
- \seq_put_right:Nx \l_tmpb_seq { $ #2 $ }
- }
\cs_new_protected:Npn \__nmc_table_transpose:NN #1#2
{ % #1 seq of seq in #2 seq of seq out
\int_if_zero:nF { \l__nmc_table_rpos_int }
@@ -899,7 +1020,7 @@
}
}
\cs_new:Npn \__nmc_table_rbloc_spc:NN #1#2
- { %
+ {
\int_incr:N #1
\bool_set_false:N #2
\int_compare:nNnT { #1 } = { \l__nmc_table_rblock_tl }
@@ -923,16 +1044,16 @@
{ \__nmc_table_form_cols_riii:NN #1#2 }
}
\cs_new_protected:Npn \__nmc_table_form_cols_ri:NN #1#2
- {
+ {
\seq_pop:NN #1 \l_tmpb_fp
\__nmc_num_format:nNnN \l_tmpb_fp \l_tmpb_tl
{ \l__nmc_round_int } \l__nmc_sci_num_table_bool
\bool_if:NT \l__nmc_table_QA_bool
{ \__nmc_table_QA:N \l_tmpb_tl }
- \seq_put_right:Nx #2 { \exp_not:o \l_tmpb_tl }
+ \seq_put_right:Nx #2 { \exp_not:o \l_tmpb_tl }
}
\cs_new_protected:Npn \__nmc_table_form_cols_rii:NN #1#2
- {
+ {
\__nmc_table_form_cols_rii_aux:NN #1#2
\__nmc_table_signs:
\__nmc_num_format:nNnN \l_tmpb_fp \l_tmpb_tl
@@ -957,13 +1078,12 @@
\seq_put_right:Nx #2
{ \exp_not:o \l_tmpb_tl \exp_not:o \l__nmc_table_diff_tl }
\int_if_zero:nF \l__nmc_table_diffs_int
- { \__nmc_table_calc_diffs:nn
- { \l_tmpb_fp } { \l_tmpa_fp } }
+ { \__nmc_table_calc_diffs:nn { \l_tmpb_fp } { \l_tmpa_fp } }
\fp_set_eq:NN \l_tmpb_fp \l_tmpa_fp
}
\cs_new_protected:Npn \__nmc_table_form_cols_riii:NN #1#2
{
- \__nmc_table_form_cols_rii_aux:NN #1#2
+ \__nmc_table_form_cols_rii_aux:NN #1#2
\int_set_eq:NN \l__nmc_table_c_int \l__nmc_table_b_int
\int_set_eq:NN \l__nmc_table_b_int \l__nmc_table_a_int
\seq_map_variable:NNn #1 \l_tmpa_fp
@@ -999,7 +1119,9 @@
\__nmc_table_t_format:wN #1\q_stop \l_tmpa_tl
\tl_set_eq:NN #1 \l_tmpa_tl
}
- { \tl_set:Nx #1 { \__nmc_sci_num_table_signs:n { #1 } } }
+ { \tl_set:Nx #1 { \__nmc_sci_num_table_signs:n { #1 } }
+
+ }
}
{ \tl_set:Nx #1 { \__nmc_sci_num_table_signs:n { #1 } } }
\bool_if:NT \l__nmc_table_QA_bool
@@ -1012,7 +1134,7 @@
\bool_lazy_and:nnT
{ \l__nmc_num_only_bool } { !\l__nmc_table_num_only_bool }
{
- \tl_set_eq:NN \l__nmc_table_num_only_tl \l_tmpb_tl
+ \tl_set_eq:NN \l__nmc_table_num_only_tl #1
\bool_set_true:N \l__nmc_table_num_only_bool
}
\tl_set:Nx #1 { \l__nmc_table_A_tl }
@@ -1059,93 +1181,18 @@
}
%%%%%%%%%%%%%%%%%%%
\cs_new:Npn \__nmc_table_form_lower:
- {
+ {
\tl_if_empty:NF \l__nmc_table_footer_tl
{
\__nmc_if_mod_zero:nnT { \l__nmc_table_rules_int } { 11 }
- { \exp_not:N \midrule[\cmidrulewidth] }
- \exp_not:o \l__nmc_table_footer_tl \tabularnewline
+ { \exp_not:N \cmidrule(lr) { 1-\__nmc_table_total_cols: } }
+ \exp_not:o \l__nmc_table_footer_tl \\~
}
\__nmc_if_mod_zero:nnT { \l__nmc_table_rules_int } { 13 }
{ \exp_not:N \bottomrule }
\exp_not:n { \end{tabular} }
}
-%%%%%%%%%%%%%%%%%%%
-\cs_new_protected:Npn \__nmc_table_reuse:
- {
- \bool_if:NF \l__nmc_num_only_bool
- {
- \int_case:nnF { \int_sign:n { \l__nmc_table_reuse_int } }
- {
- { -1 } { \__nmc_table_reuse_row:n { \l__nmc_table_reuse_int } }
-
- { 1 } { \__nmc_table_reuse_col:n { \l__nmc_table_reuse_int } }
- }
- { \tl_gset:Nx \g__nmc_reuse_tl { \exp_not:o \l_nmc_result_tl } }
- }
- }
-\cs_new_protected:Npn \__nmc_table_reuse_row:n #1
- {
- \tl_set:Nx \l_tmpa_seq
- { \seq_item:Nn \l__nmc_table_body_rows_seq { -#1 } }
- \tl_gset:Nx \g__nmc_reuse_tl { \seq_use:Nn \l_tmpa_seq { , } }
- }
-\cs_new_protected:Npn \__nmc_table_reuse_col:n #1
- {
- \int_zero:N \l_tmpa_int
- \seq_map_variable:NNn \l__nmc_table_body_cols_seq \l_tmpa_seq
- {
- \int_incr:N \l_tmpa_int
- \int_compare:nNnT { \l_tmpa_int } = { #1 }
- {
- \seq_mapthread_function:NNN \l__nmc_table_rvraw_seq
- \l_tmpa_seq \__nmc_table_reuse:nn
- \seq_map_break:
- }
- }
- }
-\cs_new_protected:Npn \__nmc_table_reuse:nn #1#2
- {
- \__nmc_num_format:nNnN { #1 } \l_tmpa_tl
- { \l__nmc_table_rround_int } \c_false_bool
- \__nmc_num_format:nNnN { #2 } \l_tmpb_tl
- { \l__nmc_round_int } \l__nmc_sci_num_out_bool
- \int_if_zero:nTF \l__nmc_table_rpos_int
- { \seq_put_right:NV \l_nmc_table_reuse_seq \l_tmpb_tl }
- {
- \seq_put_right:Nx \l_nmc_table_reuse_seq
- { { \l_tmpa_tl , \l_tmpb_tl } }
- }
- \tl_gset:Nx \g__nmc_reuse_tl { \seq_use:Nn \l_nmc_table_reuse_seq {,} }
- }
%------------------------------------------------
-\keys_define:nn { numerica-tables }
- {
- table-rvar-rounding .int_set:N = \l__nmc_table_rround_int,
- table-rvar-col-pos .int_set:N = \l__nmc_table_rpos_int,
- table-rvar-align .tl_set:N = \l__nmc_table_rcalign_tl,
- table-cvar-align .tl_set:N = \l__nmc_table_ccalign_tl,
- table-block-sep .tl_set:N = \l__nmc_table_blocsep_tl,
- table-rules .tl_set:N = \l__nmc_table_rules_tl,
- table-form-diffs .int_set:N = \l__nmc_table_diffs_int,
- table-reuse .int_set:N = \l__nmc_table_reuse_int,
- table-vert-align .tl_set:N = \l__nmc_table_valign_tl,
- table-rvar-rounding .default:n = 1,
- table-rvar-align .default:n = r,
- table-rvar-col-pos .default:n = 1,
- table-cvar-align .default:n = r,
- table-block-sep .default:n = 1ex,
- table-rules .default:n = ThB,
- table-form-diffs .default:n = 0,
- table-reuse .default:n = 0,
- table-vert-align .default:n = m
- }
-\keys_set_known:nn { numerica-tables }
- {
- table-rvar-rounding,table-rvar-align,table-rvar-col-pos,
- table-cvar-align,table-block-sep,table-rules,table-fontsize,
- table-form-diffs,table-reuse
- }
\cs_new_protected:Npn \__nmc_table_set_rcnum:nn #1#2
{
\__nmc_fpify_set:Nn \l_tmpb_fp { #1 }
@@ -1152,60 +1199,78 @@
\int_set:cn { l__nmc_table_ #2 num_int } { \fp_to_int:N \l_tmpb_fp }
}
\cs_generate_variant:Nn \__nmc_table_set_rcnum:nn { V }
+
+\cs_new_protected:Npn \__nmc_table_rvfile:n #1
+ {
+ \file_get:nnNTF { #1 } {} \l_tmpa_tl
+ { \seq_set_from_clist:No \l__nmc_table_rdata_seq \l_tmpa_tl }
+ { \__nmc_error_what:n { File~#1~not~found~in } }
+ }
\keys_define:nn { numerica/table }
{
- rvar .tl_set:N = \l__nmc_table_rvar_tl,
- rstop .tl_set:N = \l__nmc_table_rstop_tl,
- rstep .tl_set:N = \l__nmc_table_rstep_tl,
- rows .code:n = \__nmc_table_set_rcnum:nn { #1 } { r },
- rspec .clist_set:N = \l__nmc_table_rspec_clist,
- rround .int_set:N = \l__nmc_table_rround_int,
- rfont .code:n = \tl_set:Nn \l__nmc_table_rfont_tl
- { \use:c { math#1 } },
- ralign .tl_set:N = \l__nmc_table_rcalign_tl,
- rhead .tl_set:N = \l__nmc_table_rhead_tl,
- rhnudge .code:n = \tl_set:Nn \l__nmc_table_rhnudge_tl
- { \mkern #1 mu },
- rpos .int_set:N = \l__nmc_table_rpos_int,
- rvar' .tl_set:N = \l__nmc_table_rvari_tl,
- rhead' .tl_set:N = \l__nmc_table_rheadi_tl,
- rhnudge' .code:n = \tl_set:Nn \l__nmc_table_rhnudgei_tl
- { \mkern #1 mu },
+ view .code:n = \__nmc_dbg_int:nn { 1 } { 11 },
%
- cvar .tl_set:N = \l__nmc_table_cvar_tl,
- cstop .tl_set:N = \l__nmc_table_cstop_tl,
- cstep .tl_set:N = \l__nmc_table_cstep_tl,
- cols .code:n = \__nmc_table_set_rcnum:nn { #1 } { c },
- cspec .clist_set:N = \l__nmc_table_cspec_clist,
- calign .tl_set:N = \l__nmc_table_ccalign_tl,
- chstyle .int_set:N = \l__nmc_table_chstyle_int,
- chnudge .code:n = \tl_set:Nn \l__nmc_table_chnudge_tl
- { \mkern #1 mu },
- chead .tl_set:N = \l__nmc_table_chead_tl,
- chround .int_set:N = \l__nmc_table_chround_int,
+ rvar .tl_set:N = \l__nmc_table_rvar_tl,
+ rstop .tl_set:N = \l__nmc_table_rstop_tl,
+ rstep .tl_set:N = \l__nmc_table_rstep_tl,
+ rows .code:n = \__nmc_table_set_rcnum:nn { #1 } { r },
+ rspec .clist_set:N = \l__nmc_table_rspec_clist,
+ rfunc .tl_set:N = \l__nmc_table_rfunc_tl,
+ rdata .code:n = \tl_if_single:nTF { #1 }
+ { \seq_set_from_clist:NN \l__nmc_table_rdata_seq #1 }
+ { \seq_set_from_clist:No \l__nmc_table_rdata_seq { ~#1 } },
+ rfile .code:n = \__nmc_table_rvfile:n { #1 },
+ rverb .int_set:N = \l__nmc_table_rverb_int,
+ rfrac .int_set:N = \l__nmc_table_rfrac_int,
+ rfrac .initial:n = 0,
+ rround .int_set:N = \l__nmc_table_rround_int,
+ rround .initial:n = 1,
+ rfont .code:n = \tl_set:Nn \l__nmc_table_rfont_tl
+ { \use:c { math#1 } },
+ ralign .tl_set:N = \l__nmc_table_rcalign_tl,
+ ralign .initial:n = r,
+ rhead .tl_set:N = \l__nmc_table_rhead_tl,
+ rhnudge .code:n = \tl_set:Nn \l__nmc_table_rhnudge_tl
+ { \mkern #1 mu },
+ rpos .int_set:N = \l__nmc_table_rpos_int,
+ rpos .initial:n = 1,
+ rvar' .tl_set:N = \l__nmc_table_rvari_tl,
+ rhead' .tl_set:N = \l__nmc_table_rheadi_tl,
+ rhnudge' .code:n = \tl_set:Nn \l__nmc_table_rhnudgei_tl
+ { \mkern #1 mu },
%
- ctitle .tl_set:N = \l__nmc_table_ctitle_tl,
- cmidrow .tl_set:N = \l__nmc_table_cmidrow_tl,
- rules .tl_set:N = \l__nmc_table_rules_tl,
- foot .tl_set:N = \l__nmc_table_footer_tl,
- rbloc .clist_set:N = \l__nmc_table_rbloc_clist,
- rblocsep .tl_set:N = \l__nmc_table_blocsep_tl,
- signs .int_set:N = \l__nmc_table_signs_int,
- (pad) .int_set:N = \l__nmc_table_tsigns_int,
- diffs .int_set:N = \l__nmc_table_diffs_int,
+ cvar .tl_set:N = \l__nmc_table_cvar_tl,
+ cstop .tl_set:N = \l__nmc_table_cstop_tl,
+ cstep .tl_set:N = \l__nmc_table_cstep_tl,
+ cols .code:n = \__nmc_table_set_rcnum:nn { #1 } { c },
+ cspec .clist_set:N = \l__nmc_table_cspec_clist,
+ calign .tl_set:N = \l__nmc_table_ccalign_tl,
+ calign .initial:n = r,
+ chstyle .int_set:N = \l__nmc_table_chstyle_int,
+ chnudge .code:n = \tl_set:Nn \l__nmc_table_chnudge_tl
+ { \mkern #1 mu },
+ chead .tl_set:N = \l__nmc_table_chead_tl,
+ chround .int_set:N = \l__nmc_table_chround_int,
%
- Q? .tl_set:N = \l__nmc_table_Q_tl,
- A! .tl_set:N = \l__nmc_table_A_tl,
- reuse .int_set:N = \l__nmc_table_reuse_int,
- valign .code:n = \tl_set:Nn \l__nmc_table_valign_tl { [#1] },
- multifn .code:n = \bool_set_true:N \l__nmc_table_multifn_bool
- \tl_if_blank:nTF { #1 }
- { \tl_set:Nn \l__nmc_table_fnsep_tl { , } }
- { \tl_set:Nn \l__nmc_table_fnsep_tl { #1 } }
+ ctitle .tl_set:N = \l__nmc_table_ctitle_tl,
+ csubttl .tl_set:N = \l__nmc_table_csubttl_tl,
+ csubttl .tl_set:N = \l__nmc_table_csubttl_tl,
+ header .int_set:N = \l__nmc_table_header_int,
+ header .initial:n = 1,
+ rules .tl_set:N = \l__nmc_table_rules_tl,
+ rules .initial:n = ThB,
+ foot .tl_set:N = \l__nmc_table_footer_tl,
+ rbloc .clist_set:N = \l__nmc_table_rbloc_clist,
+ rblocsep .tl_set:N = \l__nmc_table_blocsep_tl,
+ rblocsep .initial:n = 1ex,
+ signs .int_set:N = \l__nmc_table_signs_int,
+ (pad) .int_set:N = \l__nmc_table_tsigns_int,
+ diffs .int_set:N = \l__nmc_table_diffs_int,
+ diffs .initial:n = 0,
+%
+ Q? .tl_set:N = \l__nmc_table_Q_tl,
+ A! .tl_set:N = \l__nmc_table_A_tl,
+ valign .code:n = \tl_set:Nn \l__nmc_table_valign_tl { [#1] },
+ valign .initial:n = m
}
-\file_if_exist:nT { numerica-tables.cfg }
- {
- \file_get:nnN { numerica-tables.cfg } {} \l_tmpa_tl
- \exp_args:NnV \keys_set_known:nn { numerica-tables } \l_tmpa_tl
- }
% end of `numerica-tables.sty'
\ No newline at end of file
More information about the tex-live-commits
mailing list.