On 2015-11-02, Scott Kostyshak wrote: > On Mon, Nov 02, 2015 at 10:40:27PM +0000, Guenter Milde wrote:
Dear Scott, >> > thanks for the patch. >> I modified it to use UTF8 with XeTeX without the >> \inputencoding commands. ... > I would say go ahead and commit if you are satisfied with it. From what I > understand, the patch is now a complete patch in the sense that it is a full > step forward. Actually, I am not satisfied, because the "normal" use case (exporting to a LaTeX file with inputencoding ASCII) is now worse than before. I this sense, it is a partial patch. For the use case "XeTeX with TeX fonts", it is overly complicated. So I split it in two: * to fix the regressions with "XeTeX + TeX fonts", a simple change in PDFOptions.cpp is sufficient. See below. The nice thing is, that this is simple, localized and only changes where change is required - actually a completion for the patch-set fixing #9740. >> A short test here showed that this >> helps with Umlauts or Cyrillic charactes in the PDF Info. * the updated "comprehensive but incomplete" patch based on your work is now at http://www.lyx.org/trac/ticket/9839, so the work is not lost. With the "show output anyway" option in 2.2, the status quo is actually tolerable. I'll try the patch for #9830, then there is also a workaound for ASCII export (i.e. the user can write G\"unter instead of Günter). > Let me know if you want me to run the export tests before/after. Please check, if this patch cures some regressions introduced by fixing #9740. Günter Exec: git 'diff' 'PDFOptions.cpp' 2>&1 Dir: /usr/local/src/lyx/src/ diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp index 6646888..143d715 100644 --- a/src/PDFOptions.cpp +++ b/src/PDFOptions.cpp @@ -174,21 +174,15 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, opt = "\\hypersetup{" + rtrim(opt + hyperset, ",") + "}\n"; } - // hyperref expects LICR macros for non-ASCII chars. With Xe/LuaTeX utf-8 works, too. - // Usually, "(lua)inputenc" converts the input to LICR. + // hyperref expects LICR macros for non-ASCII chars. + // Usually, "(lua)inputenc" converts the input to LICR, with XeTeX utf-8 works, too. // As hyperref provides good coverage for \inputencoding{utf8}, we can try // this if the current input encoding does not support a character. - // FIXME: inputenc (part 1 of 2) - // Replace the "FullUnicode" check with - // check for loading of inputenc or luainputenc package - // (see BufferParams::writeEncodingPreamble and runparams.encoding->package()). - // Otherwise \inputencoding is not defined - // (e.g. if "latex-encoding" is set to "ascii"). - // Dont forget to keep the check below (part 2) in sync! - if (need_unicode && enc && enc->iconvName() != "UTF-8" - &&!runparams.isFullUnicode()) { - os << "\\inputencoding{utf8}\n" - << setEncoding("UTF-8"); + // FIXME: don't use \inputencoding if "inputenc" is not loaded (#9839). + if (need_unicode && enc && enc->iconvName() != "UTF-8") { + if (runparams.flavor != OutputParams::XETEX) + os << "\\inputencoding{utf8}\n"; + os << setEncoding("UTF-8"); } // If hyperref is loaded by the document class, we output // \hypersetup \AtBeginDocument if hypersetup is not (yet) @@ -204,11 +198,10 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, << "\\fi\n"; } else os << from_utf8(opt); - // FIXME: inputenc (part 2 of 2) - if (need_unicode && enc && enc->iconvName() != "UTF-8" - &&!runparams.isFullUnicode()) { - os << setEncoding(enc->iconvName()) - << "\\inputencoding{" << from_ascii(enc->latexName()) << "}\n"; + if (need_unicode && enc && enc->iconvName() != "UTF-8") { + os << setEncoding(enc->iconvName()); + if (runparams.flavor != OutputParams::XETEX) + os << "\\inputencoding{" << from_ascii(enc->latexName()) << "}\n"; } }