
我正在嘗試使用 colorlettrine 套件。我安裝了 EB Garamond 軟體包,但很快就發現只支援少數字母。例如,如果我嘗試 S,它會顯示為一個空框。
我可以嘗試一些替代方案來達到類似的效果嗎?
有誰知道我可以做哪些工作來增加更多角色?
答案1
歡迎來到 TeX.SE。coloredlettrine
之所以不同,是因為每個字形都由兩個部分組成:正面(字母)和背面(裝飾)。這創造了以不同於裝飾的方式對字母進行著色的機會。然而,正如您所發現的,只有幾個字母可用:A、F、G、L、N、O、Q 和 T。
有相當多帶有裝飾性首字母的字體可用於產生lettrines。請參閱TUG字體目錄。我使用該GoudyIn
套件來存取 Goudy Initialen 字體。
該lettrine
軟體包還提供了使用圖形作為字母的選項。我將這種方法與我在網路上某處撿到的一些裝飾字母一起使用。我很遺憾沒有註明出處。
% Compile with xelatex or lualatex
% The two EB Garamond Initials fonts must be installed to use \coloredlettrine.
% Graphics with the file names m.jpg, n.jpg and o.jpg, or any
% other graphic file format must be available to use \lettrine[image...
\documentclass[10pt,a4paper]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{fontspec}
%https://github.com/raphink/coloredlettrine; also on CTAN
\usepackage{coloredlettrine} %loads [svgnames]{xcolor} and {lettrine}
% Requires 2 fonts:
% EB Garamond Initials Fill1 Regular
% EB Garamond Initials Fill2 Regular
\setmainfont[RawFeature={+ss02,+cv01,+ss05,+dlig},
ItalicFeatures={RawFeature=+cv04}]{EB Garamond}
\renewcommand{\EBLettrineBackColor}{NavyBlue}
\renewcommand{\EBLettrineFrontColor}{Maroon}
\usepackage{lettrine}
\usepackage{GoudyIn}
\usepackage[svgnames]{xcolor}
\renewcommand\LettrineFontHook{\color{Maroon}\GoudyInfamily{}}%
\renewcommand{\LettrineTextFont}{}
\newcommand*{\mylettrine}[1]{\lettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{#1}{}}
\begin{document}
\coloredlettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{A}{apt}\linebreak
\coloredlettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{G}{apt}\linebreak
\coloredlettrine[lines=1,realheight=false,findent=3pt,nindent=0pt]{T}{apt}\linebreak
\renewcommand\LettrineFontHook{\color{Maroon}\GoudyInfamily{}}%
\renewcommand{\LettrineTextFont}{}
\mylettrine{A}{apt}
\mylettrine{B}{apt}
\mylettrine{C}{apt}
\lettrine[image,lines=1,realheight=false,findent=3pt,nindent=0pt]{M}{apt}
\lettrine[image,lines=1,realheight=false,findent=3pt,nindent=0pt]{N}{apt}
\lettrine[image,lines=1,realheight=false,findent=3pt,nindent=0pt]{O}{apt}
\end{document}