1

In Texmaker, I enable the option of "Use a 'build' subdirectory for output files".

The problem is that I don't succeed to use that option enabled and also to use bibTeX format at the same time. If I enable that option and try to use bibTeX at the same time, there is no "References" section in the pdf output file, and in the body of the text, instead of the number of reference, just the key name reference appears. For example:

Here's the code of the main file a.tex:

\documentclass{article}
\usepackage[backend=bibtex]{biblatex}
\addbibresource{r}

\begin{document}
This is the reference: \cite{kingma2014adam}.
\printbibliography
\end{document}

This is the content of r.bib:

@article{kingma2014adam,
  title={Adam: A method for stochastic optimization},
  author={Kingma, Diederik P and Ba, Jimmy},
  journal={arXiv preprint arXiv:1412.6980},
  year={2014}
}

Since I enable the option of a build subdirectory, the locations of the files (after compiling a.tex as PDFLaTeX, compiling a.tex as bibTeX and then compiling a.tex as PDFLaTeX 2 more times) are:

  • ./a.tex
  • ./build/r.tex
  • ./build/build/r.log

and there're several more files in ./build.

The output pdf file is a single line looks like:

This is the reference: [kingma2014adam].

How can I properly add the references section when also using the build subdirectory?

Thanks.

1 Answer 1

0

I don't know whether or not there exist pure (pdf)(La)TeX solution. But I had a similar problem (with bibtex) and fixed it by using the script below (Windows batch) to call bibtex (if needed you could easily adapt it to biber) and provide it to TeXmaker in place of the native bibtex % (or biber %) command:

@echo off
set dopause=0
set BUILDIR=e:\build
echo BIBTEX-Build %0
copy *.bib %BUILDIR% 1> nul 2>&1
copy *.bst %BUILDIR% 1> nul 2>&1
cd /d %BUILDIR%
Setlocal EnableDelayedExpansion
call :bibit %~n1
goto end
:bibit
   echo ------ Processing %1 -------
      @bibtex %~n1 
      if %errorlevel% NEQ 0  ( set dopause=1 )
exit /b
:end
cd ..
IF !dopause! NEQ 0 pause ELSE PING -n 3 127.0.0.1>nul

This assumes that the .bib file(s) is (are) in the main (working) directory, and takes into account the fact that the .bst file(s) could also be in this directory. The processing is performed in the build directory, where the .aux file is, and where LaTeX will find the .bbl files at next run. The code deferred to the :bibit sub-script enable a convenient error handling (closing automatically only in case of successful processing).

What I'm really using is the more elaborate version below, which enables the possibility on multiple .aux files, some of which should be processed (in case of use of, e.g., footbib or multibib) and some other should not.

@echo off
set dopause=0
set BUILDIR=e:\build
echo BIBTEX-Build %0
copy *.bib %BUILDIR% 1> nul 2>&1
copy *.bst %BUILDIR% 1> nul 2>&1
cd /d %BUILDIR%
Setlocal EnableDelayedExpansion
for %%f in  (*.aux) do (
   set ext=%%~xf
   IF  NOT !ext!==.auxlock (
   sed -r -n -e "/\\bibdata\{[^\}]+\}/ s/\\bibdata\{([^\}]+)\}/\1/p" %%~nf.aux > %%~nf.bd
   )
)
for %%g in ( *.bd) do (
   IF NOT %%~zg==0 (
      call :bibit %%~ng.aux
   ) ELSE (
      echo  Skipping %%~ng.aux 
      del %%g
   )
)
goto end
:bibit
   echo ------ Processing %1 -------
      @bibtex %~n1 
      if %errorlevel% NEQ 0  (
        rem PING -n 2 127.0.0.1>nul
        set dopause=1
       )
       del %~n1.bd
exit /b
:end
cd ..
IF !dopause! NEQ 0 pause ENSE PING -n 3 127.0.0.1>nul

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .