From ba1d137769423af8cddd31c6f21f1ab5374c0397 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 23 Sep 2012 18:33:04 +0200 Subject: [PATCH] Support for the NewTX Math fonts (newtx, libertine, minion) --- development/FORMAT | 6 ++++ lib/chkconfig.ltx | 2 ++ lib/doc/LaTeXConfig.lyx | 65 ++++++++++++++++++++++++++++++++++++++++- lib/latexfonts | 24 +++++++++++++++ lib/lyx2lyx/lyx_2_1.py | 24 +++++++++++++-- src/version.h | 4 +-- 6 files changed, 120 insertions(+), 5 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 2de4974716..b028fb1954 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,12 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2012-09-23 Jürgen Spitzmüller + * Format incremented to 442: support for the newtxmath fonts: + - \usepackage{newtxmath} > \math_font newtxmath + - \usepackage[libertine]{newtxmath} > \math_font libertine-ntxm + - \usepackage[minion]{newtxmath} > \math_font minion-ntxm + 2012-09-23 Jürgen Spitzmüller * Format incremented to 441: - rename fonts: mdbch > md-charter, mdput > md-utopia, mdugm > md-garamond diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index e2be1a8341..3a6f424b29 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -369,6 +369,8 @@ \TestPackage{mdput} \TestPackage{mdugm} \TestPackage{MinionPro} +\TestPackage[zmnr.pfb]{minion2newtx} +\TestPackage{newtxmath} \TestPackage{tgadventor} \TestPackage{tgbonum} \TestPackage{tgchorus} diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index c05272dc37..5342e2c4e6 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -1,5 +1,5 @@ #LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 440 +\lyxformat 442 \begin_document \begin_header \textclass article @@ -790,6 +790,69 @@ MinionPro separately (please consult the MinionPro package manual for details). \end_layout +\begin_layout Subsection +NewTX Math +\end_layout + +\begin_layout Description +Found: +\begin_inset Info +type "package" +arg "newtxmath" +\end_inset + + +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +fonts/newtx +\end_layout + +\begin_layout Description +Notes: The +\family sans +newtxmath +\family default + package provides support for matching math fonts for +\emph on +Times Roman +\emph default + (or +\emph on +NewTX +\emph default +), +\emph on +Libertine +\emph default + and +\emph on +MinionPro +\emph default +. + Please note that +\emph on +MinionPro +\emph default + support requires the supplementary +\family sans +minion2newtx +\family default + package (found: +\begin_inset Info +type "package" +arg "minion2newtx" +\end_inset + +) as well as external fonts (please consult the +\family sans +minion2newtx +\family default + documentation for details). +\end_layout + \begin_layout Subsection psnfss \end_layout diff --git a/lib/latexfonts b/lib/latexfonts index 9a89739254..a0658cf195 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -502,3 +502,27 @@ Font eulervm Family math Package eulervm EndFont + +Font libertine-ntxm + GuiName "Libertine (New TX)" + Family math + Package newtxmath + PackageOption libertine + Provides amssymb,amsfonts +EndFont + +Font minion-ntxm + GuiName "Minion Pro (New TX)" + Family math + Package newtxmath + PackageOption minion + Requires minion2newtx + Provides amssymb,amsfonts +EndFont + +Font newtxmath + GuiName "Times Roman (New TX)" + Family math + Package newtxmath + Provides amssymb,amsfonts +EndFont diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index b1c82f5c06..acb36d5a35 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -839,7 +839,7 @@ def revert_libertine(document): if osf: preamble += "[osf]" document.header[j] = "\\font_osf false" - preamble += "{libertine}" + preamble += "{libertine-type1}" add_to_preamble(document, [preamble]) document.header[i] = "\\font_roman default" @@ -1082,6 +1082,24 @@ def convert_mdnomath(document): document.header[i] = "\\font_roman %s" % mathdesign_dict[val] +def revert_newtxmath(document): + " Revert native newtxmath definitions 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) + mathfont_dict = { + "libertine-ntxm": "\\usepackage[libertine]{newtxmath}", + "minion-ntxm": "\\usepackage[minion]{newtxmath}", + "newtxmath": "\\usepackage{newtxmath}", + } + if val in mathfont_dict.keys(): + add_to_preamble(document, mathfont_dict[val]) + document.header[i] = "\\font_math auto" + + ## # Conversion hub # @@ -1115,10 +1133,12 @@ convert = [ [438, []], [439, []], [440, []], - [441, [convert_mdnomath]] + [441, [convert_mdnomath]], + [442, []] ] revert = [ + [441, [revert_newtxmath]], [440, [revert_mdnomath]], [439, [revert_mathfonts]], [438, [revert_minionpro]], diff --git a/src/version.h b/src/version.h index 9fbc5e3fd3..f3252ef2d2 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 441 // spitz: mathdesign tex font changes -#define LYX_FORMAT_TEX2LYX 441 // spitz: mathdesign tex font changes +#define LYX_FORMAT_LYX 442 // spitz: support for newtxmath +#define LYX_FORMAT_TEX2LYX 442 // spitz: support for newtxmath #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER -- 2.39.2