
我努力尋找解決這個問題的 MWE,從我的序言和 SAE 類文件中刪除了幾乎所有內容,直到我發現 siunitx 包似乎不能很好地與 times 字體配合(它與 Helvetica 配合得很好)。
我將從我的類別文件的 MWE 開始,其中我強制 Times 字體符合 SAE 指南及其範本文件:
\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}
現在,這是我在使用這個最小類別檔案時遇到的問題的 MWE:
\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}
你可以看到這裡的問題是什麼......儘管 siunitx 在那裡有全部檢測開關,但 siunitx 的單位是 helvetica,而文檔的其餘部分是時間。這使得整個文件中(不僅僅是在表格中)出現了一些看起來很奇怪的單位。有人看到一個明顯的問題嗎?我真的不太了解寫類文件,我只是想邊走邊撿東西。
答案1
這就是拉丁現代派。您正在使用 Latin Modern Roman、Sans 和 Mono 作為預設字體。更具體地說,您的襯線是 LM Roman,帶有比例的懸掛數字;你的 sans 是 LM Sans,帶有比例的懸掛數字;您的打字機可能是具有比例懸掛數字的可變寬度 LM 打字機。
切勿載入您不知道其用途的內容。
只需將襯線設置為ptm
不會得到好的結果。你的 sans、mono 和所有數學都將採用電腦現代格式。也許,你想要這樣的東西做使用 NimbusRomanNo9L:
\usepackage{mathptmx}
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
此外,您的類別檔案包含幾個虛假空格,且選項處理很混亂。您的班級沒有將9pt
或聲明letter
為有效選項。
也許你想要更多類似這樣的東西:
\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}