Example:
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\begin{document}
\printglossaries
abcd
\end{document}
latexmk (4.10d) is configured to have:
add_cus_dep('glo', 'gls', 0, 'makeglossaries');
Now run latexmk on the example:
Latexmk: This is Latexmk, John Collins, 10 September 2009, version: 4.10d.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Latexmk: applying rule 'cusdep glo gls bug2'...
Rule 'cusdep glo gls bug2': File changes, etc:
Non-existent destination files:
'bug2.gls'
------------
Run number 1 of rule 'cusdep glo gls bug2'
------------
For rule 'cusdep glo gls bug2', running '&do_cusdep( makeglossaries )'
...
added glossary type 'main' (glg,gls,glo)
Warning: File 'bug2.glo' is empty.
Have you used any entries defined in glossary 'main'?
*** Skipping glossary 'main'. ***
Latexmk: In running custom-dependency rule
to make 'bug2.gls' from 'bug2.glo'
function 'makeglossaries' did not make the destination.
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
cusdep glo gls bug2: Run of rule 'cusdep glo gls bug2' gave a non-zero
error code
Latexmk: Did not finish processing file:
Run of rule 'cusdep glo gls bug2' gave a non-zero error code
Latexmk: Use the -f option to force complete processing.
How to resolve this?
Leo
The problem is that the current version of the makeglossaries program does
not produce an output file when the .glo file is empty. Latexmk assumes
that non-existence of an output file in such a situation is an error (which
would normally be sensible). You can overcome this by defining latexmk's
custom dependency for glossaries in the following way to make an empty .gls
file:
add_cus_dep('glo', 'gls', 0, 'makeglossaries');
sub makeglossaries {
system "makeglossaries $_[0]";
if ( -z "$_[0].glo" ) {
print "Latexmk: Empty glo file, I am making dummy gls file\n";
open GLS, ">$_[0].gls";
close GLS;
}
return 0;
}
John Collins
Thank you for this.
Do you think this is better fixed in glossaries?
Leo
Why is the gls file empty? If it's because you've not used the main
glossary, then use the package option "nomain". If you are using the
main glossary then the gls file ought not to be empty.
Regards
Nicola Talbot
--
Home: http://theoval.cmp.uea.ac.uk/~nlct/
LaTeX Related Information: http://theoval.cmp.uea.ac.uk/~nlct/latex/
Creating a LaTeX Minimal Example:
http://theoval.cmp.uea.ac.uk/~nlct/latex/minexample/
I don't know exactly what's going on. However, compiling this example:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\begin{document}
\printglossaries
abcd
\end{document}
--8<---------------cut here---------------end--------------->8---
generates an empty .glo file and that confuses latexmk.
*File List*
+-----------------------+------------+-------+
| article.cls | 2005/09/16 | v1.4f |
| size10.clo | 2005/09/16 | v1.4f |
| glossaries.sty | 2009/09/23 | v2.03 |
| ifthen.sty | 2001/05/26 | v1.1c |
| xkeyval.sty | 2008/08/13 | v2.6a |
| xkeyval.tex | 2008/08/13 | v2.6a |
| mfirstuc.sty | 2008/12/22 | v1.03 |
| xfor.sty | 2009/02/05 | v1.05 |
| amsgen.sty | 1999/11/30 | v2.0 |
| glossary-hypernav.sty | 2007/07/04 | v1.01 |
| glossary-list.sty | 2009/05/30 | v2.01 |
| glossary-long.sty | 2009/05/30 | v2.01 |
| longtable.sty | 2004/02/01 | v4.11 |
| glossary-tree.sty | 2009/01/14 | v1.01 |
+-----------------------+------------+-------+
Best,
Leo
--
Emacs uptime: 41 days, 6 hours, 56 minutes, 49 seconds
Howdy,
Using TL-2009 pretest my file list is:
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
glossaries.sty 2009/09/23 v2.03 (NLCT)
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
xkeyval.sty 2008/08/13 v2.6a package option processing (HA)
xkeyval.tex 2008/08/13 v2.6a key=value parser (HA)
mfirstuc.sty 2008/12/22 v1.03 (NLCT)
xfor.sty 2009/02/05 v1.05 (NLCT)
amsgen.sty 1999/11/30 v2.0
glossary-hypernav.sty 2007/07/04 v1.01 (NLCT)
glossary-list.sty 2009/05/30 v2.01 (NLCT)
glossary-long.sty 2009/05/30 v2.01 (NLCT)
longtable.sty 2004/02/01 v4.11 Multi-page Table package (DPC)
glossary-super.sty 2009/05/30 v2.01 (NLCT)
supertabular.sty 2004/02/20 v4.1e the supertabular environment
glossary-tree.sty 2009/01/14 v1.01 (NLCT)
test.gls
***********
My complete dependencies for the gloassary+glossaries package are simple
use of makeindex rather than the makeglossaries script:
# ************
# Custom dependency for glossary/glossaries package
# if you make custom glossaries you may have to add items to the
@cus_dep_list and corresponding sub-routines
add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
sub makeglo2gls {
system("makeindex -s '$_[0]'.ist -t '$_[0]'.glg -o
'$_[0]'.gls '$_[0]'.glo");
}
# The glossaries package, with the [acronym] option, produces a .acn
file when processed with (xe/pdf)latex and
# then makeindex to process the .acn into .acr and finally runs of
(xe/pdf)latex to read in the .acr file. Unfortunately
# the glossary package does just the reverse; i.e. (xe/pdf)latex
processing produces a .acr files and makeindex then
# is used to convert the .acr file to a .acn file which is then ... .
This dependency assumes the glossaries package.
add_cus_dep('acn', 'acr', 0, 'makeacn2acr');
sub makeacn2acr {
system("makeindex -s '$_[0]'.ist -t '$_[0]'.alg -o
'$_[0]'.acr '$_[0]'.acn");
}
# for glossary package (Sigh...) --- they can co-exist!
add_cus_dep('acr', 'acn', 0, 'makeacr2acn');
sub makeacr2acn {
system("makeindex -s '$_[0]'.ist -t '$_[0]'.alg -o
'$_[0]'.acn '$_[0]'.acr");
}
# example of an added custom glossary type that is used in some of the
glossary/glossaries example files:
# this is for the new glossary type command
\newglossary[nlg]{notation}{not}{ntn}{Notation} from the glossaries
package
# NOTE: the glossary package uses a very different command: the <in-ext>
and <out-ext>
# are reversed in the calling sequence :-(
add_cus_dep('ntn', 'not', 0, 'makentn2not');
sub makentn2not {
system("makeindex -s '$_[0]'.ist -t '$_[0]'.nlg -o
'$_[0]'.not '$_[0]'.ntn");
}
# for the glossary package (Sigh...) --- they can co-exist!
add_cus_dep('not', 'ntn', 0, 'makenot2ntn');
sub makenot2ntn {
system("makeindex -s '$_[0]'.ist -t '$_[0]'.nlg -o
'$_[0]'.ntn '$_[0]'.not");
}
# ************
and I had no problem compiling using latexmk.
Good Luck,
Herb Schulz
It's because the user used no glossary entries. Here's a test document:
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{sample}{name={sample},description={test}}
\begin{document}
\printglossaries
abcd
\end{document}
This could quite typical in the early stages of writing a document. The
author wishes to use a glossary, but has not yet written the parts of the
document using the glossary entries. In that case the glo file is empty.
Running makeindex gives an empty gls file, which as far as I can see is
exactly correct for the situation of no uses of glossary entries. The next
run of latex/pdflatex will have no glossary in the output file.
Unfortunately, the makeglossaries script (v. 1.6 and later) does not run
makeindex in that situation. Then either (a) there is no gls file at all,
or (b) the gls file is one left over from a previous run, which is now out
of date, and therefore definitively wrong.
The original poster can change that by deleting the following lines in the
makeglossaries script:
# v1.6 added file empty test
if (-z $inputfile)
{
print "Warning: File '$inputfile' is empty.\n",
"Have you used any entries defined in glossary '$type'?\n",
"*** Skipping glossary '$type'. ***\n";
next;
}
As far as my own simple testing are concerned, it seems to have no adverse
effect.
John Collins
That's because in the custom dependency rules you defined for latexmk,
makeindex is run unconditionally. But the OP's custom dependencies used an
invocation of makeglossaries instead. As I noted in my previous message,
makeglossaries does not run makeindex when the glo file has zero length.
This caused the reported problem.
John Collins
To make this clear, Herb
My error. Ignore that. I hit the Send button on an incomplete draft.
John
Howdy,
I realize that. I wonder if there is a problem with unconditionally
running makeindex? It certainly doesn't run into this kind of problem.
Good Luck,
Herb Schulz
I don't think so. When there are entries in the input (idx or glo) file,
makeindex makes an output file (ind or gls) containing the whole index.
When the input has no entries, the output file is empty.
In the source document, the \printindex or \printglossary command inputs
the ind or gls file. As long as this file contains valid LaTeX, there
should be no problem.
John
makeindex may produce an empty gls file, but xindy doesn't. Change the
second line in the above example to:
\usepackage[xindy]{glossaries}
then the xindy run will create a gls file containing:
\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble
\begin{theglossary}\glossaryheader
%
\end{theglossary}\glossarypostamble
If "theglossary" is a list environment (such as "description") this will
cause a LaTeX empty list error, which is why I put in the test for an
empty file. I'll change the code in makeglossaries to just create an
empty gls file if the glo file is empty without calling makeindex/xindy.
Thank you for this.
> John Collins
--
Emacs uptime: 42 days, 8 hours, 45 minutes, 29 seconds