Generalize the esintoramsmath requirement:

Now you can also require a|b|c, and if any of the features is already used,
no other one will be loaded. The first feature wins if none is already used.
This is required for a part of bug #7811.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39884 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2011-10-18 19:32:02 +00:00
parent a74153da0b
commit 6954c542fb
7 changed files with 66 additions and 38 deletions

View File

@ -825,12 +825,12 @@ tbond cmsy 180 186 mathord x
iffont esint
int esint 001 0 mathop ∫ esint
intop esint 001 0 mathop ∫ esint
iint esint 003 0 mathop ∬ esintoramsmath
iint esint 003 0 mathop ∬ esint|amsmath
iintop esint 003 0 mathop ∬ esint
iiint esint 005 0 mathop ∭ esintoramsmath
iiint esint 005 0 mathop ∭ esint|amsmath
iiintop esint 005 0 mathop ∭ esint
iiiint esint 007 0 mathop ⨌ esintoramsmath
iiiint esint 007 0 mathop ⨌ esint|amsmath
iiiintop esint 007 0 mathop ⨌ esint
oint esint 011 0 mathop ∮ esint
@ -851,12 +851,12 @@ ointclockwiseop esint 025 0 mathop ∲ esint
else
int cmex 82 242 mathop ∫ esint
intop cmex 82 242 mathop ∫ esint
iint wasy 115 0 mathop ∬ esintoramsmath
iint wasy 115 0 mathop ∬ esint|amsmath
iintop wasy 115 0 mathop &Int esint
iiint wasy 116 0 mathop ∭ esintoramsmath
iiint wasy 116 0 mathop ∭ esint|amsmath
iiintop wasy 116 0 mathop ∭ esint
\def\iiiint{\int\kern-6mu\int\kern-6mu\int\kern-6mu\int} esintoramsmath
\def\iiiint{\int\kern-6mu\int\kern-6mu\int\kern-6mu\int} esint|amsmath
\def\iiiintop{\int\kern-6mu\int\kern-6mu\int\kern-6mu\int} esint
\def\dotsint{\int\kern-3mu\cdots\kern-3mu\int} esint
\def\dotsintop{\int\kern-3mu\cdots\kern-3mu\int} esint

View File

@ -48,21 +48,21 @@
0x00ad "\\-" "" "" # SOFT HYPHEN
0x00ae "\\textregistered" "textcomp" "force" "\\circledR" "amssymb" # REGISTERED SIGN # the force flag is only needed due to a bug in teTeX 3 / TeXLive 2005
0x00af "\\textasciimacron" "textcomp" "" # MACRON
0x00b0 "\\textdegree" "textcomp" "force" # DEGREE SIGN # the force flag is only needed due to a bug in teTeX 3 / TeXLive 2005
0x00b0 "\\textdegree" "textcomp" "force" "{^\\circ}" "" # DEGREE SIGN # the force flag is only needed due to a bug in teTeX 3 / TeXLive 2005
0x00b1 "\\textpm" "textcomp" "force" "\pm" # ± PLUS-MINUS SIGN
0x00b2 "\\texttwosuperior" "textcomp" "force" "{{}^2}" "" # ² SUPERSCRIPT TWO
0x00b3 "\\textthreesuperior" "textcomp" "force" "{{}^3}" "" # ³ SUPERSCRIPT THREE
0x00b4 "\\textasciiacute" "textcomp" "" # ACUTE ACCENT
0x00b5 "\\textmu" "textcomp" "force" # µ MICRO SIGN
0x00b5 "\\textmu" "textcomp" "force" "\\mu" "" # µ MICRO SIGN
0x00b6 "\\textparagraph" "textcomp" "" # PILCROW SIGN # not equal to \textpilcrow
0x00b7 "\\textperiodcentered" "" "" "\cdot" # MIDDLE DOT
0x00b8 "\\c\\ " "" "" # CEDILLA (command from latin1.def)
0x00b9 "\\textonesuperior" "textcomp" "force" "{{}^1}" "" # ¹ SUPERSCRIPT ONE
0x00ba "\\textordmasculine" "textcomp" "" # MASCULINE ORDINAL INDICATOR
0x00bb "\\guillemotright" "" "" # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00bc "\\textonequarter" "textcomp" "" # 1/4 FRACTION
0x00bd "\\textonehalf" "textcomp" "" # 1/2 FRACTION
0x00be "\\textthreequarters" "textcomp" "" # 3/4 FRACTION
0x00bc "\\textonequarter" "textcomp" "" "\\frac14" "" # 1/4 FRACTION
0x00bd "\\textonehalf" "textcomp" "" "\\frac12" "" # 1/2 FRACTION
0x00be "\\textthreequarters" "textcomp" "" "\\frac34" "" # 3/4 FRACTION
0x00bf "\\textquestiondown" "" "" # INVERTED QUESTION MARK
0x00c0 "\\`{A}" "" "mathalpha" "\\grave{A}" # LATIN CAPITAL LETTER A WITH GRAVE
0x00c1 "\\'{A}" "" "mathalpha" "\\acute{A}" # LATIN CAPITAL LETTER A WITH ACUTE
@ -166,8 +166,8 @@
0x0123 "\\accent96 g" "" "mathalpha" "\\mathaccent96 g" # LATIN SMALL LETTER G WITH CEDILLA
0x0124 "\\^{H}" "" "mathalpha" "\\hat{H}" # LATIN CAPITAL LETTER H WITH CIRCUMFLEX
0x0125 "\\^{h}" "" "mathalpha" "\\hat{h}" # LATIN SMALL LETTER H WITH CIRCUMFLEX
#0x0126 "" "" "" # LATIN CAPITAL LETTER H WITH STROKE
#0x0127 "" "" "" # LATIN SMALL LETTER H WITH STROKE
#0x0126 "" "" "" "" "" # LATIN CAPITAL LETTER H WITH STROKE
#0x0127 "" "" "" "" "" # LATIN SMALL LETTER H WITH STROKE
0x0128 "\\~{I}" "" "mathalpha" "\\tilde{I}" # LATIN CAPITAL LETTER I WITH TILDE
0x0129 "\\~{\\i}" "" "mathalpha" "\\tilde{\\imath}" # LATIN SMALL LETTER I WITH TILDE
0x012a "\\={I}" "" "mathalpha" "\\bar{I}" # LATIN CAPITAL LETTER I WITH MACRON
@ -184,15 +184,15 @@
0x0135 "\\^{\\j}" "" "mathalpha" "\\hat{\\jmath}" # LATIN SMALL LETTER J WITH CIRCUMFLEX
0x0136 "\\c{K}" "" "mathalpha" "\\cedilla{K}" "accents,cedilla" # LATIN CAPITAL LETTER K WITH CEDILLA
0x0137 "\\c{k}" "" "mathalpha" "\\cedilla{k}" "accents,cedilla" # LATIN SMALL LETTER K WITH CEDILLA
#0x0138 "" "" "" # LATIN SMALL LETTER KRA
#0x0138 "" "" "" "" "" # LATIN SMALL LETTER KRA
0x0139 "\\'{L}" "" "mathalpha" "\\acute{L}" # LATIN CAPITAL LETTER L WITH ACUTE
0x013a "\\'{l}" "" "mathalpha" "\\acute{l}" # LATIN SMALL LETTER L WITH ACUTE
0x013b "\\c{L}" "" "mathalpha" "\\cedilla{L}" "accents,cedilla" # LATIN CAPITAL LETTER L WITH CEDILLA
0x013c "\\c{l}" "" "mathalpha" "\\cedilla{l}" "accents,cedilla" # LATIN SMALL LETTER L WITH CEDILLA
0x013d "\\v{L}" "" "mathalpha" "L\\mkern-7mu\\mathchar19" # LATIN CAPITAL LETTER L WITH CARON
0x013e "\\v{l}" "" "mathalpha" "l\\mkern-5mu\\mathchar19" # LATIN SMALL LETTER L WITH CARON
#0x013f "" "" "" # LATIN CAPITAL LETTER L WITH MIDDLE DOT
#0x0140 "" "" "" # LATIN SMALL LETTER L WITH MIDDLE DOT
#0x013f "" "" "" "" "" # LATIN CAPITAL LETTER L WITH MIDDLE DOT
#0x0140 "" "" "" "" "" # LATIN SMALL LETTER L WITH MIDDLE DOT
0x0141 "\\L" "" "mathalpha" "\\mkern2mu\\mathchar'40\\mkern-7mu L" # LATIN CAPITAL LETTER L WITH STROKE
0x0142 "\\l" "" "mathalpha" "\\mathchar'40\\mkern-5mu l" # LATIN SMALL LETTER L WITH STROKE
0x0143 "\\'{N}" "" "mathalpha" "\\acute{N}" # LATIN CAPITAL LETTER N WITH ACUTE
@ -201,17 +201,17 @@
0x0146 "\\c{n}" "" "mathalpha" "\\cedilla{n}" "accents,cedilla" # LATIN SMALL LETTER N WITH CEDILLA
0x0147 "\\v{N}" "" "mathalpha" "\\check{N}" # LATIN CAPITAL LETTER N WITH CARON
0x0148 "\\v{n}" "" "mathalpha" "\\check{n}" # LATIN SMALL LETTER N WITH CARON
#0x0149 "" "" "" # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
0x014a "\\NG" "" "" # LATIN CAPITAL LETTER ENG
0x014b "\\ng" "" "" # LATIN SMALL LETTER ENG
#0x0149 "" "" "" "" "" # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
0x014a "\\NG" "" "" "" "" # LATIN CAPITAL LETTER ENG
0x014b "\\ng" "" "" "" "" # LATIN SMALL LETTER ENG
0x014c "\\={O}" "" "mathalpha" "\\bar{O}" # LATIN CAPITAL LETTER O WITH MACRON
0x014d "\\={o}" "" "mathalpha" "\\bar{o}" # LATIN SMALL LETTER O WITH MACRON
0x014e "\\u{O}" "" "mathalpha" "\\breve{O}" # LATIN CAPITAL LETTER O WITH BREVE
0x014f "\\u{o}" "" "mathalpha" "\\breve{o}" # LATIN SMALL LETTER O WITH BREVE
0x0150 "\\H{O}" "" "mathalpha" "\\dacute{O}" "dacute" # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x0151 "\\H{o}" "" "mathalpha" "\\dacute{o}" "dacute" # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x0152 "\\OE" "" "" # LATIN CAPITAL LIGATURE OE
0x0153 "\\oe" "" "" # LATIN SMALL LIGATURE OE
0x0152 "\\OE" "" "" "" "" # LATIN CAPITAL LIGATURE OE
0x0153 "\\oe" "" "" "" "" # LATIN SMALL LIGATURE OE
0x0154 "\\'{R}" "" "mathalpha" "\\acute{R}" # LATIN CAPITAL LETTER R WITH ACUTE
0x0155 "\\'{r}" "" "mathalpha" "\\acute{r}" # LATIN SMALL LETTER R WITH ACUTE
0x0156 "\\c{R}" "" "mathalpha" "\\cedilla{R}" "accents,cedilla" # LATIN CAPITAL LETTER R WITH CEDILLA
@ -230,8 +230,8 @@
0x0163 "\\c{t}" "" "mathalpha" "\\cedilla{t}" "accents,cedilla" # LATIN SMALL LETTER T WITH CEDILLA
0x0164 "\\v{T}" "" "mathalpha" "\\check{T}" # LATIN CAPITAL LETTER T WITH CARON
0x0165 "\\v{t}" "" "mathalpha" "t\\mkern-5mu\\mathchar19" # LATIN SMALL LETTER T WITH CARON
#0x0166 "" "" "" # LATIN CAPITAL LETTER T WITH STROKE
#0x0167 "" "" "" # LATIN SMALL LETTER T WITH STROKE
#0x0166 "" "" "" "" "" # LATIN CAPITAL LETTER T WITH STROKE
#0x0167 "" "" "" "" "" # LATIN SMALL LETTER T WITH STROKE
0x0168 "\\~{U}" "" "mathalpha" "\\tilde{U}" # LATIN CAPITAL LETTER U WITH TILDE
0x0169 "\\~{u}" "" "mathalpha" "\\tilde{u}" # LATIN SMALL LETTER U WITH TILDE
0x016a "\\={U}" "" "mathalpha" "\\bar{U}" # LATIN CAPITAL LETTER U WITH MACRON
@ -255,7 +255,7 @@
0x017c "\\.{z}" "" "mathalpha" "\\dot{z}" # LATIN SMALL LETTER Z WITH DOT ABOVE
0x017d "\\v{Z}" "" "mathalpha" "\\check{Z}" # LATIN CAPITAL LETTER Z WITH CARON
0x017e "\\v{z}" "" "mathalpha" "\\check{z}" # LATIN SMALL LETTER Z WITH CARON
#0x017f "" "" "" # LATIN SMALL LETTER LONG S
#0x017f "" "" "" "" "" # LATIN SMALL LETTER LONG S
#
# Latin Extended-B
#
@ -1806,8 +1806,8 @@
0x2229 "" "" "" "\\bigcap" # INTERSECTION
0x222a "" "" "" "\\bigcup" "" # UNION
0x222b "" "" "" "\\int" "esint" # INTEGRAL
0x222c "" "" "" "\\iint" "esintoramsmath" # DOUBLE INTEGRAL
0x222d "" "" "" "\\iiint" "esintoramsmath" # TRIPLE INTEGRAL
0x222c "" "" "" "\\iint" "esint|amsmath" # DOUBLE INTEGRAL
0x222d "" "" "" "\\iiint" "esint|amsmath" # TRIPLE INTEGRAL
0x222e "" "" "" "\\oint" "esint" # CONTOUR INTEGRAL
0x222f "" "" "" "\\oiint" "esint" # SURFACE INTEGRAL
0x2230 "" "" "" "\\oiiint" "txfonts" # VOLUME INTEGRAL

View File

@ -1717,6 +1717,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
// Now insert the LyX specific LaTeX commands...
docstring lyxpreamble;
features.resolveAlternatives();
if (output_sync) {
if (!output_sync_macro.empty())

View File

@ -806,6 +806,10 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
breakout = true;
}
// backward compatibility
if (info.mathpreamble == "esintoramsmath")
info.mathpreamble = "esint|amsmath";
if (!info.textpreamble.empty())
info.textfeature = info.textpreamble[0] != '\\';
if (!info.mathpreamble.empty())

View File

@ -710,8 +710,9 @@ string const LaTeXFeatures::getPackages() const
// if fontspec is used, AMS packages have to be loaded before
// fontspec (in BufferParams)
if (!params_.useNonTeXFonts && !loadAMSPackages().empty())
packages << loadAMSPackages();
string const amsPackages = loadAMSPackages();
if (!params_.useNonTeXFonts && !amsPackages.empty())
packages << amsPackages;
// fixltx2e must be loaded after amsthm, since amsthm produces an error with
// the redefined \[ command (bug 7233). Load is as early as possible, since
@ -779,7 +780,7 @@ string const LaTeXFeatures::getPackages() const
// esint must be after amsmath and wasysym, since it will redeclare
// inconsistent integral symbols
if ((mustProvide("esint") || mustProvide("esintoramsmath")) &&
if (mustProvide("esint") &&
params_.use_esint != BufferParams::package_off)
packages << "\\usepackage{esint}\n";
@ -1062,12 +1063,8 @@ string const LaTeXFeatures::loadAMSPackages() const
if (mustProvide("amsthm"))
tmp << "\\usepackage{amsthm}\n";
// esint is preferred for esintoramsmath
if ((mustProvide("amsmath")
&& params_.use_amsmath != BufferParams::package_off)
|| (mustProvide("esintoramsmath")
&& params_.use_esint == BufferParams::package_off
&& params_.use_amsmath != BufferParams::package_off)) {
if (mustProvide("amsmath")
&& params_.use_amsmath != BufferParams::package_off) {
tmp << "\\usepackage{amsmath}\n";
} else {
// amsbsy and amstext are already provided by amsmath
@ -1076,7 +1073,7 @@ string const LaTeXFeatures::loadAMSPackages() const
if (mustProvide("amstext"))
tmp << "\\usepackage{amstext}\n";
}
if (mustProvide("amssymb")
|| params_.use_amsmath == BufferParams::package_on)
tmp << "\\usepackage{amssymb}\n";
@ -1388,4 +1385,25 @@ void LaTeXFeatures::getFloatDefinitions(odocstream & os) const
}
void LaTeXFeatures::resolveAlternatives()
{
for (Features::iterator it = features_.begin(); it != features_.end();) {
if (contains(*it, '|')) {
vector<string> const alternatives = getVectorFromString(*it, "|");
vector<string>::const_iterator const end = alternatives.end();
vector<string>::const_iterator ita = alternatives.begin();
for (; ita != end; ++ita) {
if (isRequired(*ita))
break;
}
if (ita == end)
require(alternatives.front());
features_.erase(it);
it = features_.begin();
} else
++it;
}
}
} // namespace lyx

View File

@ -131,6 +131,8 @@ public:
void inFloat(bool const b) { in_float_ = b; }
/// Runparams that will be used for exporting this file.
OutputParams const & runparams() const { return runparams_; }
/// Resolve alternatives like "esint|amsmath|wasysym"
void resolveAlternatives();
///
void setHTMLTitle(docstring const & t) { htmltitle_ = t; }
///

View File

@ -161,9 +161,12 @@ void initSymbols()
else
is >> tmp.extra;
// requires is optional
if (is)
if (is) {
is >> tmp.requires;
else {
// backward compatibility
if (tmp.requires == "esintoramsmath")
tmp.requires = from_ascii("esint|amsmath");
} else {
LYXERR(Debug::MATHED, "skipping line '" << line << "'\n"
<< to_utf8(tmp.name) << ' ' << to_utf8(tmp.inset) << ' '
<< to_utf8(tmp.extra));