0

I am trying to build a LaTeX class the reproduces my organization's branded Word template, based on the report class. I have most of the elements worked out, except for one aspect. When a report identifies authors, our style guide calls for the title page to include "Prepared by [names]" in 14 point, italic Georgia font. For some reason I can't get it to be both italic and Georgia in the title page.

If it's Georgia in the title page, it ignores the italics. I can get it to be italic if I don't insist on Georgia. It isn't that the italic version of the font isn't available--the main body of the text is also Georgia, and I can italicize there just fine--the problem only appears in the title page. I've tried several different italicizing commands, and with calling them before or after the \fontfamily{} call, but none of them do anything when the font is Georgia in the title page.

Here's a MWE of the class:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass.cls}

% MWE to demonstrate italicizing issue with Georgia font in title page

% Call packages required to make the title page work
\RequirePackage[T1]{fontenc}
\RequirePackage{helvet}
\RequirePackage{color}
\RequirePackage{setspace}
\RequirePackage{ragged2e}


\RequirePackage{anyfontsize}
\RequirePackage{graphicx}
\RequirePackage{tikz}
\RequirePackage{ulem}


% Define colors
\definecolor{titlegray}{RGB}{60,60,59}



\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}} % Pass any other options through to the report class
\ExecuteOptions{hidelinks}
\ProcessOptions\relax % Run the options
\LoadClass{report} % Now load the report class as a base

\def\subtitle#1{\gdef\@subtitle{#1}}

% Redefine \maketitle to produce the CFPB report title page

\renewcommand{\maketitle}{
\begin{titlepage} % Enclose in a titlepage environment
\normalem
 % All the text in this environment is sans-serif/Arial
\sffamily

%Bold agency name and date; the \textls increases the cerning slightly to match the Arial Bold font
\textls[100]{\textbf{\sffamily\small\MakeUppercase{Bureau of Agency Departments \ \ $|$ \ \ \@date}}}

% Then the main title 1.75" down in size 38 font
\vspace{1.31in}
{\fontsize{38}{40}\selectfont \@title \par}

%Subtitle 1/2" below that in size 16 font
\vspace{.5in}
{\fontsize{16}{18}\sffamily\selectfont \@subtitle \par}

%Authors 1/2" below that in size 16 italic, serif font
\vspace{0.5in}
 {\itshape\fontsize{16}{18}\fontfamily{georgia}\selectfont \textit{\@author} \par}
 \newpage
\end{titlepage}
}

% All classes have to define \normalsize 
\renewcommand{\normalsize}{\fontsize{12}{16}\selectfont}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}



% The microtype package is needed to typeset the title page correctly, but needs \normalsize to be defined before it's called, so calling now, instead of with the other required packages.
\RequirePackage{microtype}

% Main doc uses georgia throughout
\fontfamily{georgia}\selectfont

And here's the MWE for a document

\documentclass{myclass}
\usepackage[top=1in,left=1in,bottom=1in,right=1in]{geometry}

\title{A Report}
\author{Prepared by The Preparors}
\subtitle{Great Report Series \#5}
\date{April 2023}


\begin{document}

\maketitle
This is some Georgia Text

\textit{This is some italic Georgia text}

\end{document}

I'm running pdfLaTeX in Overleaf, if it matters.

4
  • Unrelated but using \fontfamily{georgia}\selectfont to setup the main font is wrong, this will be overwritten in many places. Do something like \renewcommand\rmdefault{georgia}. Beside this you will have to show how geogia is setup (it is not in texlive). Commented Feb 17, 2023 at 14:26
  • Are you free to compile your document with either XeLaTeX or LuaLaTeX?
    – Mico
    Commented Feb 17, 2023 at 15:05
  • @Mico, Overleaf does let me choose a compiler, so that's an option, though I'd prefer not, both because pdfLaTeX is the default and I'm trying to make this as out-of-the-box as I can for other users, and because when I tried switching to another compiler I got some errors.
    – rsandler
    Commented Feb 17, 2023 at 15:13
  • @UlrikeFischer Actually, not unrelated. If I make the change you suggest, put \sffamily in the title, subtitle and header lines instead of globally for the titlepage environment, and cut the \fontfamily from the author line, it works and italicized correctly! Would you like to post that as an answer?
    – rsandler
    Commented Feb 17, 2023 at 18:53

1 Answer 1

0

(Credit here to the comment by Ulrike Fischer; I'm happy to accept their answer instead if they post one)

I'm still unclear as to why the less-global font declaration let me make the author line Georgia, or italic, but not both. However, for anyone who stumbles on this question with a similar problem, the fix is to redefine the default font, rather than just putting a font switch in the class file.

The issue here is that declaring Georgia font for the main text using \fontfamily{georgia}\selectfont can be overridden by various environments. The better way to declare the main font in the class is with \renewcommand\rmdefault{georgia}. Then, omitting the \fontfamily{georgia}\selectfont in the author line of the \titlepage definition causes italics to be respected.

So the MWE for the class becomes:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass.cls}

% MWE to demonstrate italicizing issue with Georgia font in title page

% Call packages required to make the title page work
\RequirePackage[T1]{fontenc}
\RequirePackage{helvet}
\RequirePackage{color}
\RequirePackage{setspace}
\RequirePackage{ragged2e}


\RequirePackage{anyfontsize}
\RequirePackage{graphicx}
\RequirePackage{tikz}
\RequirePackage{ulem}


% Define colors
\definecolor{titlegray}{RGB}{60,60,59}



\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}} % Pass any other options through to the report class
\ExecuteOptions{hidelinks}
\ProcessOptions\relax % Run the options
\LoadClass{report} % Now load the report class as a base

\def\subtitle#1{\gdef\@subtitle{#1}}

% Redefine \maketitle to produce the CFPB report title page

\renewcommand{\maketitle}{
\begin{titlepage} % Enclose in a titlepage environment
\normalem

%Bold agency name and date; the \textls increases the cerning slightly to match the Arial Bold font
\textls[100]{\textbf{\sffamily\small\MakeUppercase{Bureau of Agency Departments \ \ $|$ \ \ \@date}}}

% Then the main title 1.75" down in size 38 font
\vspace{1.31in}
{\fontsize{38}{40}\sffamily\selectfont \@title \par}

%Subtitle 1/2" below that in size 16 font
\vspace{.5in}
{\fontsize{16}{18}\sffamily\selectfont \@subtitle \par}

%Authors 1/2" below that in size 16 italic, serif font
\vspace{0.5in}
 {\itshape\fontsize{16}{18}\textit{\@author} \par}
 \newpage
\end{titlepage}
}

% All classes have to define \normalsize 
\renewcommand{\normalsize}{\fontsize{12}{16}\selectfont}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}



% The microtype package is needed to typeset the title page correctly, but needs \normalsize to be defined before it's called, so calling now, instead of with the other required packages.
\RequirePackage{microtype}

% Main doc uses georgia throughout
\renewcommand\rmdefault{georgia}

You must log in to answer this question.

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