Mico Loretan
2011-04-01 14:08:55 UTC
Greetings all,
First, some background: I've been put in charge of developing a style
file to govern all formatting aspects of working papers issued by my
organization. One of the more questionable requirements is that all
materials in table and figure floats must be set in Helvetica, scaled
to have the same x-height as the font (Times New Roman, TNR for short)
that must be used in the main body of the papers. The scaling factor
works out to be roughly 0.86. (Please, no remarks pointing out that
the combination of these two fonts isn't great...) I've worked out in
the meantime that a combination of redefining the "table" environment
and using the siunitx package gets (almost) all of this task done.
The following MWE illustrates (i) a redefinition of LaTeX's "table"
environment to switch automatically to the sans-serif font and (ii)
the use of the siunitx package with the "detect-all" switch set to
force numbers in a tabular column, which would normally be printed in
a math-italic font, to be set using Helvetica as well. The first
column, which is provided mainly for reference, is formatted using
LaTeX's standard "c" (centering) mode. (The numbers are not aligned on
the decimal separator, and what should be a minus sign is rendered
using the hyphen glyph. However, all elements in this column are set
in the correct, i.e., 5-point, size.) The second column uses the "S"
column type of siunitx with the "detect-all" switch set. The third
column uses the default (i.e., "detect-none") mode of the S-column
type; not surprisingly, it uses the "standard" math-italics font
that's in effect, i.e., TNR, and also uses the default font size.
Everything seems to be working perfectly except for the following:
With the "detect-all" switch set, the sizes of the "minus sign" and of
the "decimal point" in the middle column of the table seem to be those
that are appropriate for material set in "10 point" (the default body
font size) rather than for the (scaled) 5-point font that's in effect
everywhere else in the table. Could this be a bug in siunitx? If it is
not, is there some switch that can be set to force these symbols to be
set in the proper size? Thanks in advance for any advice on this
issue.
Sincerely,
Mico
MWE:
\documentclass{article}
\usepackage{mathptmx,siunitx}
\usepackage[scaled=0.5]{helvet}
\makeatletter
\renewenvironment{table}%
{\renewcommand{\familydefault}{\sfdefault}\selectfont
\@float{table}}
{\***@float}
\makeatother
\begin{document}
\begin{table}
\caption{Font: Helvetica, scaled 50\% relative to main body font
(Times New Roman)}
\begin{center}
\begin{tabular}{cS[detect-all]S}
\multicolumn{1}{c}{``c'' column type} &
\multicolumn{1}{c}{``S'' column type, detect-all mode} &
\multicolumn{1}{c}{``S'' column type, default (i.e., detect-none)
mode} \\
1.2 & 1.2 & 1.2\\
-3.4 & -3.4 & -3.4\\
\end{tabular}
\end{center}
\end{table}
\end{document}
First, some background: I've been put in charge of developing a style
file to govern all formatting aspects of working papers issued by my
organization. One of the more questionable requirements is that all
materials in table and figure floats must be set in Helvetica, scaled
to have the same x-height as the font (Times New Roman, TNR for short)
that must be used in the main body of the papers. The scaling factor
works out to be roughly 0.86. (Please, no remarks pointing out that
the combination of these two fonts isn't great...) I've worked out in
the meantime that a combination of redefining the "table" environment
and using the siunitx package gets (almost) all of this task done.
The following MWE illustrates (i) a redefinition of LaTeX's "table"
environment to switch automatically to the sans-serif font and (ii)
the use of the siunitx package with the "detect-all" switch set to
force numbers in a tabular column, which would normally be printed in
a math-italic font, to be set using Helvetica as well. The first
column, which is provided mainly for reference, is formatted using
LaTeX's standard "c" (centering) mode. (The numbers are not aligned on
the decimal separator, and what should be a minus sign is rendered
using the hyphen glyph. However, all elements in this column are set
in the correct, i.e., 5-point, size.) The second column uses the "S"
column type of siunitx with the "detect-all" switch set. The third
column uses the default (i.e., "detect-none") mode of the S-column
type; not surprisingly, it uses the "standard" math-italics font
that's in effect, i.e., TNR, and also uses the default font size.
Everything seems to be working perfectly except for the following:
With the "detect-all" switch set, the sizes of the "minus sign" and of
the "decimal point" in the middle column of the table seem to be those
that are appropriate for material set in "10 point" (the default body
font size) rather than for the (scaled) 5-point font that's in effect
everywhere else in the table. Could this be a bug in siunitx? If it is
not, is there some switch that can be set to force these symbols to be
set in the proper size? Thanks in advance for any advice on this
issue.
Sincerely,
Mico
MWE:
\documentclass{article}
\usepackage{mathptmx,siunitx}
\usepackage[scaled=0.5]{helvet}
\makeatletter
\renewenvironment{table}%
{\renewcommand{\familydefault}{\sfdefault}\selectfont
\@float{table}}
{\***@float}
\makeatother
\begin{document}
\begin{table}
\caption{Font: Helvetica, scaled 50\% relative to main body font
(Times New Roman)}
\begin{center}
\begin{tabular}{cS[detect-all]S}
\multicolumn{1}{c}{``c'' column type} &
\multicolumn{1}{c}{``S'' column type, detect-all mode} &
\multicolumn{1}{c}{``S'' column type, default (i.e., detect-none)
mode} \\
1.2 & 1.2 & 1.2\\
-3.4 & -3.4 & -3.4\\
\end{tabular}
\end{center}
\end{table}
\end{document}