fontspec 和 titlesec 软件包的问题

fontspec 和 titlesec 软件包的问题

我一直在尝试按照以下教程创建简历模板这里

这是我使用的乳胶代码

\documentclass[a4paper,10pt]{article}

%A Few Useful Packages
\usepackage{marvosym}
\usepackage{fontspec}   %load fonts
\usepackage{url,parskip}   %formatting
\usepackage{xunicode,xltxtra}  %other packages for XeTeX
\usepackage{titlesec}

%Graphics - Colors
\RequirePackage{color,graphicx}
\usepackage[usenames,dvipsnames]{xcolor}
%better formatting of the A4 page
\usepackage[big]{layaureo}
%An alternative to Layaureo can be usepackage{fullpage}

\usepackage{supertabular}   %for Grades
\usepackage{titlesec}   %custom section

%Setup hyperref package, and colours for links
\usepackage{hyperref}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks, urlcolor=linkcolour, linkcolor=linkcolour}

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

\titleformat{section}{Largescshaperaggedright}{}{0em}{}[\titlerule]
\titlespacing{section}{0pt}{3pt}{3pt}

我使用 XeTeX 扩展(xelatex resume.tex)对其进行了编译。

我在终端中收到以下错误消息。

kpathsea: Running mktextfm Fontin
/usr/share/texmf/web2c/mktexnam: Could not map source abbreviation F for Fontin.
/usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-texlive/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input Fontin
This is METAFONT, Version 2.718281 (TeX Live 2009/Debian)


kpathsea: Running mktexmf Fontin
! I can't find file `Fontin'.
<*> ...:=ljfour; mag:=1; nonstopmode; input Fontin

Please type another input file name
! Emergency stop.
<*> ...:=ljfour; mag:=1; nonstopmode; input Fontin

Transcript written on mfput.log.
grep: Fontin.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input Fontin' failed to make Fontin.tfm.
kpathsea: Appending font creation commands to missfont.log.

! Font \zf@basefont=Fontin at 10.0pt not loadable: Metric (TFM) file or install
ed font not found.
\zf@fontspec ...ntname \zf@suffix " at \f@size pt 
                                                  \unless \ifzf@icu \zf@set@...
l.26 ...[SmallCapsFont = Fontin SmallCaps]{Fontin}

我猜是因为缺少字体“Fontin”。我下载了“Fontin”,并尝试通过以下方式将其添加为外部字体:

\fontspec
[ Path = /home/primal/fonts/ ,
UprightFont = *-regular ,
BoldFont = *-bold ,
SmallCapsFont = *-SmallCaps ]
{Fontin}

但结果并不理想。

任何帮助都将不胜感激。此外,当我尝试导致错误的那行时,我在下一行收到一条错误消息,指定了各部分的格式。

! Package xkeyval Error: `section' undefined in families `titlesec'.

See the xkeyval package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.28 ...section}{Largescshaperaggedright}{}{0em}{}
                                                  [\titlerule]

答案1

该问题与 XeLateX 或 Fontin 无关。

错误的原因在于\titleformat\titlespacing命令不正确。显然有些反斜杠丢失了。如果你查看 Alessandro 的完整源代码cv.tex或点击他的源代码链接,你会发现它应该是

\titleformat{\section}{\large\scshape\raggedright}{}{0em}{}[\titlerule]
\titlespacing{\section}{0pt}{3pt}{3pt}

顺便说一句,您还可以将 Fontin 文件(或任何其他字体)复制到本地操作系统字体目录(~/.fonts在 Linux 中)如果所有文件都存在,则 fontspec 将自动知道使用哪个文件来表示粗体等。

答案2

尝试从该站点下载软件包并单独安装它们.... http://www.josbuivenga.demon.nl/fontin.html

相关内容