I'm working on a couple of latex templates that belong together (letter, article, report). I've achieved nearly all my objectives except for a single one, having the font size change using the \documentclass[.pt]{}
command, whether I use 9pt or 12pt my document looks the same. How do I ensure that this works correctly for my custom class?
Just some sidenotes, I use XeLaTex to compile my documents while I install the fonts (DejaVu familiy) with the fontspec package and the \setromanfont{DejaVu Serif}
command. The classes have the option to switch between the serif and the sans-serif font in the family.
Here is my minimal working example:
Consisting of the letter.tex
file.
% !TeX encoding = UTF-8
% !TEX TS-program = xelatex
\documentclass[12pt, british]{letter-Bram}
% Sender information
\signature{Sender Full Name}
\address{Sender\\ Adress line 1\\ Adress line 2\\ Country}
\begin{document}
\begin{letter}{Recipient\\ Organization\\ Adress line 1\\ Adress line 2\\ Country}
\opening{Dear Recipient,}
This letter is send from the sender to the recipient, and styled in a sans-serif font. The class has the following class settings:
\begin{description}
\item[sans] To turn the document and math into a sans serif font.
\item[lanuage] You can specify the language like normal. For example \enquote*{dutch}, \enquote*{british}, \enquote*{german}, defaults to \enquote*{american}. I recommend specifying a language as this does set quotation marks, date notations, hyphenation and others.
\end{description}
Here is an example equation:
\begin{equation}
a x^2 + b x + c = 0
\end{equation}
which can be solved with the standard $abc$ formula.
\closing{Kind Regards,}
\end{letter}
\end{document}
And here is the letter-Bram.cls
class file.
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{letter-Bram}[2019/07/01 v1.1 letter-Bram]
%%%%%%%%%%%%%%%%%%%%%
% NEW CLASS OPTIONS %
%%%%%%%%%%%%%%%%%%%%%
\newif\if@sans
\DeclareOption{sans}{\@sanstrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\LoadClass{letter}
%%%%%%%%%%%%%%%%%
% LOAD PACKAGES %
%%%%%%%%%%%%%%%%%
\usepackage{babel}
\RequirePackage[fleqn]{amsmath} % needs before math font selection
\RequirePackage{csquotes} % proper quotation marks
%%%%%%%%%%%%%%
% LOAD FONTS %
%%%%%%%%%%%%%%
\RequirePackage{fontspec}
\setromanfont{DejaVu Serif} % open serif font.
\setsansfont{DejaVu Sans} % open sans font.
\setmonofont{DejaVu Sans Mono} % open mono font.
\if@sans
\renewcommand{\familydefault}{\sfdefault}
\RequirePackage{arevmath} % math font that is equal in style DejaVu Sans, but better a, nu, omega, l, x ect
\SetSymbolFont{symbols}{bold}{OMS}{zavm}{m}{n} % surpress warning of bold math sybols
\else
\usepackage{unicode-math}
\setmathfont{DejaVu Math TeX Gyre} % math font equal in style and size to DejaVu Serif
\SetSymbolFont{symbols}{bold}{OMS}{zavm}{m}{n}
\fi
I'm fairly sure that I'm missing something very obvious, but can't find it.
Two problems:
your class is loading the letter
class, but pass it's option to the article
class. Make up your mind, which of the two classes you actually want
9pt
is not a valid option, try with 10pt
vs. 12pt
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{letter-Bram}[2019/07/01 v1.1 letter-Bram]
%%%%%%%%%%%%%%%%%%%%%
% NEW CLASS OPTIONS %
%%%%%%%%%%%%%%%%%%%%%
\newif\if@sans
\DeclareOption{sans}{\@sanstrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
\ProcessOptions\relax
\LoadClass{letter}
%%%%%%%%%%%%%%%%%
% LOAD PACKAGES %
%%%%%%%%%%%%%%%%%
\usepackage{babel}
\RequirePackage[fleqn]{amsmath} % needs before math font selection
\RequirePackage{csquotes} % proper quotation marks
%%%%%%%%%%%%%%
% LOAD FONTS %
%%%%%%%%%%%%%%
\RequirePackage{fontspec}
\setromanfont{DejaVu Serif} % open serif font.
\setsansfont{DejaVu Sans} % open sans font.
\setmonofont{DejaVu Sans Mono} % open mono font.
\if@sans
\renewcommand{\familydefault}{\sfdefault}
\RequirePackage{arevmath} % math font that is equal in style DejaVu Sans, but better a, nu, omega, l, x ect
\SetSymbolFont{symbols}{bold}{OMS}{zavm}{m}{n} % surpress warning of bold math sybols
\else
\usepackage{unicode-math}
% \setmathfont{DejaVu Math TeX Gyre} % math font equal in style and size to DejaVu Serif
\SetSymbolFont{symbols}{bold}{OMS}{zavm}{m}{n}
\fi