This is probably directed at the maintainers and the LaTeX3 project team.

I noticed a change in plots generated with gnuplot externalliy with the epslatex terminal. Documents compiled with pdfLaTeX or with LuaLaTeX 0.95 (from TeX Live 2016) are fine.

However, when the document is compiled with LuaLaTeX 1.0.4 (Tex Live 2017) The numbers on the axes, and in general, any text is shifted slightly to the left. I've included images here to illustrate the issue:

LuaLaTeX 0.95

LuaLaTeX 0.95 compiled image

LuaLaTeX 1.0.4

LuaLaTeX 1.0.4 compiled image

The difference is most noticeable if you look at the labels on the x-axis and how they line up with the tics.

After testing both versions from Tex Live 2016 and 2017, and all the packages loaded. I was able to narrow down the issue to luatex.def. If I substituted luatex.def v0.01h (replacing v1.0f) into my Tex Live directory it fixed the issue. That is compiling with LuaLaTeX 1.0.4 and all the associated package version listed from the log with it below.

I also though it might be something to do with the conversion of the eps to pdf which happend when the gnuplot graph is included in the main document.

If I change the inputted eps which is part of the plot to a png with imagemagick then the issue seems to disappear. So either it's occuing when the eps is converted to a pdf, or on the inclusion of the pdf. Either way it's occuring only when the latetest verion of luatex.def is loaded.

I looked at the two verisons of luatex.def but my tex-fu is not strong enough to suggest a fix. Having played with the source tex from gnuplot I could manually fix it too by playing with the \setlength{\unitlength} or with the coordinates. I could also move things around leaving the \unitlength and the coords in the \put commands as is, but modifying the coords in the \makebox commands. I'm not sure if that helps locate the issue.

I've included my minimal working example here, I use filecontents to output the gnuplot generated plot.tex in case anyone didn't have access to gnuplot. The gnuplot script to generated it follows the LaTeX MWE.


%!TEX TS-program = lualatex
%!TEX encoding = UTF-8 Unicode



  % GNUPLOT: LaTeX picture with Postscript
      \GenericError{(gnuplot) \space\space\space\@spaces}{%
        Package color not loaded in conjunction with
        terminal option `colourtext'%
      }{See the gnuplot documentation for explanation.%
      }{Either use 'blacktext' in gnuplot or load the package
        color.sty in LaTeX.}%
      \GenericError{(gnuplot) \space\space\space\@spaces}{%
        Package graphicx or graphics not loaded%
      }{See the gnuplot documentation for explanation.%
      }{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
    % define a \g@addto@macro without @ in the name:
    % define empty templates for all commands taking text:
      % no textcolor at all
      % gray or color?
        \expandafter\def\csname LTw\endcsname{\color{white}}%
        \expandafter\def\csname LTb\endcsname{\color{black}}%
        \expandafter\def\csname LTa\endcsname{\color{black}}%
        \expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
        \expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
        \expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
        \expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
        \expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
        \expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
        \expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
        \expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
        \expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
        % gray
        \expandafter\def\csname LTw\endcsname{\color{white}}%
        \expandafter\def\csname LTb\endcsname{\color{black}}%
        \expandafter\def\csname LTa\endcsname{\color{black}}%
        \expandafter\def\csname LT0\endcsname{\color{black}}%
        \expandafter\def\csname LT1\endcsname{\color{black}}%
        \expandafter\def\csname LT2\endcsname{\color{black}}%
        \expandafter\def\csname LT3\endcsname{\color{black}}%
        \expandafter\def\csname LT4\endcsname{\color{black}}%
        \expandafter\def\csname LT5\endcsname{\color{black}}%
        \expandafter\def\csname LT6\endcsname{\color{black}}%
        \expandafter\def\csname LT7\endcsname{\color{black}}%
        \expandafter\def\csname LT8\endcsname{\color{black}}%
        \csname LTb\endcsname%%




Gnuplot input

set terminal epslatex size 6cm,5.6cm
set output "test-plot.tex"
set tics out
unset key
set size square
set format x '%g'
set format y '%g'
f(x) = x
plot f(x) with lines

You can find the eps for inclusion here: https://www.dropbox.com/s/0thsdguhje266rr/test-plot.eps?dl=0

These are the key packages loaded, according to the log file, by each compilation method:

LuaTeX, Version 0.95.0 (TeX Live 2016)

  • luatex85 2016/06/15 v1.4
  • shellesc 2016/06/07 v0.02a
  • graphicx 2014/10/28 v1.0g
  • graphics 2016/10/09 v1.0u
  • luatex.def 2017/01/12 v0.01h

LuaTeX, Version 1.0.4 (TeX Live 2017)

  • luatex85 2016/06/15 v1.4
  • shellesc 2016/06/07 v0.02a
  • graphicx 2017/06/01 v1.1a
  • graphics 2017/06/25 v1.2c
  • luatex.def 2017/06/24 v1.0f

Incidentally pdfLaTeX compiles fine for both 2017 and 106 TeX Live versions:

pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017)

  • luatex85 2016/06/15 v1.4
  • shellesc 2016/06/07 v0.02a
  • graphicx 2017/06/01 v1.1a
  • graphics 2016/10/09 v1.0u
  • pdftex.def 2017/06/24 v1.0g

1 Answer 1


Sorry about, that it looks like a fix applied to pdftex.def wasn't copied over to luatex.def


in the document should fix it, or

just add a % after JB2 on line 485 of luatex.def I have updated the file at github will make a ctan update pending further tests.

  • No problems, happy to help bug squash. Both fixes work. Awesome stuff. And what a response time! Nov 22, 2017 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .