2

I have the following MWE, that makes a custom bibliography

\documentclass[12pt]{report}
\usepackage{hyperref} % 
\hypersetup{
    colorlinks=true,
    linkcolor=[rgb]{0.4,0.8,0.9},
    filecolor=magenta,
    urlcolor=cyan,
}

%
%   Bibliography stuff
%
\usepackage[backend=biber,maxbibnames=99]{biblatex}

\begin{filecontents*}{biblatex-dm.cfg}
    \DeclareDatamodelFields[type=field,datatype=verbatim]{pmid}
    \DeclareDatamodelEntryfields{pmid}
    \DeclareDatamodelFields[type=field,datatype=verbatim]{pmcid}
    \DeclareDatamodelEntryfields{pmcid}
\end{filecontents*}

\DeclareFieldFormat{eprint:pmcid}{%
    PMCID\addcolon\space
    \ifhyperref
    {\href{http://www.ncbi.nlm.nih.gov/pmc/articles/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldAlias{eprint:PMC}{eprint:pmcid}
\DeclareFieldAlias{eprint:PMCID}{eprint:pmcid}
\DeclareFieldAlias{eprint:pmc}{eprint:pmcid}
\DeclareFieldAlias{pmcid}{eprint:pmcid}
\DeclareFieldAlias{pmid}{eprint:pubmed}
\DeclareFieldAlias{eprint:pmid}{eprint:pubmed}

\renewbibmacro*{doi+eprint+url}{%
    \iftoggle{bbx:doi}
    {\printfield{doi}}
    {}%
    \newunit\newblock
    \printfield{pmcid}%
    \newunit\newblock
    \printfield{pmid}%
    \newunit\newblock
    \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
    \newunit\newblock
    \iftoggle{bbx:url}
    {\usebibmacro{url+urldate}}
    {}}

\usepackage{filecontents}
\begin{filecontents*}{bubtest.bib}
    @article{Konietzny2017,
        langid = {english},
        title = {Dendritic {{Actin Cytoskeleton}}: {{Structure}}, {{Functions}}, and {{Regulations}}},
        volume = {11},
        issn = {1662-5102},
        doi = {10.3389/fncel.2017.00147},
        shorttitle = {Dendritic {{Actin Cytoskeleton}}},
        abstract = {Actin is a versatile and ubiquitous .},
        journaltitle = {Frontiers in Cellular Neuroscience},
        shortjournal = {Front Cell Neurosci},
        date = {2027},
        pages = {147},
        keywords = {actin,cytoskeleton,dendrites,Arp2/3-complex,cofilin,formin,protein trafficking},
        author = {Konietzny, Anja and Bär, Julia and Mikhaylova, Marina},
        eprinttype = {pmid},
        eprint = {28572759},
        pmcid = {PMC5435805}
    }
\end{filecontents*}
\addbibresource{bubtest.bib}


\begin{document}
    Here is some contenty content \parencite{Konietzny2017}

    \printbibliography
\end{document}

When I compile this in my editor, TeXstudio, it compiles correctly. I get both PMCID and PMID in my bibliography.

However, if I start over fresh (delete all .aux files etc) and compile the document via command line lualatex, it doesn't work.

These are the commands I run

lualatex document.tex
biber document
lualatex document.tex

I've looked, and the only thing I see for the command in TeXstudio is:

lualatex -synctex=1 -interaction=nonstopmode %.tex

I've tried running my command line stuff with those options, and same result. TeXstudio must be compiling differently.

How can I figure out what options to use, to make command line compiling work the same?

edit

I should be more clear. It compiles both in texstudio and command line. But they produce different biblioigraphs.

In TexStudio, I get this

Anja Konietzny, Julia Br, and Marina Mikhaylova. “Dendritic Actin
Cytoskeleton: Structure, Functions, and Regulations”. In: Frontiers in
Cellular Neuroscience 11 (2027), p. 147. issn: 1662-5102. doi: 10.3389/
fncel.2017.00147. PMCID: PMC5435805. PMID: 28572759.

When I compile command line, I get this:

Anja Konietzny, Julia Br, and Marina Mikhaylova. “Dendritic Actin
Cytoskeleton: Structure, Functions, and Regulations”. In: Frontiers in
Cellular Neuroscience 11 (2027), p. 147. issn: 1662-5102. doi: 10.3389/
fncel.2017.00147. PMID: 28572759.

Note that there is no PMCID in the second version, compilied on the command line.

edit2

Here is a pastebin of the working, texstudio .log file

https://pastebin.com/Ve497y9t

And here is a pastebin of the not working, command line lualatex .log file

https://pastebin.com/ddsT79Vr

The two files do say different numbers of 'pdf objects' I don't know what that means though.

  • 1
    I'm unable to reproduce your problem. The document you provided can be compiled with the commands you tried on my system. Do you get any error messages? – Marcel Krüger Mar 2 '18 at 13:24
  • Your code works for me. What exactly does not work for you? Do you get any messages in the .log or .blg files or in the console output? Can you check that the biblatex-dm.cfg is created? – moewe Mar 2 '18 at 13:25
  • 1
    I added more information. There is no problem with compiling, and I get no errors. The dm-cfg is created. Its not a compile problem per se, it compiles fine each way. Just the two results are different. – Nertskull Mar 2 '18 at 13:31
  • Mhhh, odd. Can you upload the.log file of the last LuaLaTeX run on a clean directory to a non-file-sharing website (you could use GitHub Gists or pastebin.com, ...)? – moewe Mar 2 '18 at 13:33
  • @moewe Added pastebin files of each log file. – Nertskull Mar 2 '18 at 13:45
3

Your problem can be fixed by an additional run of lualatex at the beginning. So you have to run:

lualatex document.tex
lualatex document.tex
biber document
lualatex document.tex
lualatex document.tex

The first run generates the file biblatex-dm.cfg, which is used in the second run to generate the input for biber, which generates the bibliography included in the last lualatex runs.

Your problem was that during the first run, lualatex doesn't find biblatex-dm.cfg yet, so it is ignored when generating the biber input. The problem probably did not appear with TeXstudio because you compiled your document with TeXstudio before, so the file was already in place.

  • Perfect. That solved it. For completeness, I always deleted the dm.cfg file on each run. But, texstudio always runs lualatex multiple times on my system anyway, I'm not entirely sure why. But I think its because I have many \includes, and also use the \subfiles package. I think it compiles multiple times for those. Either way, running lualatex twice on the command line before biber works. Thanks! – Nertskull Mar 2 '18 at 14:22
  • 3
    Good detective work. If one places the filecontents environment for biblatex-dm.cfg before the call to biblatex, the second LuaLaTeX run before the Biber call can be dispensed with. biblatex looks for the biblatex-dm.cfg file at loading time and if the filecontents has already produced it, it is found immediately in the first run. – moewe Mar 2 '18 at 15:56

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.