mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Compare commits
7 Commits
df1ba8ee59
...
73c19cae41
Author | SHA1 | Date | |
---|---|---|---|
|
73c19cae41 | ||
|
5c17e07bd1 | ||
|
78ce5ebc45 | ||
|
9a81bb36f4 | ||
|
91a85dd96a | ||
|
477e36db9f | ||
|
7feffb89e9 |
@ -7,6 +7,11 @@ changes happened in particular if possible. A good example would be
|
||||
|
||||
-----------------------
|
||||
|
||||
2024-09-29 Thibaut Cuvelier <tcuvelier@lyx.org>
|
||||
* Format incremented to 631: Add support for MathML versions, which
|
||||
are stored separately for DocBook and XHTML (\docbook_mathml_version,
|
||||
which is new, and \html_math_output, which receives a new value).
|
||||
|
||||
2024-08-25 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 630: Add support for a number of languages in
|
||||
babel and polyglossia:
|
||||
|
@ -1015,6 +1015,48 @@ def revert_new_babel_languages(document):
|
||||
if document.language == "hebrew" or find_token(document.body, "\\lang oldrussian", 0) != -1:
|
||||
add_to_preamble(document, ["\\PassOptionsToPackage{provide*=*}{babel}"])
|
||||
|
||||
|
||||
def convert_mathml_version(document):
|
||||
"""Add MathML version header for DocBook to use MathML 3 preferably.
|
||||
|
||||
For cleanliness, add this header close to other DocBook headers if present.
|
||||
|
||||
Leave XHTML alone, as the default value is still probably what the user wants (MathML Core)."""
|
||||
|
||||
i = find_token(document.header, "\\docbook", 0)
|
||||
if i == -1:
|
||||
document.header += ["\\docbook_mathml_version 0"]
|
||||
else:
|
||||
document.header.insert(i + 1, "\\docbook_mathml_version 0")
|
||||
|
||||
|
||||
def revert_mathml_version(document):
|
||||
"""Remove MathML version header.
|
||||
|
||||
For XHTML, only remove the value 4 for \html_math_output (MathML 3) and replace it with 0
|
||||
(MathML Core with format 631+, MathML for 630-).
|
||||
|
||||
For DocBook, totally remove the header (the default with 630- is MathML)."""
|
||||
|
||||
while True:
|
||||
i = find_token(document.header, "\\html_math_output", 0)
|
||||
if i == -1:
|
||||
# nothing to do
|
||||
break
|
||||
|
||||
# remove XHTML header if using the new value, leave alone otherwise.
|
||||
if "4" in document.header:
|
||||
document.header[i] = "\\html_math_output 0"
|
||||
|
||||
while True:
|
||||
i = find_token(document.header, "\\docbook_mathml_version", 0)
|
||||
if i == -1:
|
||||
# nothing to do
|
||||
return
|
||||
|
||||
# remove header
|
||||
del document.header[i]
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -1030,11 +1072,13 @@ convert = [
|
||||
[627, [convert_nomencl, convert_index_sc]],
|
||||
[628, []],
|
||||
[629, []],
|
||||
[630, []]
|
||||
[630, []],
|
||||
[631, [convert_mathml_version]]
|
||||
]
|
||||
|
||||
|
||||
revert = [
|
||||
[630, [revert_mathml_version]],
|
||||
[629, [revert_new_polyglossia_languages, revert_new_babel_languages]],
|
||||
[628, [revert_langopts]],
|
||||
[627, [revert_nomentbl]],
|
||||
|
@ -4472,8 +4472,11 @@ void Buffer::setMathFlavor(OutputParams & op) const
|
||||
// In particular, this function has no impact on the DocBook code, as it
|
||||
// uses another mechanism to handle math flavours.
|
||||
switch (params().html_math_output) {
|
||||
case BufferParams::MathML:
|
||||
op.math_flavor = OutputParams::MathAsMathML;
|
||||
case BufferParams::MathMLCore:
|
||||
op.math_flavor = OutputParams::MathAsMathMLCore;
|
||||
break;
|
||||
case BufferParams::MathML3:
|
||||
op.math_flavor = OutputParams::MathAsMathML3;
|
||||
break;
|
||||
case BufferParams::HTML:
|
||||
op.math_flavor = OutputParams::MathAsHTML;
|
||||
|
@ -480,11 +480,12 @@ BufferParams::BufferParams()
|
||||
// default index
|
||||
indiceslist().addDefault(B_("Index"));
|
||||
html_be_strict = false;
|
||||
html_math_output = MathML;
|
||||
html_math_output = MathMLCore;
|
||||
html_math_img_scale = 1.0;
|
||||
html_css_as_file = false;
|
||||
docbook_table_output = HTMLTable;
|
||||
docbook_mathml_prefix = MPrefix;
|
||||
docbook_mathml_version = MathMLStream::mathml3;
|
||||
display_pixel_ratio = 1.0;
|
||||
|
||||
shell_escape = false;
|
||||
@ -1226,6 +1227,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
int temp;
|
||||
lex >> temp;
|
||||
docbook_mathml_prefix = static_cast<MathMLNameSpacePrefix>(temp);
|
||||
} else if (token == "\\docbook_mathml_version") {
|
||||
int temp;
|
||||
lex >> temp;
|
||||
docbook_mathml_version = static_cast<MathMLStream::MathMLVersion>(temp);
|
||||
} else if (token == "\\output_sync") {
|
||||
lex >> output_sync;
|
||||
} else if (token == "\\output_sync_macro") {
|
||||
@ -1621,6 +1626,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
||||
|
||||
os << "\\docbook_table_output " << docbook_table_output << '\n';
|
||||
os << "\\docbook_mathml_prefix " << docbook_mathml_prefix << '\n';
|
||||
os << "\\docbook_mathml_version " << docbook_mathml_version << '\n';
|
||||
|
||||
if (html_math_img_scale != 1.0)
|
||||
os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n';
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "mathed/MathStream.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace support {
|
||||
@ -587,7 +589,8 @@ public:
|
||||
|
||||
// do not change these values. we rely upon them.
|
||||
enum MathOutput {
|
||||
MathML = 0,
|
||||
MathMLCore = 0,
|
||||
MathML3 = 4,
|
||||
HTML = 1,
|
||||
Images = 2,
|
||||
LaTeX = 3
|
||||
@ -625,6 +628,9 @@ public:
|
||||
/// what prefix to use when outputting MathML. present choices are above
|
||||
MathMLNameSpacePrefix docbook_mathml_prefix;
|
||||
|
||||
/// what version of MathML to use for DocBook output (likely different from the version used for XHTML)
|
||||
MathMLStream::MathMLVersion docbook_mathml_version;
|
||||
|
||||
/// allow the LaTeX backend to run external programs
|
||||
bool shell_escape;
|
||||
/// generate output usable for reverse/forward search
|
||||
|
@ -658,7 +658,7 @@ void putClipboard(ParagraphList const & paragraphs,
|
||||
// We don't want to produce images that are not used. Therefore,
|
||||
// output formulas as MathML. Even if this is not understood by all
|
||||
// applications, the number that can parse it should go up in the future.
|
||||
buffer->params().html_math_output = BufferParams::MathML;
|
||||
buffer->params().html_math_output = BufferParams::MathMLCore;
|
||||
|
||||
// Copy authors to the params. We need those pointers.
|
||||
for (Author const & a : bp.authors())
|
||||
|
@ -54,7 +54,8 @@ class OutputParams {
|
||||
public:
|
||||
enum MathFlavor {
|
||||
NotApplicable,
|
||||
MathAsMathML,
|
||||
MathAsMathMLCore,
|
||||
MathAsMathML3,
|
||||
MathAsHTML,
|
||||
MathAsImages,
|
||||
MathAsLaTeX
|
||||
|
@ -952,6 +952,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(outputModule->mathmlprefixCB, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(outputModule->mathmlverCB, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
connect(outputModule->shellescapeCB, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(shellescapeChanged()));
|
||||
@ -4076,6 +4078,12 @@ void GuiDocument::applyView()
|
||||
auto const mp = static_cast<BufferParams::MathMLNameSpacePrefix>(mathmlprefix);
|
||||
bp_.docbook_mathml_prefix = mp;
|
||||
|
||||
int mathmlversion = outputModule->mathmlverCB->currentIndex();
|
||||
if (mathmlversion == -1)
|
||||
mathmlversion = 0;
|
||||
auto const mv = static_cast<MathMLStream::MathMLVersion>(mathmlversion);
|
||||
bp_.docbook_mathml_version = mv;
|
||||
|
||||
bp_.save_transient_properties =
|
||||
outputModule->saveTransientPropertiesCB->isChecked();
|
||||
bp_.postpone_fragile_content =
|
||||
|
@ -6,17 +6,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>702</width>
|
||||
<height>501</height>
|
||||
<width>579</width>
|
||||
<height>465</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="savingGB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -47,7 +45,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="outputFormatGB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -117,7 +115,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -132,7 +130,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="outputOptionsGB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -143,7 +141,438 @@
|
||||
<property name="title">
|
||||
<string>Output Options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>&LaTeX</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="postponeFragileCB">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, fragile items such as labels and index entries are moved out of moving arguments such as sections and captions. This prevents LaTeX errors that can happen in such cases. It is recommended to keep this on.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Put fra&gile content out of moving arguments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="outputsyncCB">
|
||||
<property name="toolTip">
|
||||
<string>Enable forward/reverse search between editor and output (e.g., SyncTeX)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&ynchronize with output</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="synccustomLA">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C&ustom macro:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>synccustomCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="synccustomCB">
|
||||
<property name="toolTip">
|
||||
<string>Custom LaTeX preamble macro</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>&XHTML</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="mathoutLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Math output:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mathmlverCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="mathoutCB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Format to use for math output.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MathML Core (default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTML</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Images</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>LaTeX</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MathML 3</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="strictCB">
|
||||
<property name="toolTip">
|
||||
<string>Whether to comply strictly with XHTML 1.1.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Strict XHTML 1.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cssCB">
|
||||
<property name="text">
|
||||
<string>Write CSS to file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>&DocBook</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="tableoutLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Table output:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mathmlverCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QComboBox" name="tableoutCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Format to use for math output.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTML</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CALS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>320</width>
|
||||
<height>38</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="mathmlverLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MathML &version:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mathmlverCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QComboBox" name="mathmlverCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Format to use for math output.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MathML 3 (default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MathML Core</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="mathmlprefixLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&MathML namespace prefix:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mathmlprefixCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QComboBox" name="mathmlprefixCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Namespace prefix to use for MathML formulae. For instance, with the <code>m</code> prefix, the MathML tags will be output like <code>m:math</code>.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No prefix (namespace defined inline for each tag)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>m (default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mml</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
@ -191,211 +620,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>&LaTeX</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="postponeFragileCB">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, fragile items such as labels and index entries are moved out of moving arguments such as sections and captions. This prevents LaTeX errors that can happen in such cases. It is recommended to keep this on.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Put fra&gile content out of moving arguments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="outputsyncCB">
|
||||
<property name="toolTip">
|
||||
<string>Enable forward/reverse search between editor and output (e.g., SyncTeX)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&ynchronize with output</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="synccustomLA">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C&ustom macro:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>synccustomCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="synccustomCB">
|
||||
<property name="toolTip">
|
||||
<string>Custom LaTeX preamble macro</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>&XHTML</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="strictCB">
|
||||
<property name="toolTip">
|
||||
<string>Whether to comply strictly with XHTML 1.1.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Strict XHTML 1.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cssCB">
|
||||
<property name="text">
|
||||
<string>Write CSS to file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="mathoutLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Math output:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>tableoutCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="mathoutCB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Format to use for math output.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MathML</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTML</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Images</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>LaTeX</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -409,144 +634,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>&DocBook</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="tableoutLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Table output:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>tableoutCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="tableoutCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Format to use for math output.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTML</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CALS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>178</width>
|
||||
<height>38</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="mathmlprefixLA">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&MathML namespace prefix:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mathmlprefixCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="mathmlprefixCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Namespace prefix to use for MathML formulae. For instance, with the <code>m</code> prefix, the MathML tags will be output like <code>m:math</code>.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No prefix (namespace defined inline for each tag)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>m (default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>mml</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>148</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="shellescapeCB">
|
||||
<property name="toolTip">
|
||||
<string>Runs the LaTeX backend with the -shell-escape option (Warning: use only when really necessary)</string>
|
||||
@ -556,15 +645,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Policy::Expanding</enum>
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -119,7 +119,8 @@ void InsetMathBox::validate(LaTeXFeatures & features) const
|
||||
// FIXME XHTML
|
||||
// It'd be better to be able to get this from an InsetLayout, but at present
|
||||
// InsetLayouts do not seem really to work for things that aren't InsetTexts.
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathML)
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathMLCore ||
|
||||
features.runparams().math_flavor == OutputParams::MathAsMathML3)
|
||||
features.addCSSSnippet("mtext.mathbox { font-style: normal; }");
|
||||
else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
|
||||
features.addCSSSnippet("span.mathbox { font-style: normal; }");
|
||||
@ -204,7 +205,8 @@ void InsetMathFBox::validate(LaTeXFeatures & features) const
|
||||
// FIXME XHTML
|
||||
// It'd be better to be able to get this from an InsetLayout, but at present
|
||||
// InsetLayouts do not seem really to work for things that aren't InsetTexts.
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathML)
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathMLCore ||
|
||||
features.runparams().math_flavor == OutputParams::MathAsMathML3)
|
||||
features.addCSSSnippet(
|
||||
"mtext.fbox { border: 1px solid black; font-style: normal; padding: 0.5ex; }");
|
||||
else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
|
||||
@ -343,7 +345,8 @@ void InsetMathMakebox::validate(LaTeXFeatures & features) const
|
||||
// FIXME XHTML
|
||||
// It'd be better to be able to get this from an InsetLayout, but at present
|
||||
// InsetLayouts do not seem really to work for things that aren't InsetTexts.
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathML)
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathMLCore ||
|
||||
features.runparams().math_flavor == OutputParams::MathAsMathML3)
|
||||
features.addCSSSnippet("mtext.framebox { border: 1px solid black; }");
|
||||
else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
|
||||
features.addCSSSnippet("span.framebox { border: 1px solid black; }");
|
||||
@ -423,7 +426,8 @@ void InsetMathBoxed::validate(LaTeXFeatures & features) const
|
||||
// FIXME XHTML
|
||||
// It'd be better to be able to get this from an InsetLayout, but at present
|
||||
// InsetLayouts do not seem really to work for things that aren't InsetTexts.
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathML)
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathMLCore ||
|
||||
features.runparams().math_flavor == OutputParams::MathAsMathML3)
|
||||
features.addCSSSnippet("mtext.boxed { border: 1px solid black; }");
|
||||
else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
|
||||
features.addCSSSnippet("span.boxed { border: 1px solid black; }");
|
||||
|
@ -98,7 +98,8 @@ void InsetMathEnsureMath::validate(LaTeXFeatures & features) const
|
||||
// FIXME XHTML
|
||||
// It'd be better to be able to get this from an InsetLayout, but at present
|
||||
// InsetLayouts do not seem really to work for things that aren't InsetTexts.
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathML)
|
||||
if (features.runparams().math_flavor == OutputParams::MathAsMathMLCore ||
|
||||
features.runparams().math_flavor == OutputParams::MathAsMathML3)
|
||||
features.addCSSSnippet("mstyle.math { font-style: italic; }");
|
||||
else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
|
||||
features.addCSSSnippet("span.mathbox { font-style: italic; }");
|
||||
|
@ -28,6 +28,164 @@ using namespace lyx::support;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace {
|
||||
// Similar to FontInfo and its related enums, but specifically for the math
|
||||
// mode.
|
||||
//
|
||||
// All types have enumerations, like FontEnums.h, even though there are
|
||||
// sometimes only two cases: this design ensures some future-proofness and
|
||||
// ensures that you cannot inadvertently swap two values.
|
||||
class MathFontInfo {
|
||||
public:
|
||||
enum MathFontFamily {
|
||||
MATH_NORMAL_FAMILY = 0, // Default value in MathML.
|
||||
MATH_FRAKTUR_FAMILY,
|
||||
MATH_SANS_FAMILY,
|
||||
MATH_MONOSPACE_FAMILY,
|
||||
MATH_DOUBLE_STRUCK_FAMILY,
|
||||
MATH_SCRIPT_FAMILY,
|
||||
MATH_SMALL_CAPS // Not natively supported in any version of MathML.
|
||||
};
|
||||
|
||||
enum MathFontSeries {
|
||||
MATH_MEDIUM_SERIES = 0, // Default value in MathML. // Default value in MathML.
|
||||
MATH_BOLD_SERIES
|
||||
};
|
||||
|
||||
enum MathFontShape {
|
||||
MATH_UP_SHAPE = 0,
|
||||
MATH_ITALIC_SHAPE // Default value in MathML mi, not outside.
|
||||
};
|
||||
|
||||
MathFontInfo() :
|
||||
family_(MATH_NORMAL_FAMILY), series_(MATH_MEDIUM_SERIES), shape_(MATH_UP_SHAPE) {}
|
||||
MathFontInfo(const MathFontFamily family, const MathFontSeries series, const MathFontShape shape) :
|
||||
family_(family), series_(series), shape_(shape) {}
|
||||
|
||||
static MathFontInfo fromMacro(const docstring& tag)
|
||||
{
|
||||
MathFontInfo font;
|
||||
if (tag == "mathnormal" || tag == "mathrm"
|
||||
|| tag == "text" || tag == "textnormal"
|
||||
|| tag == "textrm" || tag == "textup"
|
||||
|| tag == "textmd")
|
||||
font.shape_ = MATH_UP_SHAPE;
|
||||
else if (tag == "frak" || tag == "mathfrak")
|
||||
font.family_ = MATH_FRAKTUR_FAMILY;
|
||||
else if (tag == "mathbf" || tag == "textbf")
|
||||
font.series_ = MATH_BOLD_SERIES;
|
||||
else if (tag == "mathbb" || tag == "mathbbm"
|
||||
|| tag == "mathds")
|
||||
font.family_ = MATH_DOUBLE_STRUCK_FAMILY;
|
||||
else if (tag == "mathcal")
|
||||
font.family_ = MATH_SCRIPT_FAMILY;
|
||||
else if (tag == "mathit" || tag == "textsl"
|
||||
|| tag == "emph" || tag == "textit")
|
||||
font.shape_ = MATH_ITALIC_SHAPE;
|
||||
else if (tag == "mathsf" || tag == "textsf")
|
||||
font.family_ = MATH_SANS_FAMILY;
|
||||
else if (tag == "mathtt" || tag == "texttt")
|
||||
font.family_ = MATH_MONOSPACE_FAMILY;
|
||||
else if (tag == "textipa" || tag == "textsc" || tag == "noun")
|
||||
font.family_ = MATH_SMALL_CAPS;
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
MathFontFamily family() const { return family_; }
|
||||
MathFontSeries series() const { return series_; }
|
||||
MathFontShape shape() const { return shape_; }
|
||||
|
||||
std::string toMathMLMathVariant(MathMLStream::MathMLVersion mathml_version) const
|
||||
{
|
||||
return mathml_version == MathMLStream::MathMLVersion::mathml3 ?
|
||||
toMathVariantForMathML3() : toMathVariantForMathMLCore();
|
||||
}
|
||||
|
||||
std::string toHTMLSpanClass() const
|
||||
{
|
||||
std::string span_class;
|
||||
switch (family_) {
|
||||
case MATH_NORMAL_FAMILY:
|
||||
break;
|
||||
case MATH_FRAKTUR_FAMILY:
|
||||
span_class = "fraktur";
|
||||
break;
|
||||
case MATH_SANS_FAMILY:
|
||||
span_class = "sans";
|
||||
break;
|
||||
case MATH_MONOSPACE_FAMILY:
|
||||
span_class = "monospace";
|
||||
break;
|
||||
case MATH_DOUBLE_STRUCK_FAMILY:
|
||||
// This style does not exist in HTML and cannot be implemented in CSS.
|
||||
break;
|
||||
case MATH_SCRIPT_FAMILY:
|
||||
span_class = "script";
|
||||
break;
|
||||
case MATH_SMALL_CAPS:
|
||||
span_class = "noun";
|
||||
break;
|
||||
}
|
||||
|
||||
if (series_ == MATH_BOLD_SERIES) {
|
||||
if (!span_class.empty()) span_class += "-";
|
||||
span_class += "bold";
|
||||
}
|
||||
|
||||
if (shape_ == MATH_ITALIC_SHAPE) {
|
||||
if (!span_class.empty()) span_class += "-";
|
||||
span_class += "italic";
|
||||
}
|
||||
|
||||
return span_class;
|
||||
}
|
||||
|
||||
private:
|
||||
MathFontFamily family_;
|
||||
MathFontSeries series_;
|
||||
MathFontShape shape_;
|
||||
|
||||
std::string toMathVariantForMathML3() const
|
||||
{
|
||||
// mathvariant is the way MathML 3 encodes fonts.
|
||||
// Not all combinations are supported. Official list:
|
||||
// https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt
|
||||
// "initial", "tailed", "looped", and "stretched" are not implemented,
|
||||
// as they are only useful for Arabic characters (for which LyX has no
|
||||
// support right now).
|
||||
switch (family_) {
|
||||
case MATH_MONOSPACE_FAMILY:
|
||||
return "monospace";
|
||||
case MATH_DOUBLE_STRUCK_FAMILY:
|
||||
return "double-struck";
|
||||
case MATH_FRAKTUR_FAMILY:
|
||||
return series_ == MATH_BOLD_SERIES ? "bold-fraktur" : "fraktur";
|
||||
case MATH_SCRIPT_FAMILY:
|
||||
return series_ == MATH_BOLD_SERIES ? "bold-script" : "script";
|
||||
case MATH_SANS_FAMILY:
|
||||
if (series_ == MATH_MEDIUM_SERIES) {
|
||||
return shape_ == MATH_UP_SHAPE ? "sans-serif" : "sans-serif-italic";
|
||||
}
|
||||
return shape_ == MATH_UP_SHAPE ? "bold-sans-serif" : "sans-serif-bold-italic";
|
||||
case MATH_NORMAL_FAMILY:
|
||||
if (series_ == MATH_MEDIUM_SERIES) {
|
||||
return shape_ == MATH_UP_SHAPE ? "normal" : "italic";
|
||||
}
|
||||
return shape_ == MATH_UP_SHAPE ? "bold" : "bold-italic";
|
||||
case MATH_SMALL_CAPS:
|
||||
// No valid value...
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string toMathVariantForMathMLCore() const
|
||||
{
|
||||
return shape_ == MATH_UP_SHAPE ? "normal" : "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
InsetMathFont::InsetMathFont(Buffer * buf, latexkeys const * key)
|
||||
: InsetMathNest(buf, 1), key_(key)
|
||||
{}
|
||||
@ -137,13 +295,29 @@ void InsetMathFont::validate(LaTeXFeatures & features) const
|
||||
} else if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
|
||||
features.addCSSSnippet(
|
||||
"span.normal{font: normal normal normal inherit serif;}\n"
|
||||
"span.fraktur{font: normal normal normal inherit cursive;}\n"
|
||||
"span.bold{font: normal normal bold inherit serif;}\n"
|
||||
"span.script{font: normal normal normal inherit cursive;}\n"
|
||||
"span.italic{font: italic normal normal inherit serif;}\n"
|
||||
"span.bold-italic{font: italic normal bold inherit serif;}\n"
|
||||
"span.fraktur{font: normal normal normal inherit cursive;}\n"
|
||||
"span.fraktur-bold{font: normal normal bold inherit cursive;}\n"
|
||||
"span.fraktur-italic{font: italic normal normal inherit cursive;}\n"
|
||||
"span.fraktur-bold-italic{font: italic normal bold inherit cursive;}\n"
|
||||
"span.script{font: normal normal normal inherit cursive;}\n"
|
||||
"span.script-bold{font: normal normal bold inherit cursive;}\n"
|
||||
"span.script-italic{font: italic normal normal inherit cursive;}\n"
|
||||
"span.script-bold-italic{font: italic normal bold inherit cursive;}\n"
|
||||
"span.sans{font: normal normal normal inherit sans-serif;}\n"
|
||||
"span.sans-bold{font: normal normal normal inherit bold-serif;}\n"
|
||||
"span.sans-italic{font: italic normal normal inherit sans-serif;}\n"
|
||||
"span.sans-bold-italic{font: italic normal normal inherit bold-serif;}\n"
|
||||
"span.monospace{font: normal normal normal inherit monospace;}\n"
|
||||
"span.noun{font: normal small-caps normal inherit normal;}");
|
||||
"span.monospace-bold{font: normal normal bold inherit monospace;}\n"
|
||||
"span.monospace-italic{font: italic normal normal inherit monospace;}\n"
|
||||
"span.monospace-bold-italic{font: italic normal bold inherit monospace;}\n"
|
||||
"span.noun{font: normal small-caps normal inherit normal;}\n"
|
||||
"span.noun-bold{font: normal small-caps bold inherit normal;}\n"
|
||||
"span.noun-italic{font: italic small-caps normal inherit normal;}\n"
|
||||
"span.noun-bold-italic{font: italic small-caps bold inherit normal;}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,35 +328,11 @@ void InsetMathFont::htmlize(HtmlStream & os) const
|
||||
// FIXME These are not quite right, because they do not nest
|
||||
// correctly. A proper fix would presumably involve tracking
|
||||
// the fonts already in effect.
|
||||
std::string variant;
|
||||
docstring const & tag = key_->name;
|
||||
if (tag == "mathnormal" || tag == "mathrm"
|
||||
|| tag == "text" || tag == "textnormal"
|
||||
|| tag == "textrm" || tag == "textup"
|
||||
|| tag == "textmd")
|
||||
variant = "normal";
|
||||
else if (tag == "frak" || tag == "mathfrak")
|
||||
variant = "fraktur";
|
||||
else if (tag == "mathbf" || tag == "textbf")
|
||||
variant = "bold";
|
||||
else if (tag == "mathbb" || tag == "mathbbm"
|
||||
|| tag == "mathds")
|
||||
variant = "double-struck";
|
||||
else if (tag == "mathcal")
|
||||
variant = "script";
|
||||
else if (tag == "mathit" || tag == "textsl"
|
||||
|| tag == "emph" || tag == "textit")
|
||||
variant = "italic";
|
||||
else if (tag == "mathsf" || tag == "textsf")
|
||||
variant = "sans";
|
||||
else if (tag == "mathtt" || tag == "texttt")
|
||||
variant = "monospace";
|
||||
else if (tag == "textipa" || tag == "textsc" || tag == "noun")
|
||||
variant = "noun";
|
||||
const MathFontInfo font = MathFontInfo::fromMacro(key_->name);
|
||||
const std::string span_class = font.toHTMLSpanClass();
|
||||
|
||||
docstring const beg = (tag.size() < 4) ? from_ascii("") : tag.substr(0, 4);
|
||||
if (!variant.empty()) {
|
||||
os << MTag("span", "class='" + variant + "'")
|
||||
if (!span_class.empty()) {
|
||||
os << MTag("span", "class='" + span_class + "'")
|
||||
<< cell(0)
|
||||
<< ETag("span");
|
||||
} else
|
||||
@ -196,29 +346,10 @@ void InsetMathFont::mathmlize(MathMLStream & ms) const
|
||||
// FIXME These are not quite right, because they do not nest
|
||||
// correctly. A proper fix would presumably involve tracking
|
||||
// the fonts already in effect.
|
||||
std::string variant;
|
||||
docstring const & tag = key_->name;
|
||||
if (tag == "mathnormal" || tag == "mathrm")
|
||||
variant = "normal";
|
||||
else if (tag == "frak" || tag == "mathfrak")
|
||||
variant = "fraktur";
|
||||
else if (tag == "mathbf" || tag == "textbf")
|
||||
variant = "bold";
|
||||
else if (tag == "mathbb" || tag == "mathbbm" || tag == "mathds")
|
||||
variant = "double-struck";
|
||||
else if (tag == "mathcal")
|
||||
variant = "script";
|
||||
else if (tag == "mathit" || tag == "textsl" || tag == "emph" ||
|
||||
tag == "textit")
|
||||
variant = "italic";
|
||||
else if (tag == "mathsf" || tag == "textsf")
|
||||
variant = "sans-serif";
|
||||
else if (tag == "mathtt" || tag == "texttt")
|
||||
variant = "monospace";
|
||||
// no support at present for textipa, textsc, noun
|
||||
const MathFontInfo font = MathFontInfo::fromMacro(key_->name);
|
||||
const std::string variant = font.toMathMLMathVariant(ms.version());
|
||||
|
||||
if (tag == "text" || tag == "textnormal" || tag == "textrm" ||
|
||||
tag == "textup" || tag == "textmd") {
|
||||
if (font.shape() == MathFontInfo::MATH_UP_SHAPE) {
|
||||
SetMode textmode(ms, true);
|
||||
ms << cell(0);
|
||||
} else if (!variant.empty()) {
|
||||
|
@ -2655,9 +2655,13 @@ docstring InsetMathHull::xhtml(XMLStream & xs, OutputParams const & op) const
|
||||
}
|
||||
|
||||
// FIXME Eventually we would like to do this inset by inset.
|
||||
if (mathtype == BufferParams::MathML) {
|
||||
if (mathtype == BufferParams::MathML3 || mathtype == BufferParams::MathMLCore) {
|
||||
MathMLStream::MathMLVersion mathml_version = MathMLStream::mathmlCore;
|
||||
if (mathtype == BufferParams::MathML3)
|
||||
mathml_version = MathMLStream::mathml3;
|
||||
|
||||
odocstringstream os;
|
||||
MathMLStream ms(os, "", MathMLStream::mathmlCore);
|
||||
MathMLStream ms(os, "", mathml_version);
|
||||
try {
|
||||
mathmlize(ms);
|
||||
success = true;
|
||||
|
@ -562,6 +562,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
|
||||
h_html_math_output = "0";
|
||||
h_docbook_table_output = "0";
|
||||
h_docbook_mathml_prefix = "1";
|
||||
h_docbook_mathml_version = "0";
|
||||
h_index[0] = "Index";
|
||||
h_index_command = "default";
|
||||
h_inputencoding = "auto-legacy";
|
||||
@ -2168,6 +2169,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
|
||||
<< "\\html_be_strict " << h_html_be_strict << "\n"
|
||||
<< "\\docbook_table_output " << h_docbook_table_output << "\n"
|
||||
<< "\\docbook_mathml_prefix " << h_docbook_mathml_prefix << "\n"
|
||||
<< "\\docbook_mathml_version " << h_docbook_mathml_version << "\n"
|
||||
<< authors_
|
||||
<< "\\end_header\n\n"
|
||||
<< "\\begin_body\n";
|
||||
|
@ -199,6 +199,7 @@ private:
|
||||
std::string h_html_math_output;
|
||||
std::string h_docbook_table_output;
|
||||
std::string h_docbook_mathml_prefix;
|
||||
std::string h_docbook_mathml_version;
|
||||
std::string h_index[99];
|
||||
std::string h_index_command;
|
||||
std::string h_inputencoding;
|
||||
|
@ -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 630 // spitz: language updates
|
||||
#define LYX_FORMAT_TEX2LYX 630
|
||||
#define LYX_FORMAT_LYX 631 // tcuvelier: add MathML version
|
||||
#define LYX_FORMAT_TEX2LYX 631
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user