I think this question is pretty vague, and I can delete it if needed.

I have a huge report template, which include every chapter. I've done it so I can compile each part in Texmaker via pdflatex > bibtex > pdflatex. It works well but for some files (like my frontpage or my result), I don't need to \cite anything. I also use natbib whith custom .bst

So when I compile these files, I get the error no citations founds from bibtex, which is understable. My actual solution is to cite a "blank" citation for these parts, but it's not satisfying, as it takes place a the end of my file pdf for nothing.

Is there a way to compile these files with bibtex and without any citation or bibliography? Like changing the behaviour of \bibliography in these files ?

Yes I'm lazy and don't want to change my texmaker settings when I edit on file with citation or another with no citation. I can add some code if you need it, but with multiple file it's long...

  • I just found that I can add \renewcommand{\refname}{} to suppress the "Reference" section title, but there is still one reference minimum to have... – Gowachin Feb 6 at 16:27
  • Add \nocite{*] to your preamble. – Bernard Feb 6 at 18:11
  • Well no, this command ad everycitation in the bibliography. I don't want any bibliography, because I cite no thing... – Gowachin Feb 6 at 18:30
  • Well, if you don't want any bibliography, don't use bibtex… B.t.w. this command has to be used just once. – Bernard Feb 6 at 18:32
  • I thought of this option, but I precise in my question why I'm curious of finding even a tricky way of getting around it. I work with multiple chapter, and I don't really want to change the compilation way every time I change of chapter edition. Another way of thinking this is a modification of \bibliography so it don't use Bibtex when there are no citation in the document... like this : tex.stackexchange.com/questions/74476/… – Gowachin Feb 6 at 18:52

A way to work around this is to chnage Texmaker compilation way in order to check for the existance of citation in the file.aux before using bibtex.

When I was compiling, I used this command for pdflatex>bibtex>pdflatex(x2)>viewpdf

pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex | bibtex %.aux |pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex |pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex |evince %.pdf

I have set a small shell script that check for \citation in the file before executing bibtex.

if [ "$1" ];
  then FILE="$1"
  if [[ ! -z $(grep "\citation" "$FILE") ]];
    then bibtex $FILE;

and so my compilation command work like this

pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex | ./diffBibtex.sh %.aux |pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex |pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex |evince %.pdf

It works now, but I see multiple drawback to this right now. I depend on a custom script that may just work in linux environment. Secondly, I need to make sur every .aux is removed before new compilation if I add a citation or remove all of them. Finally this is working because it's used in a local workflow but I don't know yet if the cost in term of sharing my template will be huge.

Any answer is still welcome

|improve this answer|||||
  • Maybe you should check if the .tex file contains any \cite{...} instead of mucking with .aux. Or make sure the check is only done after running e.g. pdflatex. – vonbrand Feb 7 at 23:49
  • Its what I do, I run pdflatex and after I run my script diffBibtex.sh that run bibtex only if there is at least one \citation. Checking for \cite could delete the drawback of removing every file.aux before compilation, but then all the compilation process rely on 1 script, and I'm not confident enought at this moment to code such a reliable script. In fact, I didn't achieved to understand how texmaker share the filename with &, and how to use this information in a custom script. – Gowachin Feb 8 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.