Ticket #37828

ltjsclassesのオプションに14ptなど大きいフォントサイズを指定すると数式が横長になる

Date d'ouverture: 2017-12-20 19:44 Dernière mise à jour: 2018-01-21 13:34

Rapporteur:
Propriétaire:
Type:
État:
Atteints
Composant:
(Aucun)
Jalon:
(Aucun)
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
Aucun

Détails

以下のTeX文書をコンパイルすると数式が横長に引き伸ばされます。

  1. \documentclass[14pt]{ltjsarticle}
  2. \usepackage{ifptex,iftex}
  3. \usepackage{amsmath}
  4. \ifptex
  5. \usepackage{lmodern}
  6. \else
  7. \usepackage{unicode-math}
  8. \fi
  9. \title{テスト}
  10. \author{テスト 太郎}
  11. \begin{document}
  12. \maketitle
  13. \section{オイラーの公式}
  14. オイラーの公式を式\ref{eq:eular}に示す。
  15. \begin{equation}\label{eq:eular}
  16. e^{i\theta} = \cos\theta + i\sin\theta
  17. \end{equation}
  18. これに$\theta = \pi$を代入すると式\ref{eq:eular2}を得る。
  19. \begin{equation}\label{eq:eular2}
  20. e^{-i\pi} = -1
  21. \end{equation}
  22. \end{document}

\usepackage{unicode-math}または[14pt]を消すと数式が本来の縦横比になります。なお、ltjsarticleltjsbookに変えても横長になります。

当方の環境は Windows 10 + TeXLive 2017 + Lua(JIT)LaTeX 1.0.4 + ltjsclasses 2017/9/19版 です。LuaLaTeXでもLuaJITLaTeXでも等しく再現されます。

Ticket History (3/7 Histories)

2017-12-20 19:44 Updated by: tats_u
  • New Ticket "ltjsclassesのオプションに14ptなど大きいフォントサイズを指定すると数式が横長になる" created
2017-12-20 20:00 Updated by: aminophen
Commentaire

再現しました。

  • XeLaTeX / LuaLaTeX で unicode-math を使用し,
  • ltjs 系または bxjs 系のクラスで 10pt 以外のサイズオプションと nomag* を指定した場合

※ LuaTeX は \mag がサポートされていないので,nomag* がデフォルトになっていることに注意

の時に再現するように見えます。つまり

\documentclass[14pt,nomag*,autodetect-engine,ja=standard]{bxjsarticle}

なら XeLaTeX + bxjsarticle でも起きるので,nomag* スケーリングの実装の中の何かと unicode-math が衝突しているのかもしれません。

なので,\documentclass のオプションに nomag を付ければ,とりあえずの回避になりそうです。

2017-12-21 00:03 Updated by: tats_u
  • Details Updated
Commentaire

犯人はnomag*で、XeTeXでも再現すのですね。それならば、 https://github.com/zr-tex8r/BXjscls にもissueを立てたほうがいいですか?

2017-12-21 08:59 Updated by: h7k
  • Propriétaire Update from (Aucun) to h7k
Commentaire

確認しました.

unicode-math-luatex.sty 中の \__um_fontspec_select_font: の定義では \scriptstyle, \textstyle それぞれにおけるフォントサイズ \sf@size, \tf@sizeが使われていますが,これが nomag* によってスケールされた後(この例だと 1.44 倍)の値になっていました.

プリアンブルで,該当部分を「スケールを戻す」処理を加えて以下のように再定義してしまえばひとまず直るようですが,どこかしっくりきません.

  1. \usepackage{unicode-math}
  2. \ExplSyntaxOn
  3. \makeatletter
  4. \cs_set:Nn \__um_fontspec_select_font:
  5. {
  6. \tl_set:Nx \l__um_font_keyval_tl {
  7. Renderer = Basic,
  8. BoldItalicFont = {}, ItalicFont = {},
  9. Script = Math,
  10. SizeFeatures =
  11. {
  12. {
  13. Size = \directlua{luatexja.ltjs_unmagnify_fsize(\tf@size)}-
  14. } ,
  15. {
  16. Size = \directlua{luatexja.ltjs_unmagnify_fsize(\sf@size)}-\directlua{luatexja.ltjs_unmagnify_fsize(\tf@size)} ,
  17. Font = \l__um_script_font_tl ,
  18. \l__um_script_features_tl
  19. } ,
  20. {
  21. Size = -\directlua{luatexja.ltjs_unmagnify_fsize(\sf@size)} ,
  22. Font = \l__um_sscript_font_tl ,
  23. \l__um_sscript_features_tl
  24. }
  25. } ,
  26. \l__um_unknown_keys_clist
  27. }
  28. \fontspec_set_fontface:NNxn \l__um_font \l__um_family_tl
  29. {\l__um_font_keyval_tl} {\l__um_fontname_tl}
  30. \group_begin:
  31. \fontfamily{\l__um_family_tl}\selectfont
  32. \fontspec_if_script:nF {math} {\bool_gset_false:N \l__um_ot_math_bool}
  33. \group_end:
  34. }
  35. \ExplSyntaxOff

2017-12-25 01:46 Updated by: aminophen
Commentaire

https://github.com/zr-tex8r/BXjscls/issues/8#issuecomment-353792852

にも書きましたが,unicode-math を使うときにはフォントが変わっていて「オプティカルサイズの調整が必要ない」ので,そもそも nomag* じゃなくて nomag を使う“べき”状況だと思います。

ただ,デフォルトが nomag* になっていることが原因とは気付きにくい気もするので,ドキュメントに書いておくとよいのではないでしょうか。あるいは,デフォルトが nomag でも(LuaTeX の強みが OpenType フォントの利便性であることを鑑みると)ほとんど困らないようにも思えてきます。

2018-01-14 19:24 Updated by: h7k
  • Résolution Update from Aucun to Fixed
Commentaire

遅くなりましたが,139371e で直しました.bxjscls でも治っていると思います.

フォントが変わっていて「オプティカルサイズの調整が必要ない」

unicode-math には \scriptstyle,\scriptscriptstyle で別のフォント/feature を指定できるようになっていることを考えると「必要ない」というのは正しくないと思います.私は単純に「nomag* による追加パッチが unicode-math でも必要だった」だけだと捉えています.

2018-01-21 13:34 Updated by: h7k
  • État Update from Ouvert to Atteints
Commentaire

20180121.0 を出しましたので,完了とします.

Attachment File List

No attachments

Modifier

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion