0

I'm working on a large project (3 volumes of about 500 pages each), and I'm using bib2gls to manage my glossaries. In order to save compilation time I started using arara with conditionals like in How to tell Arara to skip redundant steps? but I cannot figure out how to pass a conditional to run bib2gls only when I add another instance of a glossary entry in my document, say \gls{example}.

I've tried adding % arara: bib2gls if changed ('glg') || changed ('glstex') assuming that I've made a previous run so that both MyDoc.glg and MyDoc.glstex already exists. I don't understand how bib2gls works but I noticed that MyDoc.glstex changes by adding the example information after running bib2gls. So I'm lost here.

I would appreciate any ideas or insight about bib2gls to solve my problem.


Edit: a MWE

MyDoc.tex:

% arara: xelatex
% arara: biber if missing('bbl') || found('log', 'Citation')
% arara: --> || changed (toFile('MyBibliography.bib'))
% arara: bib2gls if missing('glstex') || changed ('glg') 
% arara: --> || changed ('glstex') || changed (toFile('MyGlos.bib'))
% arara: xelatex until !found('log', '\\(?(R|r)e\\)?run (to get|LaTeX)')

\documentclass{book}

\usepackage[backend=biber, style=numeric]{biblatex}
\usepackage{csquotes}
\usepackage[colorlinks]{hyperref}
\usepackage[record,index,postdot]{glossaries-extra}
\usepackage{glossary-bookindex}

\setglossarystyle{bookindex}
\renewcommand{\glsxtrbookindexcols}{3}
\newglossary{ind}{ing}{ige}{My Index}
\GlsXtrLoadResources[
 src=MyGloss,
 type=ind,
]

\addbibresource{MyBibliography.bib}

\begin{document}

Test \gls{hi} as seen in~\cite{blah}

\printunsrtglossary[type=ind, style=bookindex]

\printbibliography

\end{document}

MyGloss.bib:

@index{hi,
    name = {Hello World!},
}

@index{foo,
    name = {Foo},
}

MyBlibliography.bib:

@book{blah,
    author = {The Author},
    publisher = {Publisher},
    title = {An imortant book},
    year = {2020}
}

Finally, my first run: enter image description here And my second run:enter image description here

5
  • Please add an MWE to allow testing for anybody. I thnk that arara cant do this, because after first LaTeX run there are no bi2gls files. Best way would be to use latexmk via arara and setup latexmk in such a way to detect if it is needed to run bib2gls or not. I am not proficient with latexmk, so I dont know how to do that - but latexmk is scanning .aux file for clues, which is exactly what you are asking to do. Commented Oct 19, 2020 at 8:03
  • @TomášKruliš Thanks for the comment, I added a MWE and I'll start reading about latexmk Commented Oct 19, 2020 at 13:25
  • 1
    It seems to me that bib2gls always writes .glstex and .glg files. I guess that latexmk could be suitable to control this. Commented Oct 19, 2020 at 13:59
  • 1
    An elaboration of how to use bib2gls with latexmk should be here: tex.stackexchange.com/questions/400325/latexmkrc-for-bib2gls The issue is not very old (so theres big chance it will work without making changes) but the code looks pretty advanced (to me at least). Commented Oct 19, 2020 at 14:02
  • I’ll start working with that file, thanks for you comments Commented Oct 19, 2020 at 16:23

0

You must log in to answer this question.

Browse other questions tagged .