Microtype:如何禁用单个字符的凸出?

Microtype:如何禁用单个字符的凸出?

我想禁用尾划线和长划线的突出部分。那里的线条填充效果不太好……

但如何做到这一点?根据答案这里,我尝试操作字体包但没有任何效果。

使用时我必须加载哪个正确的字体包现代- 是吗lmr? 有哪些设置可以使单个字符从突出部分中消失?

下面是一个 MWE,用于查看哪里出了问题,它出现在第 2 行的开头和第 5 行的结尾,并且出现在完全禁用了突出部分的相同文本下方。

在此处输入图片描述

对于其他字符,突出功能应保持启用状态,它仅与 -- 和 --- 有关。

您有什么建议吗?:)

\documentclass[a4paper, 12pt, headsepline]{scrreprt}
\setlength{\parindent}{0pt}
\usepackage{geometry}
  \geometry{left=3.5cm, right=2cm, top=2.5cm, bottom=2cm}
\usepackage{setspace}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{microtype}
  \LoadMicrotypeFile{lmr} % Which file do I need?
  \SetProtrusion
    [ name = lmr-adapted,
      load = lmr-T1 ]
    { encoding = T1,
      family   = {lmr,lmrx,lmrj} }
    { 
      \textendash = {0,0},
      \textemdash = {0,0}, % does not have any effect
      -- = {0,0},
      --- = {0,0} % does not have any effect
    }

\begin{document}

Hello world, bli bla blubb, how are you, I'm fine -- well, I need some stupid text. Damn... -- Maybe I should write a really loooooooooooooooooooooooooooooooooooooooooooooo\-ooooooooong line to fill the space. A chemist walks into a pharmacy and asks the pharmacist, “Do you have any acetylsalicylic acid?” “You mean aspirin?” asked the pharmacist. “That’s it! I can never remember that word.” \dots Well, that's some text ---
But how can I suppress that annoying protrusion for emdashes? 1 2 3 4 5 6 7 8 9 10 11\\

\microtypesetup{protrusion=false}
Hello world, bli bla blubb, how are you, I'm fine -- well, I need some stupid text. Damn... -- Maybe I should write a really looooooooooooooooooooooooooooooooooooooooooooo\-ooooooooong line to fill the space. A chemist walks into a pharmacy and asks the pharmacist, “Do you have any acetylsalicylic acid?” “You mean aspirin?” asked the pharmacist. “That’s it! I can never remember that word.” \dots Well, that's some text ---
But how can I suppress that annoying protrusion for emdashes? 1 2 3 4 5 6 7 8 9 10 11

\end{document}

答案1

总结

l中的最后一个更改为。LoadMicrotypeFile{lmr}c


这似乎很难找到,但查阅该文件通常很有帮助log。运行您的示例会产生两个警告:

Package microtype Warning: Configuration file mt-lmr.cfg
(microtype)                does not exist on input line 11.

这告诉我们,我们加载了错误的文件 —— 但哪个才是正确的呢?第二个警告给出了线索​​(带有一些上下文):

File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman 
(RS)

Package microtype Warning: protrusion codes list `lmr-T1' will
(microtype)                override list `lmr-adapted' for 
(microtype)                font `T1/lmr///' on input line 138.

表示调整后的设置将被其他设置(软件包附带的设置)覆盖,这意味着调整后的设置永远不会生效。此警告之前的一行告诉我们这些设置在哪个文件中定义:mt-cmr.cfg

因此,我们改为\LoadMicrotypeFile{lmr}LoadMicrotypeFile{cmr}看看会发生什么:

首先,破折号不再突出,所以一切顺利。

但随后又出现了两个新的警告:

Package microtype Warning: Unknown slot number of character
(microtype)                `--'
(microtype)                in font encoding `T1'.
(microtype)                Make sure it's a single character
(microtype)                (or a number) in protrusion list
(microtype)                `lmr-adapted'.

Package microtype Warning: Unknown slot number of character
(microtype)                `---'
(microtype)                in font encoding `T1'.
(microtype)                Make sure it's a single character
(microtype)                (or a number) in protrusion list
(microtype)                `lmr-adapted'.

从某种意义上来说,这是一个好兆头,因为这意味着加载了正确的设置,但当然也是坏兆头,因为它是一个警告。要摆脱它们,只需删除设置中的两行相应内容即可。

microtype使用选项加载通常也很有帮助verbose,它允许检查已加载哪些设置。log然后在文件中我们发现:

Package microtype Info: Setting up font `T1/lmr/m/n/12' on input line 24.
Package microtype Info: ... Loading protrusion list `lmr-adapted'.
Package microtype Info: ... : First loading protrusion list `lmr-T1'.
Package microtype Info: ... : First loading protrusion list `cmr-T1'.
Package microtype Info: ... : First loading protrusion list `cmr-default'.

因此,总而言之,以下内容将实现您想要的操作:

  \LoadMicrotypeFile{cmr} 
  \SetProtrusion
    [ name = lmr-adapted,
      load = lmr-T1 ]
    { encoding = T1,
      family   = {lmr} } % lmrx and lmrj don't exist
    { 
      \textendash = {0,0},
      \textemdash = {0,0}, 
    }

相关内容