Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3.7 does not work correctly with subdirectories for auxiliary files #27

Closed
emersonmello opened this issue Oct 12, 2023 · 2 comments

Comments

@emersonmello
Copy link

Dear @nlct ,

In my setup, I employ bib2gls, latexmk, and the VSCode with the LatexWorkshop Extension (On macOS + MacTeX-2023). This combination has been working properly for some time. However, it appears that there is an issue with version 3.7 of bib2gls (https://github.com/nlct/bib2gls/releases/tag/v3.7).

I have a preference for storing auxiliary files (i.e. .aux, .log, .glstex, .glg, etc.) within a subdirectory (i.e. 'build'). Unfortunately, version 3.7 is not working properly with this configuration.

I'm using the following .latexmkrc

$out_dir = 'build';

# https://tex.stackexchange.com/questions/400325/latexmkrc-for-bib2gls
push @file_not_found, '^Package .* No file `([^\\\']*)\\\'';
print("GLOBAL LATEXMK: Glossaries Module...\n");

add_cus_dep('aux', 'glstex', 0, 'run_bib2gls');
add_cus_dep( 'glo', 'gls', 0, 'run_bib2gls' );

sub run_bib2gls {
  my ($base, $path) = fileparse( $_[0] );
  
  if ($path && -e "$base.glstex") {
    rename "$base.glstex", "$path$base.glstex";
  } 
  my $silent_command = $silent ? "--silent" : "";


  if ( $path ) {
    my $ret = system("bib2gls $silent_command -d '$path' --group '$base'");
  } else {
    my $ret = system("bib2gls $silent_command --group '$_[0]'");
  };

  # Analyze log file.
  local *LOG;
  $LOG = "$_[0].glg";
  if (!$ret && -e $LOG) {
    open LOG, "<$LOG";
    while (<LOG>) {
      if (/^Reading (.*\.bib)\s$/) {
        rdb_ensure_file( $rule, $1 );
      }
    }
    close LOG;
  }
  return $ret;
}

Below is a brief example showcasing a successful build output using version 3.6 alongside latexmk.

------------
Run number 1 of rule 'cusdep aux glstex build/article'
------------
TEXMFOUT not a directory: build
bib2gls 3.6 (2023-09-04)
Reading build/article.aux
Encoding: UTF-8
Reading glossary.bib
Encoding: UTF-8
Writing build/article.glstex
3 entries written to build/article.glstex.
Transcript written to build/article.glg.
Latexmk: applying rule 'biber build/article'...
Rule 'biber build/article':  Reasons for rerun
Category 'other':
  Rerun of 'biber build/article' forced or previously required

Following that, the output when using version 3.7 of bib2gls in conjunction with latexmk.

------------
Run number 1 of rule 'cusdep aux glstex build/article'
------------
TEXMFOUT not a directory: build
bib2gls 3.7 (2023-09-29)
Reading build/article.aux
Encoding: UTF-8
Error: build/glossary.bib
Transcript written to build/article.glg.
Latexmk: In running custom-dependency rule
  to make 'build/article.glstex' from 'build/article.aux'
  function 'run_bib2gls' did not make the destination.
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  cusdep aux glstex build/article: Command for 'cusdep aux glstex build/article' gave return code -1

I've also attempted only bib2gls: bib2gls --debug -d build --group article

v3.7 output is:

bib2gls version 3.7 (2023-09-29)
Can't find language resource: file:/usr/local/texlive/2023/texmf-dist/scripts/bib2gls/bib2gls.jar!/resources/bib2gls-en-BR.xml
Trying: /resources/bib2gls-en.xml
Reading file:/usr/local/texlive/2023/texmf-dist/scripts/bib2gls/resources/bib2gls-en.xml
Running kpsewhich '--var-value=openin_any'
Processed returned: a
Running kpsewhich '--var-value=openout_any'
Processed returned: p
Running kpsewhich '--var-value=TEXMFOUTPUT'
kpsewhich '--var-value=TEXMFOUTPUT' failed with exit code 1
Parsing command line arguments
Checking write access for build/article.glg
openin_any=a
openout_any=p
TEXMFOUTPUT=
cwd=/Users/user/tmp
Checking read access for build/article.log
Detected package glossaries-extra 2023/09/29
Detected package glossaries 2023/09/29
Detected package mfirstuc 2022/10/14
1 recognised package:
amsmath
..........
..........
..........
Parsing bib files for resource article.glstex.
Error: build/glossary.bib
java.nio.file.NoSuchFileException: build/glossary.bib

v3.6 output is:

bib2gls version 3.6 (2023-09-04)
Can't find language resource: file:/usr/local/texlive/2023/texmf-dist/scripts/bib2gls/bib2gls.jar!/resources/bib2gls-en-BR.xml
Trying: /resources/bib2gls-en.xml
Reading file:/usr/local/texlive/2023/texmf-dist/scripts/bib2gls/resources/bib2gls-en.xml
Running kpsewhich '--var-value=openin_any'
Processed returned: a
Running kpsewhich '--var-value=openout_any'
Processed returned: p
Running kpsewhich '--var-value=TEXMFOUTPUT'
kpsewhich '--var-value=TEXMFOUTPUT' failed with exit code 1
Parsing command line arguments
Checking write access for build/article.glg
openin_any=a
openout_any=p
TEXMFOUTPUT=
cwd=/Users/user/tmp
Checking read access for build/article.log
Detected package glossaries-extra 2023/09/29
Detected package glossaries 2023/09/29
Detected package mfirstuc 2022/10/14
1 recognised package:
amsmath
..........
..........
..........
3 entries written to build/article.glstex.
Transcript written to build/article.glg.

As you can see, in version 3.7, the program is searching for glossary.bib within the subdirectory, rather than in the current directory.

@nlct
Copy link
Owner

nlct commented Oct 13, 2023

Hi, thank you for your message. I think it must be the change to the TeX Parser Library (nlct/texparser@707a33c) that's caused the problem. I'll get it fixed.

nlct added a commit that referenced this issue Oct 13, 2023
@nlct
Copy link
Owner

nlct commented Oct 13, 2023

Fixed in commit 6fd7a16. I've just uploaded v3.8 to CTAN. Allow a few days for it to reach your TeX distribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants