4

I am writting my own CLS file to follow the thesis rules of my university. Now that the most part is on par with the rules, I need to change the font of the document.

I've defined several font options because I might use this same template for other essays. "Times New Roman" font does work, but everything else doesn't.

I am using TexStudio.

What should I do now?

Whole document:

\ProvidesClass{template_tese}[2017/01/01 Modelo de Tese/Dissertação]

\newcommand{\Pasta}{Trabalho}
\DeclareOption{TimesNewRoman}{\newcommand{\letterfont}{times}}
\DeclareOption{Arial}{\newcommand{\letterfont}{helvet}}
\DeclareOption{French}{\newcommand{\letterfont}{frcursive}}
\DeclareOption{Normalschrift}{\newcommand{\letterfont}{wedn}}
\DeclareOption{Garamond}{\newcommand{\letterfont}{urw-garamond}}
\DeclareOption{Latin}{\newcommand{\letterfont}{lmodern}}
\DeclareOption{PGothic}{\newcommand{\letterfont}{pgothic}}
\DeclareOption{EGothic}{\newcommand{\letterfont}{egothic}}
\DeclareOption{Emerald}{\newcommand{\letterfont}{emerald}}
\DeclareOption{Frente}{\newcommand{\sides}{oneside}}
\DeclareOption{FrenteVerso}{\newcommand{\sides}{twoside}}
\DeclareOption*{\let\Pasta\CurrentOption}
\newcommand{\Trabalho}{Trabalhos/\Pasta}
\ProcessOptions\relax

\LoadClass[
12pt,
portuguese,
\sides]{report}

% PACKAGES
\usepackage{hyphenat}
\usepackage[utf8]{inputenc}
\usepackage[official]{eurosym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{\letterfont}
\usepackage[T1]{fontenc}
\usepackage{\Trabalho/settings}
\usepackage{\Trabalho/hifen}
\usepackage{graphicx}
\usepackage{subfiles}
\usepackage{geometry}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{graphicx}
\usepackage{chngcntr}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{lipsum}
\usepackage{blindtext}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\pagestyle{fancy}
\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}%
    \fancyhf{}%
    \fancyfoot[R]{\thepage}%
}
\usepackage[hidelinks]{hyperref}

%   DOCUMENT
\linespread{1.25}
\graphicspath{ {\Trabalho/_Images/} }
\newcommand{\logotipoHorizontal}{\includegraphics{\Trabalho/_Images/logotipo_universidade}}
\newcommand{\logotipoVertical}{\includegraphics[scale=0.5]{\Trabalho/_Images/logotipo_universidade_1}}
\renewcommand{\chaptername}{Capítulo } % \Roman{part}
\renewcommand{\contentsname}{Índice}
\renewcommand{\bibname}{Bibliografia}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\renewcommand{\listfigurename}{Índice de Figuras}
\renewcommand{\listtablename}{Índice de Tabelas}
\renewcommand{\figurename}{Figura}
\renewcommand{\tablename}{Tabela}

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=3cm, % Inner margin
    outer=3cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=2.5cm, % Top margin
    bottom=2.5cm, % Bottom margin
}

\begin{document}
% FRONT PAGE
    \thispagestyle{empty}
    \newgeometry{
        paper=a4paper, % Change to letterpaper for US letter
        inner=2.5cm, % Inner margin
        outer=2.5cm, % Outer margin
        bindingoffset=.5cm, % Binding offset
        top=3cm, % Top margin
        bottom=3cm, % Bottom margin
    }

    \begin{adjustwidth}{0cm}{0cm}
        \begin{center}
            \logotipoVertical\\
        \end{center}
    \end{adjustwidth}

    \begin{adjustwidth}{7.5cm}{0cm}
        \pagenumbering{roman}
        { \ } \\ { \ } \\
        \noindent{\large\ \autor}
        \\
        \\\noindent {\large \textbf{\titulo\\}}
        \\
        \\
        \tipo\\
        \\
        \curso\\
        \\
        Dissertação defendida em provas públicas na \universidade\ no dia \dia\ de \mes\ de \ano , perante o júri seguinte:\\
        \juri\\
        \vogais\\
        \\
        Oriendador:\\
        \textbf{\orientador\\}
        \\
        \\
        \\
        \\  
    \end{adjustwidth}
    \pagenumbering{gobble}
    \begin{adjustwidth}{0cm}{0cm}
        \begin{center}
            \mes { } \ano\\
        \end{center}
    \end{adjustwidth}

% CITACAO
    \thispagestyle{empty}
    \newgeometry{
        paper=a4paper, % Change to letterpaper for US letter
        inner=2.5cm, % Inner margin
        outer=2.5cm, % Outer margin
        bindingoffset=.5cm, % Binding offset
        top=10cm, % Top margin
        bottom=3cm, % Bottom margin
    }

    \chapter*{} % Citação

    \begin{adjustwidth}{7.5cm}{0cm}
        \begin{center}
            \subfile{\Trabalho/_Chapters/01_citacao}
        \end{center}
    \end{adjustwidth}
    \pagenumbering{roman}
    \restoregeometry
    \newpage

% AGRADECIMENTOS
    \chapter*{}
    \subfile{\Trabalho/_Chapters/02_agradecimentos}
    \newpage

% DEDICATORIA
    \chapter*{}
    \subfile{\Trabalho/_Chapters/03_dedicatoria}
    \newpage

% RESUMO
    \chapter*{Resumo}
    \subfile{\Trabalho/_Chapters/04_resumo}
    \newpage

% ABSTRACT
    \chapter*{Abstract}
    \subfile{\Trabalho/_Chapters/05_abstract}
    \newpage

% TABLE OF CONTENTS
    \tableofcontents
    \newpage

% TABLE OF FIGURES
    \listoftables
    \listoffigures
    \newpage

% NEW PAGE STYLE
\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}%
    \fancyhf{}%
    \fancyfoot[LE,RO]{\thepage}%
}
\pagenumbering{arabic}
\pagestyle{plain}

% INTRODUCTION
    \chapter*{Introdução}
    \addcontentsline{toc}{chapter}{Introdução}
    \subfile{\Trabalho/_Chapters/06_introducao}
    \newpage

% REVISAO BIBLIOGRAFICA

    \chapter{Revisão Bibliográfica}
    \subfile{\Trabalho/_Chapters/07_revisao_bibliografica}
    \newpage

% PARTE EMPIRICA
    \chapter{Parte Empírica}
    \subfile{\Trabalho/_Chapters/08_parte_empirica}
    \newpage    

% CONCLUSAO
    \chapter*{Conclusão}
    \addcontentsline{toc}{chapter}{Conclusão}
    \subfile{\Trabalho/_Chapters/09_conclusao}
    \newpage

% BIBLIOGRAFIA
    %\chapter*{Bibliografia}
    \addcontentsline{toc}{chapter}{Bibliografia}
    \nocite{*}
    \bibliographystyle{apalike}
    \bibliography{\Trabalho/_Chapters/bibliografia} 

% ANEXOS
    \chapter*{Anexos}
    \addcontentsline{toc}{chapter}{Anexos}
    \subfile{\Trabalho/_Chapters/10_anexos}
    \newpage

\end{document}
Vasco Ferreira
  • 165
  • 1
  • 5
  • 1
    Oh thank god, we have another thesis class. Welcome, and sorry for the sarcasm. – Johannes_B Jan 22 '17 at 15:22
  • I won't test the stuff, but please have a look at How to customize my titlepage and Title Creation in the wikibook. – Johannes_B Jan 22 '17 at 15:24
  • 2
    @Johannes_B Well, yes another thesis class, but what can I do about that? So many different rules for each university. Thank You for the link and I will use it to set a better formatting of my Title page, however I still need to change the font of the whole document. – Vasco Ferreira Jan 22 '17 at 15:37
  • Why don't you pass options to the class you are using and why all the complexity with the options? Are you so sure that you might not need or want to use, say, 11pt or 10pt font rather than 12pt? Just as an example .... I don't see the pressing need to provide options for the fonts since all you're doing is loading a package, but if you must, a key-value interface would be better so you can still pass unknown options onto the class rather than trying to make them into fonts. – cfr Jan 24 '17 at 01:50
  • It is particularly useful to be able to use draft mode in your document, especially if the document is long like a thesis. Where does the class end? Where does the document begin? – cfr Jan 24 '17 at 01:51
  • I guess will have to remake the template to be more practical. Indeed I was only interested in just using 12pt for now, but as I become more used to Latex I will have to make a more useful one. I will check about draft mode. Thank You. – Vasco Ferreira Jan 24 '17 at 20:21

1 Answers1

2

The class sets up options to choose fonts, e.g., \documentclass[lmodern]{template_tese}. This option has to match a package installed on your system.

The class just defines \letterfont to be a macro for the option name, and then later on, gives the command \usepackage{\letterfont}.

So lmodern should work for sure if you have a TeXLive installation, because \usepackage{lmodern} works. I'm not sure about all the other packages, which might be out of date.


EDIT

An alternative is to bypass the class's font mechanisms and do it yourself, which may be simpler. Here I use the tgheros package, which gives you TeX Gyre Heros font, based on Helvetica/Arial.

\documentclass{template_tese}
\usepackage{tgheros}
\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
...
musarithmia
  • 12,463
  • When I tried to use for the first time those other fonts, my texstudio asked for permission to install them, so I believe they should be installed. My problem is that I need to use Arial font for my essays, and only the times new roman font works. – Vasco Ferreira Jan 22 '17 at 18:19
  • I manage to make it work with the following code \DeclareOption{Arial}{ \newcommand{\letterfont}{uarial} \renewcommand{\familydefault}{\sfdefault} } and later on: \usepackage[default]{\letterfont} \usepackage[T1]{fontenc} – Vasco Ferreira Jan 23 '17 at 18:36
  • I edited the answer to show a simpler way of doing the same. I don't have a uarial package in my full TeXLive installation, but tgheros provides a font similar to Arial. – musarithmia Jan 23 '17 at 19:38
  • 1
    uarial is one of the fonts provided by the non-free-fonts script i.e. can't be distributed as part of TL itself due to licensing restrictions. – cfr Jan 24 '17 at 01:43