2

I worked hard to find a MWE for this issue, stripping out just about everything from my preamble and my SAE class file until I discovered that it seems the siunitx package does not play well with the times font (it works fine with Helvetica).

I'll start with an MWE of my class file, in which I have forced the times font to comply with SAE guidelines and their template files:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{saeRyan}[2016/02/23 SAE Technical paper format^^J]

% Option for the "Times New Roman" font
\DeclareOption{times}{%
  \renewcommand{\familydefault}{ptm}%
  \typeout{^^JSetting document font to Times^^J}%
  }

% Option for letter size paper (U.S.)
\DeclareOption{letterpaper}{%

% Define the margins for letter size paper (0.5" margins all the way around) using the geometry package.
\PassOptionsToPackage{letterpaper,nohead,left=.5in,top=.5in,right=.5in,textheight=10in}{geometry}%
  \typeout{^^JPaper size: Letter^^J}%
  \AtBeginDocument{ \columnsep .5in }
  }

\DeclareOption{pdftex}{%
  \PassOptionsToClass{\CurrentOption}{article}%
  \PassOptionsToPackage{\CurrentOption}{geometry}
  }

\DeclareOption{nonumber}{%
  \pagestyle{empty}%
  }

% This handles any options that are not understood by the class.
\DeclareOption*{\typeout{^^JOption [\CurrentOption] not supported by this style.^^J}}

% Default Options
\ExecuteOptions{times,letter,9pt}
\ProcessOptions

% The extarticle class allows for 9 pt font as the normalsize font.
\LoadClass[twocolumn,9pt]{extarticle}

Now here is a MWE of the issue I'm having with using this minimum class file:

\documentclass[letterpaper]{saeRyan}

%\usepackage{lmodern}
\usepackage[detect-all]{siunitx} 
\usepackage{enumitem,booktabs,cfr-lm}
\usepackage{tabularx}
\usepackage[referable]{threeparttablex}
\renewlist{tablenotes}{enumerate}{1}

% This package is for convenience in making notes during the revision process.
%\usepackage[colorinlistoftodos]{todonotes}

\begin{document}

\begin{table}[h]
    \footnotesize
    \centering
        \begin{tabular}{ll}
        \toprule
        times vs. helvetica using siunitx: & \SI{110}{\micro\meter} 110 micrometers (correct font)\\
        \bottomrule
    \end{tabular}
  \caption{Font Test}\label{tab:test}
\end{table}

\end{document}

enter image description here

You can see what the problem is here... despite siunitx having the detect-all switch in there, the unit of siunitx is helvetica while the rest of the document is times. This makes for some weird looking units throughout the document (not just in tables). Anybody see an obvious problem? I really don't know much about writing class files, I'm just trying to pick things up as I go.

0

1 Answer 1

5

That's Latin Modern. You are using Latin Modern Roman, Sans and Mono as your default fonts. More specifically, your serif is LM Roman with proportional, hanging figures; your sans is LM Sans with proportional, hanging figures; and your typewriter is probably variable-width LM typewriter with proportional, hanging figures.

Never load that which you know not what it does.

Simply setting serif to ptm is not going to get good results. Your sans, mono and all of your maths will be in Computer Modern. Probably, you want something like this which does use NimbusRomanNo9L:

  \usepackage{mathptmx}
  \usepackage[scaled=.90]{helvet}
  \usepackage{courier}

In addition, your class file contains several spurious spaces and the option handling is confused. Your class does not declare either 9pt or letter as valid options.

Probably you want something more like this:

\begin{filecontents}{saeRyan.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{saeRyan}[2016/02/23 SAE Technical paper format]

\newif\iftimesfont\timesfontfalse
% Option for the "Times New Roman" font
\DeclareOption{times}{%
  \timesfonttrue
  \typeout{Setting document font to Times, with complementary sans, typewriter and mathematics fonts.}%
}

% Option for letter size paper (U.S.)
\DeclareOption{letterpaper}{%
% Define the margins for letter size paper (0.5" margins all the way around) using the geometry package.
\PassOptionsToPackage{letterpaper,nohead,left=.5in,top=.5in,right=.5in,textheight=10in}{geometry}%
  \typeout{Paper size: Letter}%
  \AtBeginDocument{\columnsep .5in}%
}

\DeclareOption{nonumber}{%
  \pagestyle{empty}%
}

% This handles any options that are not understood by the class.
\DeclareOption*{\typeout{Option [\CurrentOption] not supported by this style.}}

% Default Options
\ExecuteOptions{times,letterpaper}
\ProcessOptions

% The extarticle class allows for 9 pt font as the normalsize font.
\LoadClass[twocolumn,9pt]{extarticle}
\iftimesfont
  \RequirePackage{mathptmx}
  \RequirePackage[scaled=.90]{helvet}
  \RequirePackage{courier}
\fi
\endinput
\end{filecontents}
\documentclass[letterpaper]{saeRyan}
\usepackage[detect-all]{siunitx}
\usepackage{enumitem,booktabs}
\usepackage{tabularx}
\usepackage[referable]{threeparttablex}
\renewlist{tablenotes}{enumerate}{1}
\begin{document}
\begin{table}[h]
  \footnotesize
  \centering
  \begin{tabular}{ll}
    \toprule
    times vs.\ helvetica using siunitx: & \SI{110}{\micro\meter} 110 micrometers (correct font)\\
    \bottomrule
  \end{tabular}
  \caption{Font Test}\label{tab:test}
\end{table}
\end{document}

modified class for Nimbus Roman No. 9

2
  • With a bunch of fiddling with various fonts, this definitely improved my class file and fixed the issue. I did end up using newtxtext and newtxmath rather than mathptmx, helvet, and courier. mathptmx I guess is deprecated on CTAN in favor of the newtx packages. Plus the newtx packages had the bold and upright math fonts I needed for certain things.
    – R.K.G.
    Feb 24, 2016 at 17:57
  • @R.K.G. That's probably better, yes. mathptmx is a safer recommendation because it is part of PSNFSS and so will be included in even quite minimal installations. I like the TeX Gyre clones of these fonts best, I think, and there are maths packages which support their use in the same way as mathptmx/newtx etc.
    – cfr
    Feb 24, 2016 at 21:42

You must log in to answer this question.

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