On Sat, May 21, 2016 at 04:23:24PM +0000, Guenter Milde wrote:
> On 2016-05-20, Guillaume Munch wrote:
> > Le 20/05/2016 19:26, Scott Kostyshak a écrit :
> >> On Fri, May 20, 2016 at 04:06:22PM +0000, Guenter Milde wrote:
> >>> On 2016-05-20, Jean-Marc Lasgouttes wrote:
> >>>> Le 20/05/2016 à 13:17, Guenter Milde a écrit :
> >>>>> On 2016-05-20, Scott Kostyshak wrote:
> 
> >>>>>> There have been some changes in the luatex engine that will be
> >>>>>> shipped with TeX Live 2016 that cause many of our tests to fail
> >>>>>> (500 something instead of 100 something on TL 2015). The root
> >>>>>> issue is discussed on the LuaTeX mailing list at [1].
> 
> >>>>>> There is a transitional package available, luatex85, that should
> >>>>>> make our current LuaTeX code work. A reasonable approach for now
> >>>>>> would be to use the package if it is available and to not use it
> >>>>>> if not, keeping the rest of our LuaTeX export code the same.
> ...
> >>>>> We could just add
> ...
> >>>>     \IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
> ...
> 
> >> Should we do this only when we use code that we think needs it? Or
> >> should we just add it to all of our LuaTeX exports?
> 
> I propose to do this with every LuaTeX export
> 
> +3 simple (no LyX-logic required)
> +1 no risk of LyX getting it wrong
> -1 eventually spurious package loading

I agree.

> > For 2.2 this could be shipped as a module, to be deprecated and updated
> > into an empty module once LyX decides to adopt the new luatex syntax.
> 
> I'd rather keep this simple as well: insert
> 
>      \IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
> 
> with every LuaTeX export for the next years to come untill we can be safe
> every user has the new version and can start using the new syntax in our
> export.

Makes sense. And because LuaTeX is still beta, I don't think we should feel
too much pressure an old LuaTeX version for a long time.

What about the attached patch? The most controversial change is putting
something before \documentclass. In BufferParams::writeLaTeX() we have
the following warning:

// Do not try to load any other package before the document class, unless you
// have a thorough understanding of the LATEX internals and know exactly what 
you
// are doing!

I do not have a thorough understanding of the LATEX internals and I very
rarely know exactly what I'm doing. The package documentation of
luatex85 does suggest that it should be the first line of the document.

Any thoughts?

Jürgen, since you've done a lot of work on the LuaTeX code, do you have
an opinion?

Scott
From 7a94d6a64919c791e49f2c3e712770d611bc2b55 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sat, 21 May 2016 17:04:42 -0400
Subject: [PATCH] Fix LuaTeX export for TL >= 2016

If the transitional package luatex85 is available we use it.
Otherwise, we assume that an older luatex engine is being used. For
more information, see the following lyx-devel thread:
https://www.mail-archive.com/search?l=mid&q=20160520075810.yi3uspufehev5aln%40cotopaxi

The luatex85 manual suggests to users to load the package "as the
first line of their document".
---
 src/BufferParams.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 9d121cb..1689513 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1426,6 +1426,17 @@ bool BufferParams::writeLaTeX(otexstream & os, 
LaTeXFeatures & features,
        // Do not try to load any other package before the document class, 
unless you
        // have a thorough understanding of the LATEX internals and know 
exactly what you
        // are doing!
+
+       // our LuaTeX export is broken with TL >= 2016. If the transitional
+       // package luatex85 is available we use it. Otherwise, we assume that
+       // an older luatex engine is being used.
+       // 
https://www.mail-archive.com/search?l=mid&q=20160520075810.yi3uspufehev5aln%40cotopaxi
+       // The luatex85 manual suggests to users to load the package "as the
+       // first line of their document"
+       if (features.runparams().flavor == OutputParams::LUATEX ||
+                       features.runparams().flavor == OutputParams::DVILUATEX)
+               os << 
"\\IfFileExists{luatex85.sty}{\\usepackage{luatex85}}{}\n";
+
        if (features.mustProvide("fix-cm"))
                os << "\\RequirePackage{fix-cm}\n";
        // Likewise for fixltx2e. If other packages conflict with this policy,
-- 
2.1.4

Attachment: signature.asc
Description: PGP signature

Reply via email to