我想使用coloredlettrine
包,据我所知,需要一个版本的EB Garamond 字体它比 TeX Live 2015 提供的要新。我正尝试按照这个答案但我卡在了第一步(“首先安装 opentype 字体...”)。
我下载并解压了EBGaramond-0.016.zip
。里面是一组 OpenType (.OTF) 文件。我该如何安装这些文件?只需将它们复制到~/texmf/fonts/opentype/ebgaramond
并运行texhash
,如上述答案所建议的那样,无法编译coloredlettrine.dtx
没有字体错误。TeX.SE 上的其他答案(例如这个) 建议使用autoinst
脚本,但是这也不起作用。也就是说,运行autoinst EBGaramond-InitialsF1.otf
似乎成功了,但是编译coloredlettrine.dtx
仍然给我以下错误:
$ xelatex coloredlettrine.dtx
This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./coloredlettrine.dtx
LaTeX2e <2015/01/01>
[...]
kpathsea: Running mktextfm EBGaramondInitialsF1
/home/myusername/opt/texlive/2015/texmf-dist/web2c/mktexnam: Could not map source abbreviation E for EBGaramondInitialsF1.
/home/myusername/opt/texlive/2015/texmf-dist/web2c/mktexnam: Need to update /home/myusername/opt/texlive/2015/texmf-dist/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input EBGaramondInitialsF1
This is METAFONT, Version 2.7182818 (TeX Live 2015) (preloaded base=mf)
kpathsea: Running mktexmf EBGaramondInitialsF1
! I can't find file `EBGaramondInitialsF1'.
<*> ...=1; nonstopmode; input EBGaramondInitialsF1
Please type another input file name
! Emergency stop.
<*> ...=1; nonstopmode; input EBGaramondInitialsF1
Transcript written on mfput.log.
grep: EBGaramondInitialsF1.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input EBGaramondInitialsF1' failed to make EBGaramondInitialsF1.tfm.
kpathsea: Appending font creation commands to missfont.log.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "EBGaramondInitialsF1" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.32 ...BLettrineBackFont{\EBLettrineBackFontname}
?
最小非工作示例,如评论中所要求的:
cd /tmp
wget -OEBGaramond-0.016.zip https://bitbucket.org/georgd/eb-garamond/downloads/EBGaramond-0.016.zip
unzip EBGaramond-0.016.zip
cd EBGaramond-0.016/otf
autoinst EBGaramond-InitialsF1.otf
cd /tmp
git clone https://github.com/raphink/coloredlettrine.git
cd coloredlettrine
xelatex coloredlettrine.ins
xelatex coloredlettrine.dtx
(这用于安装似乎想要的autoinst
第一个(也可能是唯一一个?)字体。)coloredlettrine.dtx
答案1
在不了解您的操作系统或其他任何有关设置的信息的情况下,我无法说出您在安装时遇到的问题coloredlettrine
。但如果您使用xetex
或进行编译luatex
,则无需安装字体(这是和TEXMFHOME
的一大优势),您可以自己完成需要的操作。xetex
luatex
coloredlettrine
只需将字体安装为系统字体(如何操作取决于您的操作系统),然后按照以下步骤操作,根据需要调整颜色和大小:
\documentclass[12pt,svgnames]{octavo}
\usepackage{fontspec,lettrine,microtype,xcolor}
\setmainfont{EB Garamond}[
Contextuals=Alternate,
Ligatures=Rare,
ItalicFeatures={Ligatures=Contextual}]
\newfontface\initbg{EB Garamond Initials Fill1}[
Color=DarkGoldenrod]
\newfontface\initfg{EB Garamond Initials Fill2}[
Color=Maroon]
\setcounter{DefaultLines}{3}
\renewcommand{\DefaultLoversize}{-.15}
\renewcommand{\DefaultLraise}{.23}
\begin{document}
\lettrine{\initbg A\llap{\initfg A}}{vicenna} autem ex multis
et per alia media concludit idem. Hic enim primo ostendit, quod anima
rationalis non est virtus in corpore, ita quod secundum esse vel
operationem vel utrumque ad corporis harmoniam dependeat.
\end{document}
您可以将相同的技术用于您可能拥有的其他分层字体,而该coloredlettrine
软件包仅适用于 EB Garamond。或者,如果您更新软件包中的几个命令,您可以让该软件包适用于其他字体,但它仅适用于两层,而通过自己处理重叠,您可以使用字体所具有的尽可能多的层:
\documentclass[12pt,latin]{octavo}
\usepackage{babel,fontspec,lettrine,microtype,xcolor}
\setmainfont{LTC Californian Pro Text}
\newfontface\bg{LTC Goudy Initials}[
Color=292929]
\newfontface\fg{LTC Goudy Initials Fill}[
Color=800B00]
\newfontface\flor{LTC Goudy Initials Flora}[
Color=398000]
\setcounter{DefaultLines}{5}
\renewcommand{\DefaultLoversize}{-.25}
\renewcommand{\DefaultLhang}{.03}
\renewcommand{\DefaultLraise}{.17}
\begin{document}
\lettrine{{\bg\textbackslash}\llap{\fg A}\llap{\flor A}}{vicenna}
autem ex multis et per alia media concludit idem. Hic enim primo
ostendit, quod anima rationalis non est virtus in corpore, ita quod
secundum esse vel operationem vel utrumque ad corporis harmoniam
dependeat.
\end{document}
您还可以借助 为 EB Garamond 制作自己的背景图块\fcolorbox
。在这里,我插入了 -2 点的字距,以弥补我为 分配的 2 点值\fboxsep
;否则字母 A 将无法与装饰层完美对齐:
\documentclass[12pt,latin,svgnames]{octavo}
\usepackage{babel,fontspec,lettrine,microtype,xcolor}
\setmainfont{EB Garamond}[
Contextuals=Alternate,
Ligatures=Rare,
ItalicFeatures={Ligatures=Contextual}]
\newfontface\initbg{EB Garamond Initials Fill1}[
Color=Green]
\newfontface\initfg{EB Garamond Initials Fill2}[
Color=DarkRed]
\setcounter{DefaultLines}{3}
\renewcommand{\DefaultLoversize}{-.17}
\renewcommand{\DefaultLraise}{.23}
\setlength{\DefaultFindent}{3pt}% to make room for the background tile
\fboxsep=2pt% padding thickness
\fboxrule=0pt% border thickness
\begin{document}
\lettrine{\fcolorbox{black}{black}{\initbg A}\kern-2pt\llap{\initfg
A}}{vicenna} autem ex multis et per alia media concludit idem. Hic
enim primo ostendit, quod anima rationalis non est virtus in corpore,
ita quod secundum esse vel operationem vel utrumque ad corporis
harmoniam dependeat.
\end{document}