[LyX/master] Re-fix #11146 with recent LaTeX

Juergen Spitzmueller spitz at lyx.org
Wed Nov 20 10:43:23 UTC 2019


commit e75fa6f3ac5735dfcd588acb5c187556bface16d
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Nov 20 11:48:18 2019 +0100

    Re-fix #11146 with recent LaTeX
---
 lib/chkconfig.ltx |   18 ++++++++++++++++++
 src/Buffer.cpp    |    9 +++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index 069d3a5..73b1daa 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -143,6 +143,20 @@
   \fi}
 
 
+% Test for the LaTeX version
+\newcommand{\TestLaTeXVersion}[1]{
+  \message{^^J\prefix checking for LaTeX version at least as of #1...}
+  \@ifl at t@r\fmtversion{#1}{\existstrue}{\existsfalse}
+  \ifexists
+    \message{yes^^J}
+    \AddVariable{#1}{yes}
+    \AddPackage{LaTeX-#1}
+  \else
+    \message{no^^J}
+    \AddVariable{#1}{no}
+  \fi}
+
+
 % Adapted from ltxcheck.tex
 \newcommand{\TestFont}[2][\default]{
   \def\default{#2}
@@ -227,6 +241,10 @@
 \message{^^J\prefix checking for LaTeX version... \fmtversion}
 \AddVariable{fmtversion}{\fmtversion}
 
+%%% Crucial versions
+% This one introduces path encoding changes
+\TestLaTeXVersion{2019/10/01}
+
 %%% And now, the list of available languages
 % The trick is to know that \the\everyjob contains something like
 %  \typeout{LaTeX2e <2001/06/01>}
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 46a9d96..784c46e 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1940,9 +1940,14 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
 					os << "\\catcode`\\%=11"
 					      "\\def\\%{%}\\catcode`\\%=14\n";
 				}
-				bool const detokenize = !isAscii(from_utf8(docdir))
-						|| contains(docdir, '~');
+				bool const nonascii = !isAscii(from_utf8(docdir));
+				// LaTeX 2019/10/01 handles non-ascii path without detokenize
+				bool const utfpathlatex = features.isAvailable("LaTeX-2019/10/01");
+				bool const detokenize = !utfpathlatex
+						&& (nonascii || contains(docdir, '~'));
 				bool const quote = contains(docdir, ' ');
+				if (utfpathlatex && nonascii)
+					os << "\\UseRawInputEncoding\n";
 				os << "\\makeatletter\n"
 				   << "\\def\\input at path{{";
 				if (detokenize)


More information about the lyx-cvs mailing list