This might be an XY-problem, but I'm trying to compile two PDFs from the same source. One containing exercises, called a.pdf, and another which additionally includes the answers, called a-solutions.pdf.
I'm using TexStudio on Windows and have succeeded in creating the two files using the following configuration for pdflatex (simplified for the sake of the example):
pdflatex.exe "\newif\ifsolutions\solutionsfalse\input{%.tex}" | pdflatex.exe "\newif\ifsolutions\solutionstrue\input{%.tex}" --jobname=%-solutions
Basically, I'm running pdflatex twice, once with a boolean variable (solutions) set to false, and a second time with the variable set to true.
However, I'm not able to resolve the bibliography references for the second file. I don't know how to create the necessary a-solutions.bbl file required for the second (and third) pass of pdflatex.
Here's my current bibtex configuration in TexStudio:
bibtex.exe % | bibtex.exe %-solutions.aux
Again, I'm trying to run things twice: once for a.pdf and once for a-solutions.pdf. However, only a.bbl is created. How can I also create a-solutions.bbl?
Is it even possible to solve this?
Note: Ideally I want a solution that only requires modification to my TexStudio configuration and/or my source files. That is, I do not want to rely on external tools or build scripts.
pdflatex --jobname XXX, then this will generateXXX.aux, and thenbibtex XXXwill generateXXX.bbl, which will be used when doing againpdflatex --jobname XXX. – gernot Sep 05 '21 at 12:36solutions, or you would use the option--jobnameas you already do. The difference is that you don't need the switch\ifsolutions. BTW, the option--shell-escapeis unrelated to your question. – gernot Sep 05 '21 at 12:42a-solutions.auxfile created in the previous run of pdflatex. Thus, it only createsa.bbl, but nota-solutions.bbl. So isbibtex %-solutions.auxthe right command to tell bibtex to "use this aux file, and spit out a bbl file with a matching name"? – hakoja Sep 05 '21 at 13:33bibtex %-solutions**.aux**was in fact the wrong command, and simply removing the .aux extension fixed the problem. If you want to write this up as an answer I'll happily accept. Else I'll just do it myself in a little while. Thanks! – hakoja Sep 06 '21 at 05:55bibtex XXX.auxworks as well, so it must be specific to Windows, or TeXstudio, or both. As I don't work in your environment, I wouldn't be able to test my answer. Moreover, in the end you solved your problem yourself, after discussing it with me. – gernot Sep 06 '21 at 08:28