Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
: handle empty files
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leo  
View profile  
 More options Oct 29, 3:36 am
Newsgroups: comp.text.tex
From: Leo <sdl....@gmail.com>
Date: Thu, 29 Oct 2009 07:36:26 +0000
Local: Thurs, Oct 29 2009 3:36 am
Subject: [glossaries and latexmk]: handle empty files
Hi,

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Collins  
View profile  
 More options Oct 29, 3:31 pm
Newsgroups: comp.text.tex
From: John Collins <coll...@phys.psu.edu>
Date: Thu, 29 Oct 2009 15:31:50 -0400
Local: Thurs, Oct 29 2009 3:31 pm
Subject: Re: [glossaries and latexmk]: handle empty files
Leo wrote:

 >
 > 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.
 >
 > How to resolve this?

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Nov 2, 5:50 am
Newsgroups: comp.text.tex
From: Leo <sdl....@gmail.com>
Date: Mon, 02 Nov 2009 10:50:37 +0000
Local: Mon, Nov 2 2009 5:50 am
Subject: Re: [glossaries and latexmk]: handle empty files
On 2009-10-29 19:31 +0000, John Collins wrote:

Thank you for this.

Do you think this is better fixed in glossaries?

Leo


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicola Talbot  
View profile  
 More options Nov 2, 9:21 am
Newsgroups: comp.text.tex
From: Nicola Talbot <n.tal...@uea.ac.uk>
Date: Mon, 02 Nov 2009 14:21:06 +0000
Local: Mon, Nov 2 2009 9:21 am
Subject: Re: [glossaries and latexmk]: handle empty files

Leo wrote:
> Do you think this is better fixed in glossaries?

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/


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Nov 2, 10:49 am
Newsgroups: comp.text.tex
From: Leo <sdl....@gmail.com>
Date: Mon, 02 Nov 2009 15:49:51 +0000
Local: Mon, Nov 2 2009 10:49 am
Subject: Re: [glossaries and latexmk]: handle empty files
On 2009-11-02 14:21 +0000, Nicola Talbot wrote:

> Leo wrote:
>> Do you think this is better fixed in glossaries?

> 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

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Herbert Schulz  
View profile  
 More options Nov 2, 11:06 am
Newsgroups: comp.text.tex
From: Herbert Schulz <he...@wideopenwest.com>
Date: Mon, 02 Nov 2009 10:06:32 -0600
Local: Mon, Nov 2 2009 11:06 am
Subject: Re: [glossaries and latexmk]: handle empty files

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Collins  
View profile  
 More options Nov 2, 3:39 pm
Newsgroups: comp.text.tex
From: John Collins <coll...@phys.psu.edu>
Date: Mon, 02 Nov 2009 15:39:00 -0500
Subject: Re: [glossaries and latexmk]: handle empty files

Nicola Talbot wrote:
> Leo wrote:
>> Do you think this is better fixed in glossaries?

> 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.

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Collins  
View profile  
 More options Nov 2, 3:47 pm
Newsgroups: comp.text.tex
From: John Collins <coll...@phys.psu.edu>
Date: Mon, 02 Nov 2009 15:47:54 -0500
Local: Mon, Nov 2 2009 3:47 pm
Subject: Re: [glossaries and latexmk]: handle empty files

Herbert Schulz wrote:

> My complete dependencies for the gloassary+glossaries package are simple
> use of makeindex rather than the makeglossaries script:

> ...

> and I had no problem compiling using latexmk.

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Collins  
View profile  
 More options Nov 2, 3:48 pm
Newsgroups: comp.text.tex
From: John Collins <coll...@phys.psu.edu>
Date: Mon, 02 Nov 2009 15:48:16 -0500
Local: Mon, Nov 2 2009 3:48 pm
Subject: Re: [glossaries and latexmk]: handle empty files

Herbert Schulz wrote:
> In article <m0r5shvsdc....@cam.ac.uk>, Leo <sdl....@gmail.com> wrote:

>> On 2009-11-02 14:21 +0000, Nicola Talbot wrote:
>>> Leo wrote:
>>>> Do you think this is better fixed in glossaries?
>>> 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.

> ...

> My complete dependencies for the gloassary+glossaries package are simple
> use of makeindex rather than the makeglossaries script:

To make this clear, Herb

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Collins  
View profile  
 More options Nov 2, 3:49 pm
Newsgroups: comp.text.tex
From: John Collins <coll...@phys.psu.edu>
Date: Mon, 02 Nov 2009 15:49:54 -0500
Local: Mon, Nov 2 2009 3:49 pm
Subject: Re: [glossaries and latexmk]: handle empty files

John Collins wrote:
>> My complete dependencies for the gloassary+glossaries package are
>> simple use of makeindex rather than the makeglossaries script:

> To make this clear, Herb

My error. Ignore that.  I hit the Send button on an incomplete draft.

John


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Herbert Schulz  
View profile  
 More options Nov 2, 4:29 pm
Newsgroups: comp.text.tex
From: Herbert Schulz <he...@wideopenwest.com>
Date: Mon, 02 Nov 2009 15:29:12 -0600
Local: Mon, Nov 2 2009 4:29 pm
Subject: Re: [glossaries and latexmk]: handle empty files
In article <hcnghq$ls0...@tr22n12.aset.psu.edu>,
 John Collins <coll...@phys.psu.edu> wrote:

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Collins  
View profile  
 More options Nov 2, 6:00 pm
Newsgroups: comp.text.tex
From: John Collins <coll...@phys.psu.edu>
Date: Mon, 02 Nov 2009 18:00:12 -0500
Local: Mon, Nov 2 2009 6:00 pm
Subject: Re: [glossaries and latexmk]: handle empty files

Herbert Schulz wrote:

>> 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.

> I realize that. I wonder if there is a problem with unconditionally
> running makeindex?

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicola Talbot  
View profile  
 More options Nov 3, 7:12 am
Newsgroups: comp.text.tex
From: Nicola Talbot <n.tal...@uea.ac.uk>
Date: Tue, 03 Nov 2009 12:12:46 +0000
Local: Tues, Nov 3 2009 7:12 am
Subject: Re: [glossaries and latexmk]: handle empty files

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.

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/


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leo  
View profile  
 More options Nov 3, 12:31 pm
Newsgroups: comp.text.tex
From: Leo <sdl....@gmail.com>
Date: Tue, 03 Nov 2009 17:31:10 +0000
Local: Tues, Nov 3 2009 12:31 pm
Subject: Re: [glossaries and latexmk]: handle empty files
On 2009-10-29 19:31 +0000, John Collins wrote:

Thank you for this.

> John Collins

--
Emacs uptime: 42 days, 8 hours, 45 minutes, 29 seconds

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google