[Tex/LaTex] Setting up WinEdt 6.0 and MiKTeX to run biblatex and biber

biberbiblatexmiktexwinedt

There should be a simple solution to the following problem, but I have failed to find one.

I have a fresh installation of WinEdt 6.0 and MiKTeX 2.9. I usually use SumatraPDF for preview, using PDFTeXify (ctrl+shift+P in WinEdt).

I would like to invoke biblatex and biber while pdftexifying by pressing something similar to ctrl+shift+P in WinEdt. How do configure WinEdt to do this?

More specifically: I would like WinEdt to run pdflatex, then biber, then pdflatex again, etc. I cannot find a way to instruct WinEdt to run biber. I have biber.exe in MiKTeX's bin directory (put it there myself) and I have tried following instructions found on the web. My LaTeX document is fine and has the biblatex package included (it compiles if I run everything manually from the command prompt).

Best Answer

This was discussed end of october 2010 on the mailing list of miktex and winedt. In short: you must set the enviroment variable "BIBTEX" and you should add some dummy commands to the aux-file to trigger the biber run. I just made again some tests and it looks as if it is also a good idea to delete the aux-file before the texify run. The heuristic of texify can still fail sometimes. Before making the final document it is a good idea to delete all auxiliary files (or at least the bbl) to get a correct result.

I added this to my local MainMenu.ini in winedt:

MENU="User_Menu"
  CAPTION="&My commands"
    ITEM="pdfTeXify + biber"
    CAPTION="pdfTeXify + biber"
    IMAGE="TeXTeXify"
    SAVE_INPUT=1
    MACRO="DeleteFile('%N.aux');SetEnvVar('BIBTEX', 'biber.exe'); Exe('%b\Exec\TeX\PDFTeXify.edt');"
    SHORTCUT="24664::Shift+Ctrl+X"
    REQ_FILTER=:"%!M=TeX"|"%!M=TeX:STY"

And this is the document I compiled:

\documentclass{book}
\usepackage[backend=biber]{biblatex}

\bibliography{examples}

\makeatletter
\providecommand\bibstyle@faked{}
\providecommand\bibdata@faked{}

\AtBeginDocument{%
\immediate\write\@mainaux{\noexpand\bibstyle@faked}%
\immediate\write\@mainaux{\noexpand\bibdata@faked}}

\makeatother

\begin{document}
abc
    \cite{test1}
    \cite{test2}
    \cite{test3}
    \printbibliography
\end{document}

I didn't make tests with include. (I actually never use texify so I don't care much about it.)