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
This commit is contained in:
Juergen Spitzmueller 2016-12-29 16:45:19 +01:00
parent b613be1dd8
commit f8a85f35be
6 changed files with 74 additions and 5 deletions

View File

@ -11,6 +11,14 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2016-12-29 Jürgen Spitzmüller <spitz@lyx.org>
* 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 <spitz@lyx.org>
* 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 <spitz@lyx.org>
* 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 <spitz@lyx.org>
* Format incremented to 449: Support for \item arguments.

View File

@ -410,7 +410,9 @@
\TestPackage{bookman}
\TestPackage{chancery}
\TestPackage{charter}
\TestPackage{cochineal}
\TestPackage{courier}
\TestPackage{crimson}
\TestPackage{helvet}
\TestPackage{mathpazo}
\TestPackage{mathpple}

View File

@ -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

View File

@ -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]],

View File

@ -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

View File

@ -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