语境:在我的文档(使用 编译pdfLaTeX
)中,我使用libertine
包和同名字体。有时,我想使用等宽字体(用于内联代码片段和 URL)。
问题:甚至缩放后,Libertine mono 字体显得太大:
衬线字体和单声道字体都匹配得很好,但我发现单声道片段的“灰色”与衬线字体相比太浅了。
在哪种打字机字体适合 Linux Libertine 并支持粗体字母?,建议使用另外两种字体与 Libertine 和 Biolinum 搭配使用。但是,由于我很少在文档中使用单色字体,因此对比度太明显了。
问题:敢于挑战良好排版的基本标准规则,我想水平“挤压”等宽字体(以便一个衬线字母的长度大致等于一个单音素字母的长度)。 在使用 FontForge 编辑和不使用字体进行
编译时如何做到这一点pdfLaTeX
?
\documentclass{scrartcl}
\usepackage[
osf,
ttscale=0.875,
]{libertine}
\begin{document}
\begin{itemize}
\item[normal font:] {\normalfont abcdefghijklmnopqrstuvwxyz}
\item[monospaced font:] {\ttfamily abcdefghijklmnopqrstuvwxyz}
\item[x-height comparison:] {\ttfamily x}{\normalfont x}{\ttfamily x} {\ttfamily X}{\normalfont X}{\ttfamily X}
\end{itemize}
\addsec{Testing the grey}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus dignissim velit nunc, sit amet bibendum ante venenatis vel. Suspendisse ultrices lectus et ex bibendum, in vehicula lectus auctor. Etiam at maximus felis, ac blandit ex. Phasellus vitae ultrices nulla. Praesent viverra velit ullamcorper, sagittis mauris sit amet, posuere tellus. {\ttfamily Mauris ac sem ullamcorper,} euismod sem eleifend, ultricies metus. Aenean enim diam, tristique et maximus id, ultricies et nulla. Cras augue nibh, interdum ac aliquet sed, ultrices vitae lacus. Nulla rutrum nulla suscipit odio varius luctus.
Vivamus ullamcorper elit in nibh pharetra posuere. Sed ut enim ornare ex tincidunt aliquet et vel lacus. Etiam vel sagittis urna. {\ttfamily Suspendisse felis lorem, elementum id pharetra eget, pulvinar sed justo.} Maecenas sit amet consectetur dolor, in vestibulum tortor. Morbi maximus nulla nec augue rutrum, non egestas neque molestie. Phasellus non feugiat ex, a condimentum ante. Praesent porta metus dui, quis euismod ante lacinia a. Nunc diam nulla, tempus et diam sed, eleifend iaculis neque. Morbi id arcu ornare, feugiat tellus eu, venenatis odio. Cras dignissim laoreet mauris a ultricies. Aliquam in orci erat. Mauris malesuada nisi ut nunc tincidunt, non luctus metus auctor. Suspendisse venenatis dolor ac ante accumsan, eu aliquet odio accumsan.
Fusce non ipsum eget ipsum hendrerit vestibulum non et elit. Morbi finibus ornare dignissim. Cras vitae lacus eros. Mauris in egestas purus. Nullam vulputate felis vulputate dolor lacinia, at cursus eros sagittis. {\ttfamily Phasellus sed mauris metus. Aenean eget felis sapien.} Maecenas id ligula neque. Pellentesque vitae odio sed nulla venenatis molestie eu sit amet ipsum. Maecenas massa lorem, semper in maximus a, dictum vel neque. Nunc a tellus ligula. Pellentesque commodo interdum bibendum. Suspendisse elit ipsum, varius in justo id, hendrerit ornare nisi. Curabitur ut rutrum augue.
\end{document}
答案1
您可以ExtendFont
在地图声明中使用。但由于这只会改变字形而不会改变其指标,因此您可能必须将其与一些负面跟踪相结合(除非您想创建新的 tfm 文件)。0.55 是一个夸张的值,它只会更好地显示效果:
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\pdfmapline{=LinLibertineMT-tlf-t1--base LinLibertineMT ".55 ExtendFont AutoEnc_d6jdytwuqqz4y7d6afmjlfgx7d ReEncodeFont " <[lbtn_d6jdyt.enc <LinLibertineMT.pfb }
\usepackage[
osf,
ttscale=0.875,
]{libertine}
\begin{document}\pagestyle{empty}
\begin{itemize}
\item[normal font:] {\normalfont abcdefghijklmnopqrstuvwxyz}
\item[monospaced font:] {\ttfamily abcdefghijklmnopqrstuvwxyz}\\
{\textls[-100]{\ttfamily abcdefghijklmnopqrstuvwxyz}}
\item[x-height comparison:] {\ttfamily x}{\normalfont x}{\ttfamily x} {\ttfamily X}{\normalfont X}{\ttfamily X}
\end{itemize}
\end{document}
答案2
基于Ulrike 的回答和评论,这里是解决方案的 MWE主观上满足了我的要求。
我使用了.875
打字机字体的全局缩放因子(作为libertine
包的全局选项)和ExtendFont
地图声明中的因子。
然后我声明\DeclareMicrotypeSet
字体ttfamily
(注意encoding=*
明确似乎是必需的),我通过将字母间距减少 0.1em(参见{-100}
)以及将单词间距减少 50%(参见-500*
)并将收缩率提高 10%(100*
)来调整它的跟踪。
关键是设置这些设置后已加载libertine
(你在这里,哦,浪费了两个小时!)
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[tracking]{microtype}
\usepackage[ttscale=0.875]{libertine}
\pdfmapline{=LinLibertineMT-tlf-t1--base LinLibertineMT ".875 ExtendFont AutoEnc_d6jdytwuqqz4y7d6afmjlfgx7d ReEncodeFont " <[lbtn_d6jdyt.enc <LinLibertineMT.pfb }
\DeclareMicrotypeSet*[tracking]{typewriter}{ encoding = *, family = tt* }
\SetTracking[ spacing = {-500*,,100*} ]{ encoding=*, family = tt* }{-100}
\begin{document}
\begin{itemize}
\item[normal font:] {\normalfont abcdefghijklmnopqrstuvwxyz}
\item[monospaced font:] {\ttfamily abcdefghijklmnopqrstuvwxyz}
\item[x-height comparison:] {\ttfamily x}{\normalfont x}{\ttfamily x} {\ttfamily X}{\normalfont X}{\ttfamily X}
\end{itemize}
\addsec{Testing the grey}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus dignissim velit nunc, sit amet bibendum ante venenatis vel. Suspendisse ultrices lectus et ex bibendum, in vehicula lectus auctor. Etiam at maximus felis, ac blandit ex. Phasellus vitae ultrices nulla. Praesent viverra velit ullamcorper, sagittis mauris sit amet, posuere tellus. {\ttfamily Mauris ac sem ullamcorper,} euismod sem eleifend, ultricies metus. Aenean enim diam, tristique et maximus id, ultricies et nulla. Cras augue nibh, interdum ac aliquet sed, ultrices vitae lacus. Nulla rutrum nulla suscipit odio varius luctus.
Vivamus ullamcorper elit in nibh pharetra posuere. Sed ut enim ornare ex tincidunt aliquet et vel lacus. Etiam vel sagittis urna. {\ttfamily Suspendisse felis lorem, elementum id pharetra eget, pulvinar sed justo.} Maecenas sit amet consectetur dolor, in vestibulum tortor. Morbi maximus nulla nec augue rutrum, non egestas neque molestie. Phasellus non feugiat ex, a condimentum ante. Praesent porta metus dui, quis euismod ante lacinia a. Nunc diam nulla, tempus et diam sed, eleifend iaculis neque. Morbi id arcu ornare, feugiat tellus eu, venenatis odio. Cras dignissim laoreet mauris a ultricies. Aliquam in orci erat. Mauris malesuada nisi ut nunc tincidunt, non luctus metus auctor. Suspendisse venenatis dolor ac ante accumsan, eu aliquet odio accumsan.
Fusce non ipsum eget ipsum hendrerit vestibulum non et elit. Morbi finibus ornare dignissim. Cras vitae lacus eros. Mauris in egestas purus. Nullam vulputate felis vulputate dolor lacinia, at cursus eros sagittis. {\ttfamily Phasellus sed mauris metus. Aenean eget felis sapien.} Maecenas id ligula neque. Pellentesque vitae odio sed nulla venenatis molestie eu sit amet ipsum. Maecenas massa lorem, semper in maximus a, dictum vel neque. Nunc a tellus ligula. Pellentesque commodo interdum bibendum. {\ttfamily https://tex.stackexchange.com} Suspendisse elit ipsum, varius in justo id, hendrerit ornare nisi. Curabitur ut rutrum augue.
\end{document}
注意:这里给出的所有微型因素都是我这个外行人能接受的大概数字。它们需要在真实文档中进行更精细的调整(即,我在这里猜测它们,尝试它们,它们没问题,所以我保留了它们。也就是说,我没有寻找更好的替代方案。欢迎在评论中提出建议!)