3

I've been having difficulty with setting the font size in plain-tex tables (i.e. haligns). I want to set the tables to use seven or (preferably) eight point font, including tables which contain math.

I've attached two attempts, both of which fail for different reasons:

Attempt 1 (with fontch)

\input fontch

% Feel free to ignore next two lines, they're just there to make it prettier.
% I've confirmed that they are not the source of the problem at hand.
\def\booktabspacer{\vrule height 0.9\baselineskip depth 0.4\baselineskip width 0pt \relax }
\def\booktablowspacer{\vrule height 0pt depth 0.5\baselineskip width 0pt \relax}
\def\booktabhighspacer{\vrule height 1.0\baselineskip depth 0pt width 0pt \relax}

\input knuth
\vskip 1cm
% work in progress. font size needs to change.
\halign{\tabskip=0.5em
    \hfill\eightpoint # \hfill & \hfill \eightpoint # \hfill \cr
    \noalign{\hrule height 0.08em}
    \omit \eightpoint\booktabspacer\hfill Item One \hfill &\omit \eightpoint\hfill Item Two \hfill \cr
    \noalign{\hrule height 0.05em}
    \booktabhighspacer
    $s_0$ & $16.2$ \cr
    $s_1$ & $18.2$ \cr
    $s_2$ & $11.3$ \cr
    $s_3$ & $19.0$ \cr
    $s_4$ \booktablowspacer & $15.0$ \cr
    \noalign{\hrule height 0.08em}
}
\vskip 1cm
\input knuth
\bye

This produces the following (the problem is obvious):

fontch attempt

Attempt 2

% Feel free to ignore next two lines, they're just there to make it prettier.
% I've confirmed that they are not the source of the problem at hand.
\def\booktabspacer{\vrule height 0.9\baselineskip depth 0.4\baselineskip width 0pt \relax }
\def\booktablowspacer{\vrule height 0pt depth 0.5\baselineskip width 0pt \relax}
\def\booktabhighspacer{\vrule height 1.0\baselineskip depth 0pt width 0pt \relax}

\input knuth
\vskip 1cm
% work in progress. font size needs to change.
\halign{\tabskip=0.5em
    \hfill\sevenrm # \hfill & \hfill \sevenrm # \hfill \cr
    \noalign{\hrule height 0.08em}
    \omit \sevenrm\booktabspacer\hfill Item One \hfill &\omit \sevenrm\hfill Item Two \hfill \cr
    \noalign{\hrule height 0.05em}
    \booktabhighspacer
    $s_0$ & $16.2$ \cr
    $s_1$ & $18.2$ \cr
    $s_2$ & $11.3$ \cr
    $s_3$ & $19.0$ \cr
    $s_4$ \booktablowspacer & $15.0$ \cr
    \noalign{\hrule height 0.08em}
}
\vskip 1cm
\input knuth
\bye

This produces the following (the problem is the math font size is unchanged):

sevenrm attempt

I have two questions:

1) Why is the fontch attempt so different from what one would expect?

2) What can I do to achieve a table with the font sizes as given in the fontch attempt, but without the ridiculous spacing problem?

1
  • 1
    You're supposed to issue \eightpoint only in vertical mode; add \begingroup\eightpoint after the first \vskip1cm, add \endgroup before the second \vskip1cm and remove \eightpoint from inside \halign.
    – egreg
    Commented Nov 19, 2014 at 9:43

2 Answers 2

2

As commented by egreg, it seems the command is supposed to be used in vertical mode. Additionally, it seems you would like to center the table. Here is one way to achieve this:

\input fontch
\input knuth
$$
\eightpoint
\vcenter{\halign{\tabskip=1em
  $#\hfil$& $#\hfil$\cr
    \omit Item One\hfil& \omit Item Two\hfil\cr
    \noalign{\smallskip\hrule\smallskip}
    s_0& 16.2\cr
    s_1& 18.2\cr
    s_2& 11.3\cr
    s_3& 19.0\cr
    s_4& 15.0\cr}
  }
$$
\input knuth
\bye

(I don't actually have fontch installed, so I don't know if the above actually works :-))

Note that spaces after &'s are discarded, but not the ones before. Also note that the display math mode begins a group, so the change \eightpoint is confined inside of it.

1

The problem with the attempt 1 is the location of the command eightpoint. Try the following code

\input fontch
\def\booktabspacer{\vrule height 0.9\baselineskip depth 0.4\baselineskip width 0pt\relax}
\def\booktablowspacer{\vrule height 0pt depth 0.5\baselineskip width 0pt \relax}
\def\booktabhighspacer{\vrule height 1.0\baselineskip depth 0pt width 0pt \relax}

\input knuth
\vskip 1cm
% work in progress. font size needs to change.
%%%
\eightpoint
%%%
%% Everything is changed to eightpoint, includig all distances that are
%% needed to properly display the text. The eightpoint settings are used
%% untill a new change font commmand is executed. The eightpont commands
%% inside the \halign command are not needed.
%% If you like to center the table uncomment the following line
% $$ \vcenter{
\halign{\tabskip=0.5em
\hfill # \hfill & \hfill  # \hfill \cr
\noalign{\hrule height 0.08em}
\omit \booktabspacer\hfill Item One \hfill &\omit \hfill Item Two \hfill \cr
\noalign{\hrule height 0.05em}
\booktabhighspacer
$s_0$ & $16.2$ \cr
$s_1$ & $18.2$ \cr
$s_2$ & $11.3$ \cr
$s_3$ & $19.0$ \cr
$s_4$ \booktablowspacer & $15.0$ \cr
\noalign{\hrule height 0.08em}
}
%% The following line closes the \vcenter command.
% }$$
%% The next command is needed in order to recover the standard size. If it is
%% not executed TeX continues writing with the eight point font (try it).
%%%
\tenpoint
%%%
\vskip 1cm
\input knuth
\bye
1
  • Welcome to TeX.SX! Commented Dec 6, 2014 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .