emacslatexorg-modebibliography

How to make org-mode use bibulous.py instead of biber?


I would like to export my Org documents to a PDF and have bibulous.py format the bibliography. For this I use the command C-c C-e l p aka org-latex-pdf-process. Here is how I have adapted the command to my needs

    (setq org-latex-pdf-process
          (list "lualatex -shell-escape -interaction nonstopmode %f"
            (concat "python C:/pythonpath/bibulous.py " "my_document_name" ".aux")
            "lualatex -shell-escape -interaction nonstopmode %f"
            "lualatex -shell-escape -interaction nonstopmode %f"))

This works so far, but only for my test document with the name my_document_name. To keep things general, there should be a function here that uses the current buffer name. I tried

    python C:/pythonpath/bibulous.py %f.aux

but it does not work. I suspect that the variable %f contains the extension .tex (is there a way to see what exactly was called? the *Messages* buffer does not show this).

I have also tried the following

    (concat "python C:/pythonpath/bibulous.py " (file-name-sans-extension buffer-file-name) ".aux")

however, it seems that this variable is set when Emacs is launched, and does not access the actual buffer name during runtime.


Solution

  • You should check the doc of org-latex-pdf-process by C-h v org-latex-pdf-process

    Commands to process a LaTeX file to a PDF file.
    
    This is a list of strings, each of them will be given to the
    shell as a command.  %f in the command will be replaced by the
    relative file name, %F by the absolute file name, %b by the file
    base name (i.e. without directory and extension parts), %o by the
    base directory of the file, %O by the absolute file name of the
    output file, %latex is the LaTeX compiler (see
    org-latex-compiler), and %bib is the BibTeX-like compiler (see
    org-latex-bib-compiler).
    
    ...
    

    So all you need is

    (setq org-latex-pdf-process
          '("lualatex -shell-escape -interaction nonstopmode %f"
            "python C:/pythonpath/bibulous.py %b.aux"
            "lualatex -shell-escape -interaction nonstopmode %f"
            "lualatex -shell-escape -interaction nonstopmode %f"))