From a84a98b54561044b5902dfce39bc31082877fec1 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 4 Dec 2012 12:55:47 +0100 Subject: [PATCH] Also add support for URW Garamond math fonts (via newtx) --- development/FORMAT | 1 + lib/doc/LaTeXConfig.lyx | 7 ++++++- lib/latexfonts | 8 ++++++++ lib/lyx2lyx/lyx_2_1.py | 15 ++++++++++++++- src/tex2lyx/TODO.txt | 3 ++- 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index a460b24474..8d0f86085b 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -15,6 +15,7 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. * Format incremented to 450: Support for the URW Garamond LaTeX fonts. - \usepackage{garamondx} > \font_serif garamondx - [osf], [osfI] > \font_osf true + - \usepackage[garamondx]{newtxmath} > \font_math garamondx-ntxm Also (fallback): - \renewcommand{\sffamily}{ugm} > \font_serif garamondx diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index 12717e2719..adabe1741c 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -956,7 +956,7 @@ newtxmath \family default package provides support for matching math fonts for \emph on -Times Roman +URW Garamond, Times Roman \emph default (or \emph on @@ -1877,6 +1877,11 @@ arg "garamondx-fonts" garamondx \family default package provides old style figures. + Matching math fonts are provided by +\emph on +URW Garamond (NewTX) +\emph default +. As a fallback, the package \family sans ugm diff --git a/lib/latexfonts b/lib/latexfonts index da320106a0..4898c18e93 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -533,6 +533,14 @@ Font eulervm Package eulervm EndFont +Font garamondx-ntxm + GuiName "URW Garamond (New TX)" + Family math + Package newtxmath + PackageOption garamondx + Provides amssymb,amsfonts +EndFont + Font libertine-ntxm GuiName "Libertine (New TX)" Family math diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 3fe14a5dc9..91666ba4e2 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1795,6 +1795,19 @@ def revert_itemargs(document): i = i + 1 +def revert_garamondx_newtxmath(document): + " Revert native garamond newtxmath definition to LaTeX " + + i = find_token(document.header, "\\font_math", 0) + if i == -1: + return + if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: + val = get_value(document.header, "\\font_math", i) + if val == "garamondx-ntxm": + add_to_preamble(document, "\\usepackage[garamondx]{newtxmath}") + document.header[i] = "\\font_math auto" + + def revert_garamondx(document): " Revert native garamond font definition to LaTeX " @@ -1859,7 +1872,7 @@ convert = [ ] revert = [ - [449, [revert_garamondx]], + [449, [revert_garamondx, revert_garamondx_newtxmath]], [448, [revert_itemargs]], [447, [revert_literate]], [446, [revert_IEEEtran, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH, revert_EuropeCV]], diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index a2293dd72a..787b29bca4 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -83,7 +83,8 @@ Format LaTeX feature LyX feature 447 448 449 \item[] \begin_inset Argument item: -450 garamondx.sty, ugm LaTeX font \font_roman, \font_osf +450 garamondx.sty, ugm LaTeX font, \font_roman, \font_osf, + [garamondx]{newtxmath} \font_math General