-----------------------
+2019-04-16 Günter Milde <milde@lyx.org>
+ * format incremented to 573: Rename legacy input encoding settings.
+
2019-04-07 Kornel Benko <kornel@lyx.org>
* format incremented to 572: Extended Noto fonts.
-#LyX 2.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 544
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 572
\begin_document
\begin_header
\save_transient_properties true
\language english
\language_package default
\inputencoding auto
-\fontencoding global
+\fontencoding auto
\font_roman "lmodern" "default"
\font_sans "lmss" "default"
\font_typewriter "lmtt" "default"
\papercolumns 1
\papersides 2
\paperpagestyle headings
+\tablestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
status collapsed
\begin_layout Plain Layout
-lib/lyx2lyx/lyx_2_3.py
+lib/lyx2lyx/lyx_2_4.py
\end_layout
\end_inset
It would be nice if you could create a .lyx test file which contains instances
of all changed or added features.
This could then be used to test lyx2lyx and tex2lyx.
- Unfortunately, it has not yet been decided how to collect such examples,
- so please ask on the development list if you want to create one.
+ Test samples are collected under the corresponding subdirectories of
+\family typewriter
+/autotests
+\family default
+.
\end_layout
\begin_layout Enumerate
###
###############################################################################
+def convert_inputencoding_namechange(document):
+ " Rename inputencoding settings. "
+ i = find_token(document.header, "\\inputencoding", 0)
+ if i == -1:
+ return
+ s = document.header[i].replace("auto", "auto-legacy")
+ document.header[i] = s.replace("default", "auto-legacy-plain")
+
+def revert_inputencoding_namechange(document):
+ " Rename inputencoding settings. "
+ i = find_token(document.header, "\\inputencoding", 0)
+ if i == -1:
+ return
+ s = document.header[i].replace("auto-legacy-plain", "default")
+ document.header[i] = s.replace("auto-legacy", "auto")
+
def convert_notoFonts(document):
" Handle Noto fonts definition to LaTeX "
[569, []],
[570, []],
[571, []],
- [572, [convert_notoFonts]] # Added options thin, light, extralight for Noto
+ [572, [convert_notoFonts]], # Added options thin, light, extralight for Noto
+ [573, [convert_inputencoding_namechange]],
]
-revert = [
+revert = [[572, [revert_inputencoding_namechange]],
[571, [revert_notoFonts]],
[570, [revert_cmidruletrimming]],
[569, [revert_bibfileencodings]],
OutputParams const &,
OutputWhat output = FullSource) const;
/** Export the buffer to LaTeX.
- If \p os is a file stream, and params().inputenc is "auto" or
- "default", and the buffer contains text in different languages
+ If \p os is a file stream, and params().inputenc is "auto-legacy" or
+ "auto-legacy-plain", and the buffer contains text in different languages
with more than one encoding, then this method will change the
encoding associated to \p os. Therefore you must not call this
method with a string stream if the output is supposed to go to a
fonts_sans_scale[1] = 100;
fonts_typewriter_scale[0] = 100;
fonts_typewriter_scale[1] = 100;
- inputenc = "auto";
+ inputenc = "auto-legacy";
lang_package = "default";
graphics_driver = "default";
default_output_format = "default";
// get main font encodings
vector<string> fontencs = font_encodings();
// get font encodings of secondary languages
+ // FIXME: some languages (hebrew, ...) assume a standard font encoding as last
+ // option (for text in other languages).
features.getFontEncodings(fontencs);
if (!fontencs.empty()) {
os << "\\usepackage["
os << "\\usepackage{textcomp}\n";
if (features.mustProvide("pmboxdraw"))
os << "\\usepackage{pmboxdraw}\n";
-
+
+ // FIXME: With Thai as document or secondary language, we must load babel
+ // before inputenc (see lib/languages).
// handle inputenc etc.
writeEncodingPreamble(os, features);
if (useNonTeXFonts)
return;
- if (inputenc == "auto") {
+ if (inputenc == "auto-legacy") {
string const doc_encoding =
language->encoding()->latexName();
Encoding::Package const package =
else
os << "]{inputenc}\n";
}
- } else if (inputenc != "default") {
+ } else if (inputenc != "auto-legacy-plain") {
switch (encoding().package()) {
case Encoding::none:
case Encoding::CJK:
break;
}
}
- if (inputenc == "default" || features.isRequired("japanese")) {
+ if (inputenc == "auto-legacy-plain" || features.isRequired("japanese")) {
// don't default to [utf8]{inputenc} with TeXLive >= 18
os << "\\ifdefined\\UseRawInputEncoding\n";
os << " \\UseRawInputEncoding\\fi\n";
// Main encoding for LaTeX output.
if (useNonTeXFonts)
return *(encodings.fromLyXName("utf8-plain"));
- if (inputenc == "auto" || inputenc == "default")
+ if (inputenc == "auto-legacy" || inputenc == "auto-legacy-plain")
return *language->encoding();
if (inputenc == "utf8" && language->lang() == "japanese")
return *(encodings.fromLyXName("utf8-platex"));
text.outerFont(sl.pit())).language();
// If we have a custom encoding for the buffer, we don't switch
// encodings (see output_latex::switchEncoding())
- bool const customenc = bp.inputenc != "auto" && bp.inputenc != "default";
+ bool const customenc = bp.inputenc != "auto-legacy" && bp.inputenc != "auto-legacy-plain";
Encoding const * enc = customenc ? &bp.encoding() : lang->encoding();
// Some insets force specific encodings sometimes (e.g., listings in
if (!runparams.hyperref_driver.empty())
opt += runparams.hyperref_driver + ",";
- // since LyX uses unicode, also set the PDF strings to unicode strings with the
- // hyperref option "unicode"
- opt += "unicode=true,";
+ // Since LyX uses unicode, also set the PDF strings to unicode strings
+ // with the hyperref option "unicode".
+ // (With Xe/LuaTeX and pTeX, unicode=true is the default
+ // and the option leads to errors with some Japanese document classes)
+ if (!runparams.isFullUnicode() && !runparams.use_japanese)
+ opt += "unicode=true,";
// only use the hyperref settings if hyperref is enabled by the user
// see bug #7052
// language & quotes
if (langModule->defaultencodingRB->isChecked()) {
- bp_.inputenc = "auto";
+ bp_.inputenc = "auto-legacy";
} else {
int i = langModule->encodingCO->currentIndex();
if (i == 0)
- bp_.inputenc = "default";
+ bp_.inputenc = "auto-legacy-plain";
else {
QString const enc_gui =
langModule->encodingCO->currentText();
}
if (!found) {
// should not happen
- lyxerr << "GuiDocument::apply: Unknown encoding! Resetting to default" << endl;
- bp_.inputenc = "default";
+ lyxerr << "GuiDocument::apply: Unknown encoding! Resetting to utf8" << endl;
+ bp_.inputenc = "utf8";
}
}
}
langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
bool default_enc = true;
- if (bp_.inputenc != "auto") {
+ if (bp_.inputenc != "auto-legacy") {
default_enc = false;
- if (bp_.inputenc == "default") {
+ if (bp_.inputenc == "auto-legacy-plain") {
langModule->encodingCO->setCurrentIndex(0);
} else {
string enc_gui;
if (nn >= 0)
fontModule->fontsDefaultCO->setCurrentIndex(nn);
- if (bp_.fontenc == "auto" || bp_.fontenc == "default") {
+ if (bp_.fontenc == "auto-legacy" || bp_.fontenc == "auto-legacy-plain") {
fontModule->fontencCO->setCurrentIndex(
fontModule->fontencCO->findData(toqstr(bp_.fontenc)));
fontModule->fontencLE->setEnabled(false);
chosenLE->clear();
string new_encoding = bufferview()->cursor().getEncoding()->name();
- if (buffer().params().inputenc != "auto" &&
- buffer().params().inputenc != "default")
+ if (buffer().params().inputenc != "auto-legacy" &&
+ buffer().params().inputenc != "auto-legacy-plain")
new_encoding = buffer().params().encoding().name();
if (new_encoding == encoding_)
// everything up to date
if (ienc.empty() || ienc == "general")
ienc = to_ascii(params()["encoding"]);
- if (!ienc.empty() && ienc != "default" && ienc != "auto" && encodings.fromLyXName(ienc))
+ if (!ienc.empty() && ienc != "auto-legacy-plain" && ienc != "auto-legacy" && encodings.fromLyXName(ienc))
encoding = encodings.fromLyXName(ienc)->iconvName();
ifdocstream ifs(bibfile.toFilesystemEncoding().c_str(),
ios_base::in, encoding);
}
}
- // Switch file encoding if necessary; no need to do this for "default"
+ // Switch file encoding if necessary; no need to do this for "auto-legacy-plain"
// encoding, since this only affects the position of the outputted
// \inputencoding command; the encoding switch will occur when necessary
- if (bparams.inputenc == "auto"
+ if (bparams.inputenc == "auto-legacy"
&& !runparams.isFullUnicode() // Xe/LuaTeX use one document-wide encoding (see also switchEncoding())
&& runparams.encoding->package() != Encoding::japanese
&& runparams.encoding->package() != Encoding::none) {
// Information about local language is stored as a font feature.
// If this is the last paragraph of the inset and a local_font was set upon entering
- // and we are mixing encodings ("auto" or "default" and no XeTeX or LuaTeX),
+ // and we are mixing encodings ("auto-legacy" or "auto-legacy-plain" and no XeTeX or LuaTeX),
// ensure the encoding is set back to the default encoding of the local language.
if (runparams.isLastPar && runparams_in.local_font != 0
&& runparams_in.encoding != runparams_in.local_font->language()->encoding()
- && (bparams.inputenc == "auto" || bparams.inputenc == "default")
+ && (bparams.inputenc == "auto-legacy" || bparams.inputenc == "auto-legacy-plain")
&& !runparams.isFullUnicode()
) {
runparams_in.encoding = runparams_in.local_font->language()->encoding();
return make_pair(false, 0);
// Only switch for auto-selected legacy encodings (inputenc setting
- // "auto" or "default").
+ // "auto-legacy" or "auto-legacy-plain").
// The "listings" environment can force a switch also with other
// encoding settings (it does not support variable width encodings
// (utf8, jis, ...) under 8-bit latex engines).
- if (!force && ((bparams.inputenc != "auto" && bparams.inputenc != "default")
+ if (!force && ((bparams.inputenc != "auto-legacy" && bparams.inputenc != "auto-legacy-plain")
|| runparams.moving_arg))
return make_pair(false, 0);
LYXERR(Debug::LATEX, "Changing LaTeX encoding from "
<< oldEnc.name() << " to " << newEnc.name());
os << setEncoding(newEnc.iconvName());
- if (bparams.inputenc == "default")
+ if (bparams.inputenc == "auto-legacy-plain")
return make_pair(true, 0);
docstring const inputenc_arg(from_ascii(newEnc.latexName()));
h_html_math_output = "0";
h_index[0] = "Index";
h_index_command = "default";
- h_inputencoding = "auto";
+ h_inputencoding = "auto-legacy";
h_justification = "true";
h_language = "english";
h_language_package = "none";
xetex = true;
h_use_non_tex_fonts = true;
registerAutomaticallyLoadedPackage("fontspec");
- if (h_inputencoding == "auto")
+ if (h_inputencoding == "auto-legacy")
p.setEncoding("UTF-8");
}
h_use_non_tex_fonts = true;
xetex = true;
registerAutomaticallyLoadedPackage("xunicode");
- if (h_inputencoding == "auto")
+ if (h_inputencoding == "auto-legacy")
p.setEncoding("UTF-8");
}
else if (name == "CJK") {
- // set the encoding to "auto" because it might be set to "default" by the babel handling
+ // set the encoding to "auto-legacy" because it might be set to "auto-legacy-plain" by the babel handling
// and this would not be correct for CJK
- if (h_inputencoding == "default")
- h_inputencoding = "auto";
+ if (h_inputencoding == "auto-legacy-plain")
+ h_inputencoding = "auto-legacy";
registerAutomaticallyLoadedPackage("CJK");
}
else if (name == "inputenc" || name == "luainputenc") {
// h_inputencoding is only set when there is not more than one
// inputenc option because otherwise h_inputencoding must be
- // set to "auto" (the default encoding of the document language)
+ // set to "auto-legacy" (the default encodings of the document's languages)
// Therefore check that exactly one option is passed to inputenc.
// It is also only set when there is not more than one babel
// language option.
return;
while (is_full_document && p.good()) {
- if (detectEncoding && h_inputencoding != "auto" &&
- h_inputencoding != "default")
+ if (detectEncoding && h_inputencoding != "auto-legacy" &&
+ h_inputencoding != "auto-legacy-plain")
return;
Token const & t = p.get_token();
"% This document must be compiled with XeLaTeX ";
if (comment.size() > magicXeLaTeX.size()
&& comment.substr(0, magicXeLaTeX.size()) == magicXeLaTeX
- && h_inputencoding == "auto") {
+ && h_inputencoding == "auto-legacy") {
if (!detectEncoding)
cerr << "XeLaTeX comment found, switching to UTF8\n";
h_inputencoding = "utf8";
{
TeX2LyXDocClass dummy;
parse(p, forceclass, true, dummy);
- if (h_inputencoding != "auto" && h_inputencoding != "default")
+ if (h_inputencoding != "auto-legacy" && h_inputencoding != "auto-legacy-plain")
return h_inputencoding;
return "";
}
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
\maintain_unincluded_children false
\language british
\language_package default
-\inputencoding auto
+\inputencoding auto-legacy
\fontencoding default
\font_roman "default" "Linux Libertine O"
\font_sans "default" "Linux Biolinum O"
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
\maintain_unincluded_children false
\language english
\language_package none
-\inputencoding auto
+\inputencoding auto-legacy
\fontencoding default
\font_roman "default" "default"
\font_sans "default" "default"
#LyX file created by tex2lyx 2.4
-\lyxformat 572
+\lyxformat 573
\begin_document
\begin_header
\save_transient_properties true
\maintain_unincluded_children false
\language english
\language_package none
-\inputencoding auto
+\inputencoding auto-legacy
\fontencoding default
\font_roman "default" "default"
\font_sans "default" "default"
// actual encoding is different (bug 7509).
if (encoding.empty()) {
Encoding const * enc = 0;
- if (preamble.inputencoding() == "auto") {
+ if (preamble.inputencoding() == "auto-legacy") {
ifdocstream is(setEncoding("ISO-8859-1"));
// forbid buffering on this stream
is.rdbuf()->pubsetbuf(0, 0);
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 572 // kornel: Noto fonts expanded to use more options
-#define LYX_FORMAT_TEX2LYX 572
+#define LYX_FORMAT_LYX 573 // gm: rename input encoding settings
+#define LYX_FORMAT_TEX2LYX 573
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER