我想使用 ebgaramond 字体,我可以使用“latex”来使用它,但是,此包中没有可用的粗体字体。是否可以设置 LaTeX 文档,以便从其他包(例如 times 或 euler 等)获取粗体字体?
非常感谢!
答案1
EBGaramond 与 Monotype Garamond Bold
此示例在 pdfLaTeX 中将 EBGaramond 与 Monotype 的 Garamond 混合。请注意,此代码将不是按照为您编写的进行编译。您需要用合适的替代字体来替换我使用的粗体 Garamond。(或者,如果您有相同的字体,请在您的机器上配置 TeX 支持。)
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scale=0.95]{ebgaramond}
\usepackage{kantlipsum}
\pdfmapfile{+mgm.map}
\usepackage{filecontents}
\begin{filecontents}{T1EBGaramond-OsF.fd}
\ProvidesFile{T1EBGaramond-OsF.fd}
\expandafter\ifx\csname EBGaramond@scale\endcsname\relax
\let\EBGaramond@@scale\@empty
\else
\edef\EBGaramond@@scale{s*[\csname EBGaramond@scale\endcsname]}%
\fi
\DeclareFontFamily{T1}{EBGaramond-OsF}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sc}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{n}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{it}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{scit}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sw}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{nw}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{n}{
<-> mgmb8t
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sc}{
<-> mgmbc8t
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{it}{
<-> mgmb8t
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sl}{
<-> mgmb8t
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{scsl}{ <-> ssub * EBGaramond-OSF/m/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sl}{ <-> ssub * EBGaramond-OsF/m/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{scit}{ <-> ssub * EBGaramond-OsF/b/sc }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sw}{ <-> ssub * EBGaramond-OsF/b/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{nw}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{scsl}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sc}{ <-> ssub * EBGaramond-OsF/b/sc }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{n}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{it}{ <-> ssub * EBGaramond-OsF/b/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{scit}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sw}{ <-> ssub * EBGaramond-OsF/b/sw }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{nw}{ <-> ssub * EBGaramond-OsF/b/nw }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{scsl}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sl}{ <-> ssub * EBGaramond-OsF/b/it }{}
\endinput
\end{filecontents}
\begin{document}
\section{A section}
\kant[1]
\noindent{\bfseries \kant[1]}
ABC \textbf{ABC} abc \textbf{abc}
\end{document}
EBGaramond 以 Medium URW Garamond 为粗体
此示例采用 URW Garamond 的中等系列来显示粗体文本。您可以使用getnonfreefonts-sys
TeX Live 中的脚本来安装它。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage{kantlipsum}
\usepackage{filecontents}
\begin{filecontents}{T1EBGaramond-OsF.fd}
\ProvidesFile{T1EBGaramond-OsF.fd}
\expandafter\ifx\csname EBGaramond@scale\endcsname\relax
\let\EBGaramond@@scale\@empty
\else
\edef\EBGaramond@@scale{s*[\csname EBGaramond@scale\endcsname]}%
\fi
\DeclareFontFamily{T1}{EBGaramond-OsF}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sc}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{n}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{it}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{scit}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sw}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{nw}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{n}{
<-> ugmm8t
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{it}{
<-> ugmmi8t
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{scsl}{ <-> ssub * EBGaramond-LF/m/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sl}{ <-> ssub * EBGaramond-OsF/m/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sl}{<->ssub * EBGaramond-OsF/b/it}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sc}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{scit}{ <-> ssub * EBGaramond-OsF/b/sc }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sw}{ <-> ssub * EBGaramond-OsF/b/sl }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{nw}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{scsl}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sc}{ <-> ssub * EBGaramond-OsF/b/sc }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{n}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{it}{ <-> ssub * EBGaramond-OsF/b/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{scit}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sw}{ <-> ssub * EBGaramond-OsF/b/sw }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{nw}{ <-> ssub * EBGaramond-OsF/b/nw }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{scsl}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sl}{ <-> ssub * EBGaramond-OsF/b/it }{}
\endinput
\end{filecontents}
\begin{document}
\section{A section}
\kant[1]
\noindent{\bfseries \kant[1]}
ABC \textbf{ABC} abc \textbf{abc}
\end{document}
请注意,与 EBGaramond 相比,URW Garamond 包含一组受限制的字体形状。因此,例如,小型大写粗体将以非小型大写直立中等字体排版,因为没有中等小型大写字体可用。
EBGaramond 带扩展 URW Garamond Bold
这使用garamondx
中提供的 URW 系列的扩展字体garamond
。您可能希望调整缩放比例,如其他示例所示。与garamond
提供标准 URW Garamond 的字体一样,garamondx
可以使用 进行安装getnonfreefonts-sys
。
Olstyle 人物
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scale=1.05]{ebgaramond}
\usepackage{kantlipsum}
\usepackage{filecontents}
\begin{filecontents}{T1EBGaramond-OsF.fd}
\ProvidesFile{T1EBGaramond-OsF.fd}
\expandafter\ifx\csname EBGaramond@scale\endcsname\relax
\let\EBGaramond@@scale\@empty
\else
\edef\EBGaramond@@scale{s*[\csname EBGaramond@scale\endcsname]}%
\fi
\expandafter\ifx\csname zgm@Scale\endcsname\relax
\let\zgm@@Scale\@empty
\else
\edef\zgm@@Scale{s*[\csname zgm@Scale\endcsname]}%
\fi
\def\zgm@tmp{\ifzgm@swq \def\zgm@@swq{-swq}\fi}
\let\zgm@@swq\@empty
\ifdefined\zgm@swqtrue
\zgm@tmp
\fi
\DeclareFontFamily{T1}{EBGaramond-OsF}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sc}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{n}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{it}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{scit}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sw}{
<-> \EBGaramond@@scale EBGaramond12-Italic-osf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{nw}{
<-> \EBGaramond@@scale EBGaramond12-Regular-osf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{n}{
<-> \zgm@@Scale T1-zgm-b-osfI\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{it}{
<-> \zgm@@Scale T1-zgm-bi-osfI\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sc}{
<-> \zgm@@Scale T1-zgm-b-osfI-sc\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{scit}{
<-> \zgm@@Scale T1-zgm-bi-osfI-sc\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{scsl}{ <-> ssub * EBGaramond-LF/m/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{m}{sl}{ <-> ssub * EBGaramond-OsF/m/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{scsl}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sl}{<->ssub * EBGaramond-OsF/b/it}{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{sw}{ <-> ssub * EBGaramond-OsF/b/sl }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{b}{nw}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sc}{ <-> ssub * EBGaramond-OsF/b/sc }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{n}{ <-> ssub * EBGaramond-OsF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{it}{ <-> ssub * EBGaramond-OsF/b/it }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{scit}{ <-> ssub * EBGaramond-OsF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sw}{ <-> ssub * EBGaramond-OsF/b/sw }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{nw}{ <-> ssub * EBGaramond-OsF/b/nw }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{scsl}{ <-> ssub * EBGaramond-OsF/bx/scit }{}
\DeclareFontShape{T1}{EBGaramond-OsF}{bx}{sl}{ <-> ssub * EBGaramond-OsF/bx/it }{}
\endinput
\end{filecontents}
\begin{document}
\section{A section}
\kant[1]
\noindent{\bfseries \kant[1]}
ABC \textbf{ABC} abc \textbf{abc}
\end{document}
衬线图
这是上面 EBGaramond 示例的变体,带有 Extended URW Garamond 粗体。此示例使用衬线数字,而不是旧式数字。
\end{document}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scale=1.05,lining]{ebgaramond}
\usepackage{filecontents}
\begin{filecontents}{T1EBGaramond-LF.fd}
\ProvidesFile{T1EBGaramond-LF.fd}
\expandafter\ifx\csname EBGaramond@scale\endcsname\relax
\let\EBGaramond@@scale\@empty
\else
\edef\EBGaramond@@scale{s*[\csname EBGaramond@scale\endcsname]}%
\fi
\expandafter\ifx\csname zgm@Scale\endcsname\relax
\let\zgm@@Scale\@empty
\else
\edef\zgm@@Scale{s*[\csname zgm@Scale\endcsname]}%
\fi
\def\zgm@tmp{\ifzgm@swq \def\zgm@@swq{-swq}\fi}
\let\zgm@@swq\@empty
\ifdefined\zgm@swqtrue
\zgm@tmp
\fi
\DeclareFontFamily{T1}{EBGaramond-LF}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{sc}{
<-> \EBGaramond@@scale EBGaramond12-Regular-lf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{n}{
<-> \EBGaramond@@scale EBGaramond12-Regular-lf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{it}{
<-> \EBGaramond@@scale EBGaramond12-Italic-lf-t1
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{scit}{
<-> \EBGaramond@@scale EBGaramond12-Italic-lf-sc-t1
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{sw}{
<-> \EBGaramond@@scale EBGaramond12-Italic-lf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{nw}{
<-> \EBGaramond@@scale EBGaramond12-Regular-lf-swash-t1
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{n}{
<-> \zgm@@Scale T1-zgm-b-lf\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{it}{
<-> \zgm@@Scale T1-zgm-bi-lf\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{sc}{
<-> \zgm@@Scale T1-zgm-b-lf-sc\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{scit}{
<-> \zgm@@Scale T1-zgm-bi-lf-sc\zgm@@swq
}{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{scsl}{ <-> ssub * EBGaramond-LF/m/scit }{}
\DeclareFontShape{T1}{EBGaramond-LF}{m}{sl}{ <-> ssub * EBGaramond-LF/m/it }{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{scsl}{ <-> ssub * EBGaramond-LF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{sl}{<->ssub * EBGaramond-LF/b/it}{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{sw}{ <-> ssub * EBGaramond-LF/b/sl }{}
\DeclareFontShape{T1}{EBGaramond-LF}{b}{nw}{ <-> ssub * EBGaramond-LF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{sc}{ <-> ssub * EBGaramond-LF/b/sc }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{n}{ <-> ssub * EBGaramond-LF/b/n }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{it}{ <-> ssub * EBGaramond-LF/b/it }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{scit}{ <-> ssub * EBGaramond-LF/b/scit }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{sw}{ <-> ssub * EBGaramond-LF/b/sw }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{nw}{ <-> ssub * EBGaramond-LF/b/nw }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{scsl}{ <-> ssub * EBGaramond-LF/bx/scit }{}
\DeclareFontShape{T1}{EBGaramond-LF}{bx}{sl}{ <-> ssub * EBGaramond-LF/bx/it }{}
\endinput
\end{filecontents}
\begin{document}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\textbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
abcdefghijklmnopqrstuvwxyz
\textbf{abcdefghijklmnopqrstuvwxyz}
0123456789
\textbf{0123456789}
\end{document}
扩展的 URW Garamond 中等和粗体
这些示例根本没有使用 EBGaramond。相反,它们采纳了 Speravir 的建议,并使用了 提供的garamondx
中等和粗体扩展字体。
古式人物
\documentclass{article}
\usepackage[full]{textcomp}
\usepackage[osfI]{garamondx}
\usepackage{kantlipsum}
\begin{document}
\section{A section}
\kant[1]
\noindent{\bfseries \kant[1]}
ABC \textbf{ABC} abc \textbf{abc}
衬线图
\documentclass{article}
\usepackage[full]{textcomp}
\usepackage{garamondx}
\begin{document}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\textbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
abcdefghijklmnopqrstuvwxyz
\textbf{abcdefghijklmnopqrstuvwxyz}
0123456789
\textbf{0123456789}
\end{document}
答案2
我真的很想劝阻您不要将 Garamond 中等粗细直立斜体字体与Times
类似粗体和粗斜体字体混合使用。(顺便说一句,我不确定您为什么euler
在查询中提到这一点,因为它是一种纯数学字体,因此完全不适合连续文本。)
如果您必须与其他 Garamond 字体混合搭配EB Garamond
,最好使用 LuaLaTeX 或 XeLaTeX。一定要小心均衡所使用的各种字体的 x 高度。在下面的示例中,EB Garamond
是直立和斜体,并Adobe Garamond Pro
用于大胆的和粗斜体。有两条\setmainfont
指令;第一条仅加载EB Garamond
,第二条使用Scale=MatchLowercase
Bold 和 Bold-Italics 字体上的字体功能。
% !TEX TS-program = lualatex %% xelatex works too
\documentclass{article}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\setmainfont[BoldFeatures = {Scale=MatchLowercase},
BoldFont = Adobe Garamond Pro Bold,
BoldItalicFeatures = {Scale=MatchLowercase},
BoldItalicFont = Adobe Garamond Pro Bold Italic,
Ligatures = {TeX,Common}]
{EB Garamond}
\begin{document}
\section*{A section title}
Normal \emph{italics} {\bfseries bold} {\itshape\bfseries bold-italics}
\end{document}
答案3
\documentclass{article}
\usepackage{ebgaramond}
\begin{document}
abc \textbf{xyz}
\end{document}
警告你没有粗体:
LaTeX Font Info: Font shape `OT1/EBGaramond-OsF/bx/n' in size <10> not avail
able
(Font) Font shape `OT1/EBGaramond-OsF/m/n' tried instead on input
line 7.
这来自
\DeclareFontShape{OT1}{EBGaramond-OsF}{bx}{n}{ <-> ssub * EBGaramond-OsF/m/n }{}
因此你可以(但我不会)指定不同的替换:
\documentclass{article}
\usepackage{ebgaramond}
\begin{document}
\DeclareFontShape{OT1}{EBGaramond-OsF}{bx}{n}{ <-> ssub * cmr/bx/n }{}
abc \textbf{xyz}
\end{document}
使用大胆的计算机现代风格,看起来像这样: