3

I am trying to set up Notepad++ on Windows so that I can compile LaTeX documents from it, using this excellent solution, using a batch file to compile my documents.
However, the example given uses bibtex while I prefer to use biber.

I tried simply replacing all references to bibtex in the batch file with biber, but upon compiling I get errors such as

LaTeX Warning: Empty bibliography on input line 19.

LaTeX Warning: There were undefined references.

Package biblatex Warning: Please (re)run Biber on the file:
(main)                main
(main)                and rerun LaTeX afterwards.

The document compiles correctly apart from the bibliography, which is not found and does not compile. I know the problem must lie with the batch file, as my MWE compiles fine with TeXStudio and by compiling manually via cmd using the commands

cd [path to directory]
pdflatex main.tex
biber main
pdflatex main.tex

MWE:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[backend=biber, style=ieee, sorting=ynt]{biblatex}

\addbibresource{bibliography.bib}

\title{A Minimum Working Example}
\date{}

\begin{document}

    \maketitle
    \tableofcontents

    \section{Citing a Thing}
        \cite{QuackQuack}

    \printbibliography[heading = bibintoc]
    \nocite{*}

\end{document}

bibliography:

@article{QuackQuack,
   author = {A. Author},
   title = {Quack quack quack},
   journaltitle = {Journal of Ducks},
   volume = {1},
   pages = {1},
   year = {2016}
}

batch file:

::I don't know what the next line does
%~d1
::sets working directory
cd %1
::calls pdflatex and biber on my file
pdflatex %2  
biber %2
pdflatex %2
pdflatex %2
::opens/refreshes the pdf in SumatraPDF
START "" "C:\Program Files\SumatraPDF\SumatraPDF.exe" %3 -reuse-instance

I have checked this question, and have made sure my MiKTeX installation and all packages are up-to-date

I can't find any other solutions to my problem online, and this problem stumps everyone I have asked - any help would be greatly appreciated

Utumno
  • 172
  • 1
    Your batch script calls bibtex not biber! – Joseph Wright Jan 17 '17 at 18:37
  • @josephwright - I know it does, this is the original batch file. I modified it to call biber and got the errors detailed in the question – Utumno Jan 17 '17 at 18:51
  • Can you run Biber from the command line directly? What does biber --version give? If you edit your script and replace all bibtexs with biber what exactly is the problem? Do you get a .blg file? What does it say? – moewe Jan 18 '17 at 15:42
  • @moewe biber v2.7, biblatex v3.7. I can run biber from command line manually and it works fine, references generate perfectly, including being added to contents. I cannot see any .blg files being generated – Utumno Jan 18 '17 at 17:02
  • If you don't get a .blg that means that your script failed to run Biber. Is there some way you can check that the script actually runs the commands it claims to run? – moewe Jan 19 '17 at 08:35
  • @moewe In nppexecs console output, I get INFO - This is Biber 2.7 INFO - Logfile is 'main.tex.blg' ERROR - Cannot find control file 'main.tex.bcf'! - did you pass the "backend=biber" option to BibLaTeX? INFO - ERRORS: 1 I checked the file directory, and while there isn't a main.tex.bcf there is a main.bcf – Utumno Jan 19 '17 at 12:34

1 Answers1

2

I have found the solution to my problem:

The batch script I was running took three parameters-

"$CURRENT_DIRECTORY", represented in the script as %1,

"$(NAME_PART).tex", represented by %2 and

"$(NAME_PART).pdf", represented by %3

This was passing the parameter "main.tex" to biber, which was causing the issue to appear. I edited the script to take 4 parameters, now %3 is passed "$NAME_PART", this is now given to biber, and %4 is now passed the value that was previously passed to %3

The amended script now reads:

%~d1  
cd %1
pdflatex %2  
biber %3
pdflatex %2
START "" "C:\Program Files\SumatraPDF\SumatraPDF.exe" %4 -reuse-instance

This successfully compiles the bibliography and all references. I conclude that biber does not like being given a filename with the .tex extension, and prefers instead to simply be given the filename without extension

Utumno
  • 172