shiblon / latex-makefile

A Makefile for LaTeX - drop it in, type make, and magic happens.
Other
185 stars 30 forks source link

Compilation of a beamer document fails. #141

Closed shiblon closed 8 years ago

shiblon commented 8 years ago

Originally reported on Google Code with ID 128

Hi,

The Makefile fails to compile a beamer document including a graphic image in eps.gz
or in eps formats.

Compilation is successful if the same image is in pdf format.

The same document is compiled successfully if the style used is "report", even if the
image included is in eps.gz format.

The source files along with all log-files are attached.

Thanks,
Slavik

Reported by viatcheslav.bugayov on 2011-05-09 22:14:52


shiblon commented 8 years ago
So, this is interesting.  I can't reproduce this issue on my computer.  Downloading
and unzipping these files, then running

make clean
make foo

Everything just works.  The pdf looks good, too.  I'm even using the older version
of the makefile that you included in the tarball.

Shall we start doing the binary-version dance to see what might be different?

Reported by shiblon on 2011-05-10 17:53:14

shiblon commented 8 years ago
> I can't reproduce this issue on my computer.
Hmm... That is strange.

> Shall we start doing the binary-version dance to see what might be different?
Tell me what I should do.

Reported by viatcheslav.bugayov on 2011-05-10 19:53:36

shiblon commented 8 years ago
Well, I'm not totally sure where to take it from here.  Perhaps latex versions, beamer
version, etc. would be a good start.

Here's the output of latex -version on my system:

pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009)
kpathsea version 5.0.0
Copyright 2009 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.2.39; using libpng 1.2.39
Compiled with zlib 1.2.3; using zlib 1.2.3
Compiled with xpdf version 3.02pl3

Here's the beamer version info in my foo.log file:

(/usr/local/texlive/2009/texmf-dist/tex/latex/beamer/beamer.cls (/usr/local/tex
live/2009/texmf-dist/tex/latex/beamer/beamerbasercs.sty                           

Package: beamerbasercs 2007/01/28 (rcs-revision 1.4)
)
Document Class: beamer 2007/03/11 cvs version 3.07 A class for typesetting pres
entations (rcs-revision 1.70)
(/usr/local/texlive/2009/texmf-dist/tex/latex/beamer/beamerbasemodes.sty
Package: beamerbasemodes 2007/01/28 (rcs-revision 1.22)
\beamer@tempbox=\box26
\beamer@tempcount=\count79
\c@beamerpauses=\count80
(/usr/local/texlive/2009/texmf-dist/tex/latex/beamer/beamerbasedecode.sty
Package: beamerbasedecode 2007/01/28 (rcs-revision 1.20)
\beamer@slideinframe=\count81
\beamer@minimum=\count82
)
\beamer@commentbox=\box27
\beamer@modecount=\count83
)
\headheight=\dimen102
\headdp=\dimen103
\footheight=\dimen104
\sidebarheight=\dimen105
\beamer@tempdim=\dimen106
\beamer@finalheight=\dimen107
\beamer@animht=\dimen108
\beamer@animdp=\dimen109
\beamer@animwd=\dimen110
\beamer@leftmargin=\dimen111
\beamer@rightmargin=\dimen112
\beamer@leftsidebar=\dimen113
\beamer@rightsidebar=\dimen114
\beamer@boxsize=\dimen115
\beamer@vboxoffset=\dimen116
\beamer@descdefault=\dimen117
\beamer@descriptionwidth=\dimen118
\beamer@lastskip=\skip41
\beamer@areabox=\box28
\beamer@animcurrent=\box29
\beamer@animshowbox=\box30
\beamer@sectionbox=\box31
\beamer@logobox=\box32
\beamer@linebox=\box33
\beamer@sectioncount=\count84
\beamer@subsubsectionmax=\count85
\beamer@subsectionmax=\count86
\beamer@sectionmax=\count87
\beamer@totalheads=\count88
\beamer@headcounter=\count89
\beamer@partstartpage=\count90
\beamer@sectionstartpage=\count91
\beamer@subsectionstartpage=\count92
\beamer@animationtempa=\count93
\beamer@animationtempb=\count94
\beamer@xpos=\count95
\beamer@ypos=\count96
\beamer@showpartnumber=\count97
\beamer@currentsubsection=\count98
\beamer@coveringdepth=\count99
\beamer@sectionadjust=\count100
\beamer@tocsectionnumber=\count101
(/usr/local/texlive/2009/texmf-dist/tex/latex/beamer/beamerbaseoptions.sty
Package: beamerbaseoptions 2007/01/28 (rcs-revision 1.8)

Reported by shiblon on 2011-05-10 20:10:56

shiblon commented 8 years ago
I see that our LaTeX packages are different - I have Web2C, your LaTeX is TeX Live.
The beamer versions are same:

bash-3.2$ latex -version
pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4)
kpathsea version 3.5.4
Copyright (C) 1997-2004 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea is copyright (C) 1997-2004 Free Software Foundation, Inc.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfeTeX copyright and
the GNU General Public License.
For more information about these matters, see the files
named COPYING and the pdfeTeX source.
Primary author of pdfeTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea written by Karl Berry and others.

My foo.log:

(/Network/Servers/jelley.lexas/Volumes/Home/bugaev/texmf/tex/latex/latex-beamer
-3.07/base/beamer.cls
(/Network/Servers/jelley.lexas/Volumes/Home/bugaev/texmf/tex/latex/latex-beamer
-3.07/base/beamerbasercs.sty
Package: beamerbasercs 2007/01/28 (rcs-revision 1.4)
)
Document Class: beamer 2007/03/11 cvs version 3.07 A class for typesetting pres
entations (rcs-revision 1.70)

(/Network/Servers/jelley.lexas/Volumes/Home/bugaev/texmf/tex/latex/latex-beamer
-3.07/base/beamerbasemodes.sty
Package: beamerbasemodes 2007/01/28 (rcs-revision 1.22)
\beamer@tempbox=\box26
\beamer@tempcount=\count79
\c@beamerpauses=\count80

(/Network/Servers/jelley.lexas/Volumes/Home/bugaev/texmf/tex/latex/latex-beamer
-3.07/base/beamerbasedecode.sty
Package: beamerbasedecode 2007/01/28 (rcs-revision 1.20)
\beamer@slideinframe=\count81
\beamer@minimum=\count82
)
\beamer@commentbox=\box27
\beamer@modecount=\count83
)
\headheight=\dimen102
\headdp=\dimen103
\footheight=\dimen104
\sidebarheight=\dimen105
\beamer@tempdim=\dimen106
\beamer@finalheight=\dimen107
\beamer@animht=\dimen108
\beamer@animdp=\dimen109
\beamer@animwd=\dimen110
\beamer@leftmargin=\dimen111
\beamer@rightmargin=\dimen112
\beamer@leftsidebar=\dimen113
\beamer@rightsidebar=\dimen114
\beamer@boxsize=\dimen115
\beamer@vboxoffset=\dimen116
\beamer@descdefault=\dimen117
\beamer@descriptionwidth=\dimen118
\beamer@lastskip=\skip41
\beamer@areabox=\box28
\beamer@animcurrent=\box29
\beamer@animshowbox=\box30
\beamer@sectionbox=\box31
\beamer@logobox=\box32
\beamer@linebox=\box33
\beamer@sectioncount=\count84
\beamer@subsubsectionmax=\count85
\beamer@subsectionmax=\count86
\beamer@sectionmax=\count87
\beamer@totalheads=\count88
\beamer@headcounter=\count89
\beamer@partstartpage=\count90
\beamer@sectionstartpage=\count91
\beamer@subsectionstartpage=\count92
\beamer@animationtempa=\count93
\beamer@animationtempb=\count94
\beamer@xpos=\count95
\beamer@ypos=\count96
\beamer@showpartnumber=\count97
\beamer@currentsubsection=\count98
\beamer@coveringdepth=\count99
\beamer@sectionadjust=\count100
\beamer@tocsectionnumber=\count101

(/Network/Servers/jelley.lexas/Volumes/Home/bugaev/texmf/tex/latex/latex-beamer
-3.07/base/beamerbaseoptions.sty
Package: beamerbaseoptions 2007/01/28 (rcs-revision 1.8)

But again, if Makefile doesn't have to convert my graphic file to pdf format (it was
previously converted), then compilation is successful. So, it makes me think that my
LaTeX is not corrupted in some way, it is something related to differences in LaTeX
packages.

Reported by viatcheslav.bugayov on 2011-05-10 20:40:16

shiblon commented 8 years ago
Hmmm.  Actually, I wonder if this is because you are on a networked file system and
flushing data is slow?  I see these kinds of race conditions occasionally where a file
is generated, but a subsequent step of the build process can't find it, even though
make has built it and knows that it is done.

If that's really what's going on, it's super hard to fix.  I haven't had consistent
success with it pretty much ever.

If inserting a sleep call in the eps -> pdf generation rule helps, that will tell us
a lot (look for /^%.pdf:\s+%.eps/ and add "$(SLEEP) 5" as the last line).

Reported by shiblon on 2011-05-11 16:26:31

shiblon commented 8 years ago
I inserted "$(SLEEP) 5" in the Makefile. You can see it in the output of make. The problem
is still there:

bash-3.2$ make
NOTE: You may ignore warnings about the following files:

     foo.d

Makefile:2597: foo.d: No such file or directory
= foo.tex --> foo.d foo.pdf.1st.make (0-1) =
= foo.tex --> foo.d foo.pdf.1st.make (1-1) =
= bar.eps.gz --> bar.eps =
= bar.eps --> bar.pdf =
sleep 5
./foo.tex:29: You can't use `\\prevdepth' in horizontal mode.\\nointerlineskip ->\\prevdepth

                              -\\@m \\p@ 
l.29 \\end{frame}

Sorry, but I'm not programmed to handle this case;
I'll just pretend that you didn't ask for it.
If you're in the wrong mode, you might be able to
return to the right one by typing `I}' or `I$' or `I\\par'.
./foo.tex:29: Missing $ inserted.<inserted text> 
                $
l.29 \\end{frame}

I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
./foo.tex:29: Missing number, treated as zero.<to be read again> 
                   \\let 
l.29 \\end{frame}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
./foo.tex:29: Illegal unit of measure (pt inserted).<to be read again> 
                   \\let 
l.29 \\end{frame}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
./foo.tex:29: LaTeX Error: Command \\bfseries invalid in math mode.
./foo.tex:29: Missing $ inserted.<inserted text> 
                $
l.29 \\end{frame}

I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
make: *** [foo.pdf] Error 1
rm bar.eps

Reported by viatcheslav.bugayov on 2011-05-11 21:18:22

shiblon commented 8 years ago
The compilation also fails if the source files are located on a local disk. Latex and
other utilities are still on a networked file system, though.

Reported by viatcheslav.bugayov on 2011-05-11 21:32:06

shiblon commented 8 years ago
OK, disappointing though it may be to not have narrowed the problem down, yet, I'm *very*
glad that the sleep idea didn't work.  Those kinds of problems are nearly impossible
to work around in a principled way.

So, that leaves us with other stuff.  Looking over your log file, I am beginning to
wonder if your version of latex doesn't handle the \center{\includegraphics{bar}} case
very well.

Have you tried the following instead?

{\centering \includegraphics{bar}}\par

Or, barring that,

\begin{center}
\includegraphics{bar}
\end{center}

Also, beamer often likes to see an ending paragraph before the end of its frame.  This
can be accomplished by using either of the above examples (the first manually inserts
\par, the second uses the center environment, which does that for you).

I'm fervently hoping (and believing, actually), that this is the core of the problem.
 I don't see anything amiss with the graphics inclusion, really.

That it works after the graphics have been built separately is really a mystery, though,
so I'm continuing to dig into this in case I'm completely out of my mind with the above.
 :-)

Reported by shiblon on 2011-05-12 14:17:30

shiblon commented 8 years ago
Oh, come to think of it, I don't think that there is any such thing as \center.

I mean, yes it exists, but it is part of the center environment.  Using 

\begin{center}
stuff here
\end{center}

is equivalent to

\center
stuff here
\endcenter

(the environment creates those commands, and they are meant to be a pair).  So, I think
that, even if this doesn't solve the make problem, it is incorrect as written.

Reported by shiblon on 2011-05-12 14:19:12

shiblon commented 8 years ago
Hurray! I am totally impressed by your observations which lead to a successful compilation
of my beamer document on a network disk without any sleep commands added to the Makefile.

You were right about \center{}. There is no such a thing. Effectively, it means that
I opened an environment with \center and didn't close it with \endcenter before the
end of the frame. And I was not aware that I had this error since using latex alone
without the Makefile would compile the document. At the same time, make would notice
the problem somehow (by the exit status of a latex command or by parsing the log output?).

What I don't understand is why make is less strict in case of inclusion of a ready-to-use
pdf graphic compared to the case when it has to convert eps.gz to pdf first.

Thank you for a great tool and for a continuous support!

Reported by viatcheslav.bugayov on 2011-05-12 16:05:51

shiblon commented 8 years ago
No problem.

I am also confused about why the make file is less strict when the graphic already
exists.  If you want me to continue pursuing that, the following would be helpful:

Leave the \center bug in the file.
Run "make bar.pdf"
Run make foo
Attach all of the foo*.log files to this bug.

I should be able to glean something from the logs.

And yes, what's happening is the makefile is parsing the log output and looking for
errors.  I'm willing to bet that you *do* see the error when you run latex, but latex's
output is so incredibly spammy that it gets lost in the noise.  Latex still successfully
builds the document in this case, but that's always a gamble, so the makefile alerts
you to it and refuses to build it.  It's a fine line to walk.

Reported by shiblon on 2011-05-12 18:31:56

shiblon commented 8 years ago
> Leave the \center bug in the file.
> Run "make bar.pdf"
> Run make foo
> Attach all of the foo*.log files to this bug.

The log files are attached.

Reported by viatcheslav.bugayov on 2011-05-12 19:44:18


shiblon commented 8 years ago
Aha!  I think I get it.  This is somewhat subtle, unfortunately, so you might want to
get comfortable (and note that this is still conjecture - it's just what I think is
the most likely problem).

First, this is definitely not a makefile problem, but *it is made manifest by typical
makefile usage*.

Here's what happens.

If the file bar.pdf exists, it is included *directly* by latex in the pdf output. 
It would appear that doing so closes some environments automatically for you.  I don't
know why that is the case, but if you look at foo.0-1.log, you'll notice that the error
is simply not there - beamer doesn't complain.

But, when bar.pdf does not exist, the initial run of pdflatex produces errors that
tell the makefile how to create bar.pdf.  Unfortunately, that also means that it produces
other errors that are masked when bar.pdf is already present.

So, this is a latex issue that just shows up more often for typical makefile use (when
not using the makefile, people just make sure that their graphics are all there, and
then they wouldn't see this error - the makefile just encourages folks to not pre-build
their graphics, which is sort of the point :-).

Anyway, if it's okay with you, I'm going to leave this issue closed and chalk it up
to another latex subtlety.

Please don't hesitate to reopen if you find something else, or (naturally) to file
other issues as you see them.

Reported by shiblon on 2011-05-13 16:05:40

shiblon commented 8 years ago
> Unfortunately, that also means that it produces other errors that are masked when
bar.pdf is already present.

Instead, I would say "fortunately" because make prevents LaTeX errors from piling up.
Combined with the pre-existing errors in LaTeX source code, new errors would be more
difficult to debug. So, I think it is good that make spots problems so well.

I believe this issue is closed.

Thank you again for a very useful tool and for making it public!

Reported by viatcheslav.bugayov on 2011-05-13 20:20:47

shiblon commented 8 years ago
Thanks for your kind words, and I'm glad that everything is working for you.

Reported by shiblon@google.com on 2011-05-13 21:12:19