Latexのフォントを変更する

Latexのフォントを変更する

私は大学の論文規則に従って独自の 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}
...

関連情報