Re: lualatex with TL2016

2016-07-09 Thread Scott Kostyshak
On Sat, Jul 09, 2016 at 05:26:06PM +0200, Kornel Benko wrote:
> Am Samstag, 9. Juli 2016 um 16:46:01, schrieb Jürgen Spitzmüller 
> 
> > Am Samstag, den 09.07.2016, 15:18 +0200 schrieb Kornel Benko:
> > > It meant that they compile without errors. Tested with A4 setting and
> > > portrait.
> > > 
> > > Now retesting with landscape: Works too. Pdf output on screen fits.
> > 
> > OK, thanks again. I committed a slightly modified version.
> > 
> > Should also go to stable I suppose.
> 
> +1

I agree this would be nice for stable. To summarize the situation for
Richard, the following are the pre-requisites for this problem to be
triggered:

1. TeX Live 2016
2. Using an option in Document Settings > Page Layout
3. LuaTeX

If those three are satisfied, then an error will be given. On the one
hand, I don't think we've received any reports about this issue from
users since TeX Live 2016 has been out, so I don't think the above three
pre-requisites are common. On the other hand, the patch is simple and
Kornel and Jürgen have tested it.

Scott


signature.asc
Description: PGP signature


Re: lualatex with TL2016

2016-07-09 Thread Kornel Benko
Am Samstag, 9. Juli 2016 um 16:46:01, schrieb Jürgen Spitzmüller 
> Am Samstag, den 09.07.2016, 15:18 +0200 schrieb Kornel Benko:
> > It meant that they compile without errors. Tested with A4 setting and
> > portrait.
> > 
> > Now retesting with landscape: Works too. Pdf output on screen fits.
> 
> OK, thanks again. I committed a slightly modified version.
> 
> Should also go to stable I suppose.

+1

> Jürgen
> 

Thanks for looking into this.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: lualatex with TL2016

2016-07-09 Thread Jürgen Spitzmüller
Am Samstag, den 09.07.2016, 15:18 +0200 schrieb Kornel Benko:
> It meant that they compile without errors. Tested with A4 setting and
> portrait.
> 
> Now retesting with landscape: Works too. Pdf output on screen fits.

OK, thanks again. I committed a slightly modified version.

Should also go to stable I suppose.

Jürgen

> 
>   Kornel
> 


Re: lualatex with TL2016

2016-07-09 Thread Kornel Benko
Am Samstag, 9. Juli 2016 um 14:47:59, schrieb Jürgen Spitzmüller 
> Am Samstag, den 09.07.2016, 14:40 +0200 schrieb Kornel Benko:
> > Works here with luatex 0.76, 0.80 and also with 0.95.
> 
> Thanks. "Works" means that the paper orientation in the pdf is correct
> in older luatex versions?
> 
> Jürgen

It meant that they compile without errors. Tested with A4 setting and portrait.

Now retesting with landscape: Works too. Pdf output on screen fits.

Kornel



signature.asc
Description: This is a digitally signed message part.


Re: lualatex with TL2016

2016-07-09 Thread Jürgen Spitzmüller
Am Samstag, den 09.07.2016, 14:40 +0200 schrieb Kornel Benko:
> Works here with luatex 0.76, 0.80 and also with 0.95.

Thanks. "Works" means that the paper orientation in the pdf is correct
in older luatex versions?

Jürgen


Re: lualatex with TL2016

2016-07-09 Thread Kornel Benko
Am Samstag, 9. Juli 2016 um 13:52:16, schrieb Jürgen Spitzmüller 
> Am Samstag, den 09.07.2016, 12:13 +0200 schrieb Kornel Benko:
> > > \\pageheight\\paperheight
> > > \\pagewidth\\paperwidth
> > 
> > Looks good, but I am no expert. Maybe Günter or Jürgen could comment.
> > What about code in ERT or preamble with '\pdfsometing'?
> 
> I would prefer something like the attached (output code only for
> relevant backends). This uses the new luatex commands, but provides
> aliases for older versions.
> 
> Jürgen

Works here with luatex 0.76, 0.80 and also with 0.95.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: lualatex with TL2016

2016-07-09 Thread Jürgen Spitzmüller
Am Samstag, den 09.07.2016, 12:13 +0200 schrieb Kornel Benko:
> > \\pageheight\\paperheight
> > \\pagewidth\\paperwidth
> 
> Looks good, but I am no expert. Maybe Günter or Jürgen could comment.
> What about code in ERT or preamble with '\pdfsometing'?

I would prefer something like the attached (output code only for
relevant backends). This uses the new luatex commands, but provides
aliases for older versions.

Jürgendiff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 16ec4c1..7a5a8fd 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -229,6 +229,13 @@ static docstring const papersizepdf_def = from_ascii(
 	"\\pdfpageheight\\paperheight\n"
 	"\\pdfpagewidth\\paperwidth\n");
 
+static docstring const papersizepdflua_def = from_ascii(
+	"% Backwards compatibility for LuaTeX < 0.90\n"
+	"\\providecommand\\pageheight{\\pdfpageheight}\n"
+	"\\providecommand\\pagewidth{\\pdfpagewidth}\n"
+	"\\pageheight\\paperheight\n"
+	"\\pagewidth\\paperwidth\n");
+
 static docstring const cedilla_def = from_ascii(
 	"\\newcommand{\\docedilla}[2]{\\underaccent{#1\\mathchar'30}{#2}}\n"
 	"\\newcommand{\\cedilla}[1]{\\mathpalette\\docedilla{#1}}\n");
@@ -1173,8 +1180,11 @@ docstring const LaTeXFeatures::getMacros() const
 	}
 
 	if (mustProvide("papersize")) {
-		if (runparams_.flavor == OutputParams::LATEX)
+		if (runparams_.flavor == OutputParams::LATEX
+		|| runparams_.flavor == OutputParams::DVILUATEX)
 			macros << papersizedvi_def << '\n';
+		else if  (runparams_.flavor == OutputParams::LUATEX)
+			macros << papersizepdflua_def << '\n';
 		else
 			macros << papersizepdf_def << '\n';
 	}


Re: lualatex with TL2016

2016-07-09 Thread Kornel Benko
Am Freitag, 8. Juli 2016 um 22:05:57, schrieb Scott Kostyshak 
> On Sat, Jul 09, 2016 at 12:38:53AM +0200, Kornel Benko wrote:
> > Am Freitag, 8. Juli 2016 um 18:14:29, schrieb Scott Kostyshak 
> > 
>
> > ATM, the patch I have works for me.
>
> It is better than the patch I originally proposed. It is unfortunate to
> add a sizeable chunk of LaTeX, but I don't see see an alternative (from
> what I understand, in LyX we don't even track the LuaTeX version so we
> cannot do the contionals with C++ code. Further, even if we did have
> that information I wonder if we would still choose the LaTeX
> conditionals as you propose because this way exported LaTeX code will be
> valid if compiled on older LuaTeX engines).
>
> I have two comments below.
>
> > diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
> > index 16ec4c1..602dd5f 100644
> > --- a/src/LaTeXFeatures.cpp
> > +++ b/src/LaTeXFeatures.cpp
> > @@ -226,8 +226,18 @@ static docstring const papersizedvi_def = from_ascii(
> > "\\special{papersize=\\the\\paperwidth,\\the\\paperheight}\n");
> >
>
> Should we put a comment here, perhaps to this email thread?
> // https://www.mail-archive.com/search?l=mid75450.Hf17PhF3sW%40amd64

OK, done.

> >  static docstring const papersizepdf_def = from_ascii(
> > -   "\\pdfpageheight\\paperheight\n"
> > -   "\\pdfpagewidth\\paperwidth\n");
> > +   "\\RequirePackage{ifluatex}\n"
> > +   "\\ifluatex\n"
> > +   "  \\ifdim\\luatexversion pt> 94 pt\n"
> > +   "\\usepackage{luatex85}\n"
>
> Instead of relying on the luatex85 package, which is meant to only be a
> temporary fix, I wonder if we can already implement something more
> permanent. So instead of the above line, can we just put the following?
>
> \\pageheight\\paperheight
> \\pagewidth\\paperwidth

Looks good, but I am no expert. Maybe Günter or Jürgen could comment.
What about code in ERT or preamble with '\pdfsometing'?

> as described as the "pure luatex syntax (from 0.85 on is)" [1]. Further,
> I imagine it is more efficient to execute those commands than to load
> another package.
>
> Scott
>
> [1] https://www.mail-archive.com/luatex@tug.org/msg05793.html

Korneldiff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 16ec4c1..dc1fc00 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -225,7 +225,15 @@ static docstring const lyxmathsym_def = from_ascii(
 static docstring const papersizedvi_def = from_ascii(
 	"\\special{papersize=\\the\\paperwidth,\\the\\paperheight}\n");

+// See also this email thread
+// https://www.mail-archive.com/search?l=mid75450.Hf17PhF3sW%40amd64
 static docstring const papersizepdf_def = from_ascii(
+	"\\RequirePackage{ifluatex}\n"
+	"\\ifluatex\n"
+	"  \\ifdim\\luatexversion pt> 94 pt\n"
+	"\\usepackage{luatex85}\n"
+	"  \\fi\n"
+	"\\fi\n"
 	"\\pdfpageheight\\paperheight\n"
 	"\\pdfpagewidth\\paperwidth\n");



signature.asc
Description: This is a digitally signed message part.


Re: lualatex with TL2016

2016-07-08 Thread Scott Kostyshak
On Sat, Jul 09, 2016 at 12:38:53AM +0200, Kornel Benko wrote:
> Am Freitag, 8. Juli 2016 um 18:14:29, schrieb Scott Kostyshak 
> 

> ATM, the patch I have works for me.

It is better than the patch I originally proposed. It is unfortunate to
add a sizeable chunk of LaTeX, but I don't see see an alternative (from
what I understand, in LyX we don't even track the LuaTeX version so we
cannot do the contionals with C++ code. Further, even if we did have
that information I wonder if we would still choose the LaTeX
conditionals as you propose because this way exported LaTeX code will be
valid if compiled on older LuaTeX engines).

I have two comments below.

> diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
> index 16ec4c1..602dd5f 100644
> --- a/src/LaTeXFeatures.cpp
> +++ b/src/LaTeXFeatures.cpp
> @@ -226,8 +226,18 @@ static docstring const papersizedvi_def = from_ascii(
>   "\\special{papersize=\\the\\paperwidth,\\the\\paperheight}\n");
>  

Should we put a comment here, perhaps to this email thread?
// https://www.mail-archive.com/search?l=mid=1675450.Hf17PhF3sW%40amd64

>  static docstring const papersizepdf_def = from_ascii(
> - "\\pdfpageheight\\paperheight\n"
> - "\\pdfpagewidth\\paperwidth\n");
> + "\\RequirePackage{ifluatex}\n"
> + "\\ifluatex\n"
> + "  \\ifdim\\luatexversion pt> 94 pt\n"
> + "\\usepackage{luatex85}\n"

Instead of relying on the luatex85 package, which is meant to only be a
temporary fix, I wonder if we can already implement something more
permanent. So instead of the above line, can we just put the following?

\\pageheight\\paperheight
\\pagewidth\\paperwidth

as described as the "pure luatex syntax (from 0.85 on is)" [1]. Further,
I imagine it is more efficient to execute those commands than to load
another package.

Scott

[1] https://www.mail-archive.com/luatex@tug.org/msg05793.html


signature.asc
Description: PGP signature


Re: lualatex with TL2016

2016-07-08 Thread Kornel Benko
Am Freitag, 8. Juli 2016 um 18:14:29, schrieb Scott Kostyshak 
> On Fri, Jul 08, 2016 at 03:37:37PM +0200, Kornel Benko wrote:
> > Exporting to pdf(luatex) I get errors.
> >
> >  \pdfpageheight
> >  \paperheight
> > The control sequence at the end of the top line
> > of your error message was never \def'ed. If you have
> > misspelled it (e.g., `\hobx'), type `I' and the correct
> > spelling (e.g., `I\hbox'). Otherwise just continue,
> > and I'll forget about whatever was undefined.
> >
> > This is due to our preamble containing now
> > \pdfpageheight\paperheight
> > \pdfpagewidth\paperwidth
>
> I confirm. I brought this up on the LuaTeX list here:
> https://www.mail-archive.com/search?l=mid 
> 160516222738.agr4izmnpt2p3xzp%40cotopaxi
>
> and we've been discussing how to adapt LyX here:
> https://www.mail-archive.com/search?l=mid 
> 160520075810.yi3uspufehev5aln%40cotopaxi
>
> Scott

Ah, yes. Fading memory. I remembered after rereading. At that time I didn't 
have TL2016 installed,
so I forgot about the issue.

ATM, the patch I have works for me.

Korneldiff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 16ec4c1..602dd5f 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -226,8 +226,18 @@ static docstring const papersizedvi_def = from_ascii(
 	"\\special{papersize=\\the\\paperwidth,\\the\\paperheight}\n");

 static docstring const papersizepdf_def = from_ascii(
-	"\\pdfpageheight\\paperheight\n"
-	"\\pdfpagewidth\\paperwidth\n");
+	"\\RequirePackage{ifluatex}\n"
+	"\\ifluatex\n"
+	"  \\ifdim\\luatexversion pt> 94 pt\n"
+	"\\usepackage{luatex85}\n"
+	"  \\else\n"
+	"\\pdfpageheight\\paperheight\n"
+	"\\pdfpagewidth\\paperwidth\n"
+	"  \\fi\n"
+	"\\else\n"
+	"  \\pdfpageheight\\paperheight\n"
+	"  \\pdfpagewidth\\paperwidth\n"
+	"\\fi\n");

 static docstring const cedilla_def = from_ascii(
 	"\\newcommand{\\docedilla}[2]{\\underaccent{#1\\mathchar'30}{#2}}\n"


signature.asc
Description: This is a digitally signed message part.


Re: lualatex with TL2016

2016-07-08 Thread Scott Kostyshak
On Fri, Jul 08, 2016 at 03:37:37PM +0200, Kornel Benko wrote:
> Exporting to pdf(luatex) I get errors.
> 
>\pdfpageheight
>  \paperheight
>   The control sequence at the end of the top line
>   of your error message was never \def'ed. If you have
>   misspelled it (e.g., `\hobx'), type `I' and the correct
>   spelling (e.g., `I\hbox'). Otherwise just continue,
>   and I'll forget about whatever was undefined.
> 
> This is due to our preamble containing now
>   \pdfpageheight\paperheight
>   \pdfpagewidth\paperwidth

I confirm. I brought this up on the LuaTeX list here:
https://www.mail-archive.com/search?l=mid=20160516222738.agr4izmnpt2p3xzp%40cotopaxi

and we've been discussing how to adapt LyX here:
https://www.mail-archive.com/search?l=mid=20160520075810.yi3uspufehev5aln%40cotopaxi

Scott


signature.asc
Description: PGP signature


lualatex with TL2016

2016-07-08 Thread Kornel Benko
Exporting to pdf(luatex) I get errors.

 \pdfpageheight
 \paperheight
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

This is due to our preamble containing now
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

While this is OK for other engines (and also for lualatex in TL2015), it is not 
needed for lualatex in TL2016.

I know, I can disable the lines if using document-local-layout with
Provides papersize 1
but this would be valid for all engines.

Lualatex woking: Version beta-0.80.0 (TeX Live 2015) (rev 5238)
Lualtex not needing \pdfpageheight: Version 0.95.0 (TeX Live 2016)
(But would probably need  "\usepackage{luatex85}"?)

How to change of papersizepdf_def in src/LaTeXFeatures.cpp:228 ?
Maybe to (unsure about tex syntax)
%%###
RequirePackage{ifluatex} %% or \usepackage?
\ifluatex
\ifdim\luatexversion pt> 94 pt
\usepackage{luatex85}
\else
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
\fi
\else
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
\fi
%%###

Kornel

signature.asc
Description: This is a digitally signed message part.