4

I'm compiling a Plain TeX project on Overleaf with the line

$latex = 'tex %O %S';

in the latexmkrc file. This makes most things work swimmingly, except BibTeX.

In a file called main.tex I have

\input btxmac
The \TeX{}book~\cite{knuth:tex} is good.
\medskip
\leftline{\bf References}
\bibliography{mybib}
\bibliographystyle{plain}
\bye

and in a file called mybib.bib I have

@BOOK{knuth:tex,
     author = "Donald E. Knuth",
     title = "The {\TeX}book",
     publisher = "Addison-Wesley",
     year = "1984",
}

(These are examples from Patashnik.)

The problem is that I cannot get it to produce the correct output. I get enter image description here whereas locally, with the exact same files, running

tex main
bibtex main
tex main
tex main

produces enter image description here

Is there something I can add to my latexmkrc file to get the same behaviour on Overleaf? Thanks in advance! The Overleaf project is here if you would like to tinker (it contains just the minimal example and it should be editable).

5

You have to cheat :-)

The source latexmk.pl states very loosely that:

                   # In any event bibtex is only run if the log file
                   #   indicates that the document uses bbl files.

and this “indicates” means that either LaTeX printed:

No file \jobname.bbl.

to the .log, or bibtex was already run and LaTeX read the .bbl file, so the .log contains:

(./\jobname.bbl)

But Plain doesn't print No file \jobname.bbl to the .log, so you have to cheat and print it yourself. Add this to your document:

\immediate\write16{No file \jobname.bbl.}%

and you're good to go.

You may notice that this will write that line every time, but that's okay because latexmk understands anyway and will do the right thing (it ignores this line if the .bbl file was input).

2
  • 1
    Wow, there was no way I was going to figure that out on my own. This is brilliant! – marcelgoh May 26 '20 at 4:04
  • 1
    This is no cheating but standard way, how to run non-LaTeX documents at Overleaf. Unfortunately. – wipet May 26 '20 at 4:27

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.