在 XelaTeX 中更改文档的字体

在 XelaTeX 中更改文档的字体

所以我下载了一个简历模板。它使用 XeLaTeX。我想更改字体,但我对自己该如何做失去了希望。我的操作系统是 Windows 7。这是使用原始字体 Fontin 的功能代码。我下载了它以使其工作,我想使用其他东西(以及使用重音符号的东西(我说法语)!)

\documentclass[a4paper,10pt]{article} % Default font size and paper size
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{textpos}
\usepackage{fontspec} % For loading fonts
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}

\usepackage{xunicode,xltxtra,url,parskip} % Formatting packages

\usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors

\usepackage[big]{layaureo} 

\usepackage{hyperref} % Required for adding links   and customizing them
\definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document

\usepackage{titlesec} % Used to customize the \section command
\titleformat{\section}{\Large\raggedright}{}{0em}{} % Text formatting of sections
\titlespacing{\section}{0pt}{2pt}{2pt} % Spacing around sections
\usepackage{vmargin}
\usepackage{fullpage}

\begin{document}
\setmarginsrb{25mm}{0mm}{30mm}{0mm}{1cm}{5mm}{1mm}{10mm}
\pagestyle{empty} % Removes page numbering

\font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the skills section

\par{\Huge TacTac \textsc{TicToc} - OncheOnche \bigskip\par} 
\par{\Huge \hspace{8mm}  huehuehue \bigskip\par}

\section{Données personnelles}
\begin{textblock}{.9}(0,0)
\rule{97mm}{0.09mm}
\end{textblock}
\begin{tabular}{rl}
\textsc{Date de naissance:} & 01 brumeneige 3030 \\
\textsc{Adresse:} & Somewhere, sometimes \\
\textsc{Téléphone:} & +123456789\\
\textsc{Email:} & what about
\end{tabular}


\section{Objectifs}\titlerule

I met a traveler from an antic land who said : Two vast and trunkless legs of stone stand in the desert... \\

%----------------------------------------------------------------------------------------
%   EDUCATION
%-------------------------------------------------------------------------------                      ---------



\end{document}

我相信问题出在

\defaultfontfeatures{Mapping=tex-text}
\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}

但我不知道我必须改变什么,编译器在哪里寻找字体...我看到了其他与我的问题相似的问题,但都使用了 Linux。我还看到字体名称中使用空格可能会出现一些问题(真的吗……?)...无论如何。有人有想法吗?

答案1

将你的文档精简到这个问题所需的最低限度(见最小工作示例(MWE)有关更多详细信息),下面显示了如何使用更改文档的主字体\setmainfont

\documentclass{article}
\usepackage{lipsum} % add nonsense text
\usepackage{fontspec}
    \setmainfont{Arial}

\begin{document}
\lipsum[1]
\end{document}

在此处输入图片描述

答案2

这对我有用:

\documentclass[a4paper,10pt]{article} % Default font size and paper size
\usepackage{fontspec} % For loading fonts
\setmainfont[SmallCapsFont=Fontin SmallCaps]{Fontin-Regular}

\usepackage{url,parskip} % Formatting packages
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{textpos}
\usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors    
\usepackage[big]{layaureo}     

\usepackage{titlesec} % Used to customize the \section command
\titleformat{\section}{\Large\raggedright}{}{0em}{} % Text formatting of sections
\titlespacing{\section}{0pt}{2pt}{2pt} % Spacing around sections
\usepackage{hyperref} % Required for adding links   and customizing them
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document
\definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color

\usepackage{vmargin}
\usepackage{fullpage}

\begin{document}
    \setmarginsrb{25mm}{0mm}{30mm}{0mm}{1cm}{5mm}{1mm}{10mm}
    \pagestyle{empty} % Removes page numbering

    \par{\Huge TacTac \textsc{TicToc} - OncheOnche \bigskip\par} 
    \par{\Huge \hspace{8mm}  huehuehue \bigskip\par}

    \section{Données personnelles}
    \begin{textblock}{.9}(0,0)
        \rule{97mm}{0.09mm}
    \end{textblock}
    \begin{tabular}{rl}
        \textsc{Date de naissance:} & 01 brumeneige 3030 \\
        \textsc{Adresse:} & Somewhere, sometimes \\
        \textsc{Téléphone:} & +123456789\\
        \textsc{Email:} & what about
    \end{tabular}

    \section{Objectifs}\titlerule

    I met a traveler from an antic land who said : Two vast and trunkless legs of stone stand in the desert... \\

    %----------------------------------------------------------------------------------------
    %   EDUCATION
    %-------------------------------------------------------------------------------                      ---------

\end{document}

在此处输入图片描述

相关内容