我正在编写自己的 CLS 文件以遵循我所在大学的论文规则。现在大部分内容都符合规则,我需要更改文档的字体。
我定义了几种字体选项,因为我可能会在其他文章中使用相同的模板。“Times New Roman”字体确实有效,但其他字体都无效。
我正在使用 TexStudio。
我现在应该怎么做?
整个文档:
\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}
答案1
该类设置了选择字体的选项,例如\documentclass[lmodern]{template_tese}
。此选项必须与系统上安装的包相匹配。
该类仅定义\letterfont
为选项名称的宏,然后给出命令\usepackage{\letterfont}
。
所以lmodern
如果你安装了 TeXLive,它肯定能用,因为\usepackage{lmodern}
它能用。我不确定其他软件包是否能用,因为它们可能已经过时了。
编辑
另一种方法是绕过类的字体机制并自己动手,这可能更简单。在这里我使用包tgheros
,它为您提供基于 Helvetica/Arial 的 TeX Gyre Heros 字体。
\documentclass{template_tese}
\usepackage{tgheros}
\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
...