commit f8a85f35befaeb35a5dc17c3a00329c7aac7e383
Author: Juergen Spitzmueller <[email protected]>
Date: Thu Dec 29 16:45:19 2016 +0100
Add support for the Crimson font
We use the more comprehensive cochineal package if available and fall
back to the crimson package, if not.
Math support is provided by means of newtxmath
Fixes: #9974, #9976
---
development/FORMAT | 12 ++++++++++--
lib/chkconfig.ltx | 2 ++
lib/latexfonts | 22 ++++++++++++++++++++++
lib/lyx2lyx/lyx_2_3.py | 34 +++++++++++++++++++++++++++++++++-
src/tex2lyx/TODO.txt | 5 +++++
src/version.h | 4 ++--
6 files changed, 74 insertions(+), 5 deletions(-)
diff --git a/development/FORMAT b/development/FORMAT
index 51d51bc..595b934 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -11,6 +11,14 @@ adjustments are made to tex2lyx and bugs are fixed in
lyx2lyx.
-----------------------
+2016-12-29 Jürgen Spitzmüller <[email protected]>
+ * Format incremented to 524: Support Crimson/Cochineal fonts
+ - \usepackage{cochineal} > \font_roman cochineal
+ - [osf] > \font_osf true
+ - \usepackage{crimson} > \font_roman cochineal
+ - \usepackage[cochineal]{newtxmath} > \font_math cochineal-ntxm
+
+
2016-12-26 Jürgen Spitzmüller <[email protected]>
* Format incremented to 523: Implement cjk quotation marks.
- cjk (corner marks): \begin_inset Quotes j..
@@ -435,11 +443,11 @@ adjustments are made to tex2lyx and bugs are fixed in
lyx2lyx.
2012-12-04 Jürgen Spitzmüller <[email protected]>
* Format incremented to 450: Support for the URW Garamond LaTeX fonts.
- - \usepackage{garamondx} > \font_serif garamondx
+ - \usepackage{garamondx} > \font_roman garamondx
- [osf], [osfI] > \font_osf true
- \usepackage[garamondx]{newtxmath} > \font_math garamondx-ntxm
Also (fallback):
- - \renewcommand{\sffamily}{ugm} > \font_serif garamondx
+ - \renewcommand{\sffamily}{ugm} > \font_roman garamondx
2012-11-29 Jürgen Spitzmüller <[email protected]>
* Format incremented to 449: Support for \item arguments.
diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index 009d9ed..140014a 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -410,7 +410,9 @@
\TestPackage{bookman}
\TestPackage{chancery}
\TestPackage{charter}
+\TestPackage{cochineal}
\TestPackage{courier}
+\TestPackage{crimson}
\TestPackage{helvet}
\TestPackage{mathpazo}
\TestPackage{mathpple}
diff --git a/lib/latexfonts b/lib/latexfonts
index b390efe..bf6152a 100644
--- a/lib/latexfonts
+++ b/lib/latexfonts
@@ -124,6 +124,20 @@ Font charter
Package charter
EndFont
+Font cochineal
+ GuiName "Crimson (Cochineal)"
+ Family rm
+ OsfOption "proportional,osf"
+ Package cochineal
+ AltFonts crimson
+EndFont
+
+AltFont crimson
+ GuiName "Crimson"
+ Family rm
+ Package crimson
+EndFont
+
Font cmr
GuiName "Computer Modern Roman"
Family rm
@@ -615,6 +629,14 @@ EndFont
# MATH FONTS
#
+Font cochineal-ntxm
+ GuiName "Crimson (New TX)"
+ Family math
+ Package newtxmath
+ PackageOption cochineal
+ Provides amssymb,amsfonts
+EndFont
+
Font eulervm
GuiName "Euler VM"
Family math
diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py
index 20bfde9..b1154bc 100644
--- a/lib/lyx2lyx/lyx_2_3.py
+++ b/lib/lyx2lyx/lyx_2_3.py
@@ -1035,6 +1035,36 @@ def revert_cjkquotes(document):
i = l
+def revert_crimson(document):
+ " Revert native Cochineal/Crimson font definition to LaTeX "
+
+ if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+ preamble = ""
+ i = find_token(document.header, "\\font_roman \"cochineal\"", 0)
+ if i != -1:
+ osf = False
+ j = find_token(document.header, "\\font_osf true", 0)
+ if j != -1:
+ osf = True
+ preamble = "\\usepackage"
+ if osf:
+ document.header[j] = "\\font_osf false"
+ preamble += "[proportional,osf]"
+ preamble += "{cochineal}"
+ add_to_preamble(document, [preamble])
+ document.header[i] = document.header[i].replace("cochineal",
"default")
+
+
+def revert_cochinealmath(document):
+ " Revert cochineal newtxmath definitions to LaTeX "
+
+ if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+ i = find_token(document.header, "\\font_math \"cochineal-ntxm\"", 0)
+ if i != -1:
+ add_to_preamble(document, "\\usepackage[cochineal]{newtxmath}")
+ document.header[i] = document.header[i].replace("cochineal-ntxm",
"auto")
+
+
##
# Conversion hub
#
@@ -1055,10 +1085,12 @@ convert = [
[520, []],
[521, [convert_frenchquotes]],
[522, []],
- [523, []]
+ [523, []],
+ [524, []]
]
revert = [
+ [523, [revert_crimson, revert_cochinealmath]],
[522, [revert_cjkquotes]],
[521, [revert_dynamicquotes]],
[520, [revert_britishquotes, revert_swedishgquotes,
revert_frenchquotes, revert_frenchinquotes, revert_russianquotes,
revert_swissquotes]],
diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt
index aaf647d..d6e1a86 100644
--- a/src/tex2lyx/TODO.txt
+++ b/src/tex2lyx/TODO.txt
@@ -100,6 +100,11 @@ Format LaTeX feature LyX feature
523 CJK Quote Styles InsetQuote
- cjk (corner brackets) \begin_inset Quotes j..
- cjkangle (angle brackets) \begin_inset Quotes k..
+524 Crimson/Cochineal fonts \font_roman, \font_math
+ \usepackage{cochineal} \font_roman cochineal
+ - [osf] \font_osf true
+ \usepackage{crimson} \font_roman cochineal
+ \usepackage[cochineal]{newtxmath} \font_math cochineal-ntxm
General
diff --git a/src/version.h b/src/version.h
index d62781f..4d7abcb 100644
--- a/src/version.h
+++ b/src/version.h
@@ -32,8 +32,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 523 // spitz: cjk quotes styles
-#define LYX_FORMAT_TEX2LYX 523
+#define LYX_FORMAT_LYX 524 // spitz: crimson/cochineal font
+#define LYX_FORMAT_TEX2LYX 524
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER