特定の文字に対するマイクロタイプの文字突出設定を変更する(つまり、部分的に上書きする)

特定の文字に対するマイクロタイプの文字突出設定を変更する(つまり、部分的に上書きする)

microtype特定の文字に対して文字突出( によって有効化)を無効にしたり変更したりしたいと思います。

私の好みからすると、はみ出し過ぎているエンダッシュの問題を説明しましょう。

突起なし 突起付き

(左:突起なし、右:突起あり)

しかし、次の方法では突出を無効にすることができません\SetProtrusion:

\documentclass{memoir}
\usepackage{mathptmx}
\usepackage[T3,T1]{fontenc}
\usepackage{microtype}
%\usepackage[protrusion=false]{microtype}
\SetProtrusion
  { encoding = T1,
    family   = ptm }
  { \textendash = {,0} }


\begin{document}

Word word word word word word word word word word word word word word -- word
word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word
word word word word word word ...

\end{document}

次の警告も表示されます。

Package microtype Warning: protrusion codes list `ptm-T1' will override list
(microtype)                `q.tex/9' for font `T1/ptm///' on input line 105.

によるとプリアンブルで microtype の \SetProjection を呼び出すにはどうすればいいですか?\LoadMicrotypeFile{ptm}の直前に行を追加すると役立ちます。これを試してみると、 ( )\SetProtrusionの問題は解決されるように見えますが、(1)迷惑な警告が残り、(2)私のコードは無効になります。--\textendash全て突出 (突出値のリスト全体を私の短いリストで上書きすることによって)。デフォルトの文字突出設定を部分的に上書きする正しい方法は何ですか? 理想的には、重要なmicrotype機能を無効にせずに警告をすべて取り除く方法があるでしょう。

答え1

既存の設定を拡張または変更する方法は次のとおりです。

  1. 変更したい設定がすでにロードされていることを確認してください。プリアンブルでは、これが保証されていないため、 が必要です\LoadMicrotypeFile

  2. キーを使用してデフォルト設定を読み込む新しい設定を作成しますload

  3. 任意のグリフの突出をゼロに設定したい場合は、明示的にそうする必要があります。空の突出値 (例\textendash = {,}) を宣言しても何も変わりません。

  4. 受け取った警告が気になる場合は、 でパッケージをロードすることで警告を抑制できますverbose=silent。ただし、これにより他のすべてのmicrotype警告も抑制されることに注意してください。(設定用のキーのようなものが便利だと思いますoverrideが、今のところはこのままです。) 編集: バージョン 2.7 以降では、上書きされたリストがロードされたものと同じ場合でも警告が表示されなくなりました。

これをコードに変換するには、次のようになります。

\usepackage[verbose=silent]{microtype}
\LoadMicrotypeFile{ptm}
\SetProtrusion
    [ name = ptm-adapted, % the name is optional
      load = ptm-T1 ]
    { encoding = T1,
      family   = {ptm,ptmx,ptmj} }
    { 
      \textendash = { ,0},      % left protrusion will remain untouched, 
                                % right protrusion set to zero
     %\textendash = {150,150},  % this would set protrusion on both sides to 150
    }

複数のフォントの設定を調整するには、同じ操作を再度実行する必要があります (設定を読み込み、新しい設定を作成します)。つまり、\SetProtrusion( \LoadMicrotypeFile) を複数回発行します。

\LoadMicrotypeFile{ppl}
\SetProtrusion
    [ load = ppl-T1 ]
    { encoding = T1,
      family   = {ppl,pplx,pplj} }
    { ... }

もう 1 つの、より単純だが粒度が細かい可能性としてはfactor、1000 未満の値でパッケージをロードする方法があります。これにより、すべてのフォントのすべてのグリフの突出値がスケーリングされます。たとえば、

\usepackage[factor=500]{microtype}

すべての突出値が半分になります。

答え2

現在、私はmicrotype次のように突出調整を行ってロードしています。おそらく誰かが私の値、特に Times ( ptm) の値を使用することに興味があるでしょう。これは私見では突出が大きすぎるからです。私が選択した調整は、網羅的なものではないことに注意してください。

\usepackage[verbose=silent]{microtype}
    \LoadMicrotypeFile{ptm}
    \SetProtrusion
      [ name = ptm-adapted,
        load = ptm-T1 ]
      { encoding = T1,
        family   = {ptm,ptmx,ptmj} }
      { f = { ,-200},
        r = { ,-100},
        \textquoteleft     = {300, }, % default uses 500
        \textquoteright    = { ,300}, % default uses 500
        \textquotedblleft  = {75, }, % default uses 300
        \textquotedblright = { ,75}, % default uses 400
        \textendash = {0,0}, % default is 300/300
        \textemdash = {0,0}, % default is 200/200
        /           = { ,-100}, % default uses 200
        (           = {67, }, % default uses 100
        )           = { ,67}, % default uses 200
        {,}         = { ,167}, % default uses 500
        :           = { ,167}, % default uses 500
        ;           = { ,100}, % default uses 300
        .           = { ,233}, % default uses 700
        ?           = { ,33} } % default uses 100
    \SetProtrusion
      [ name = ptm-it-adapted,
        load = ptm-it-T1 ]
      { encoding = T1,
        family   = {ptm,ptmx,ptmj},
        shape    = {it,sl} }
      { f = { ,-300},
        : = { ,0}, % default uses 500
        . = { ,233} } % default uses 700
    \LoadMicrotypeFile{ppl}
    \SetProtrusion
      [ name = ppl-adapted,
        load = ppl-T1 ]
      { encoding = T1,
        family   = {ppl,pplx,pplj} }
      { \textquoteleft     = {150, }, % default uses 500
        \textquoteright    = { ,150}, % default uses 700
        \textquotedblleft  = {75, }, % default uses 300
        \textquotedblright = { ,75}, % default uses 400
        \textendash = {0,0}, % default is 300/300
        \textemdash = {0,0}, % default is 200/200
        /           = { ,100}, % default uses 300
        (           = {50, }, % default uses 100
        )           = { ,150}, % default uses 300
        {,}         = { ,250}, % default uses 500
        :           = { ,250}, % default uses 500
        ;           = { ,250}, % default uses 500
        .           = { ,350}, % default uses 700
        ?           = { ,100} } % default uses 200
    \SetProtrusion
      [ name = txtt ]
      { encoding = T1,
        family   = txtt,
        shape    = {it,sl} }
      { f = { ,-120},
        - = { ,300} } % in order to match ordinary hyphens' protrusion in body text

関連情報