0

Here is my MWE

\documentclass[
    a4paper,
    ]{scrreprt}

\PassOptionsToPackage{ backend=biber, style=authoryear, }{biblatex} \RequirePackage{biblatex}

\addbibresource{reference.bib}

\begin{document} In view of this \textcite{slater1997architects}... \printbibliography[title=References] \nocite{*} \end{document}

Here are some entries from my reference.bib file as compiled using jabref 5.2

% Encoding: UTF-8

@Article{adlakha2006solving, author = {Adlakha, Veena and Kowalski, Krzysztof and Lev, Benjamin}, journal = {International journal of management Science and Engineering management}, title = {Solving transportation problems with mixed constraints}, year = {2006}, number = {1}, pages = {47--52}, volume = {1}, publisher = {Taylor & Francis Group}, }

@Article{axsater2013distribution, author = {Axs{"a}ter, Sven and Howard, Christian and Marklund, Johan}, journal = {Iie Transactions}, title = {A distribution inventory model with transshipments from a support warehouse}, year = {2013}, number = {3}, pages = {309--322}, volume = {45}, publisher = {Taylor & Francis}, }

@InProceedings{chartniyom2007multi, author = {Chartniyom, Siradej and Lee, MK and Luong, L and Marian, R}, booktitle = {2007 IEEE International Conference on Industrial Engineering and Engineering Management}, title = {Multi-location inventory system with lateral transshipments and emergency orders}, year = {2007}, organization = {IEEE}, pages = {1594--1598}, }

@Article{gao2013modified, author = {Gao, Cai and Wei, Daijun and Hu, Yong and Mahadevan, Sankaran and Deng, Yong}, journal = {Physica A: Statistical Mechanics and its Applications}, title = {A modified evidential methodology of identifying influential nodes in weighted networks}, year = {2013}, number = {21}, pages = {5490--5500}, volume = {392}, publisher = {Elsevier}, }

@Article{gao2014biologically, author = {Gao, Cai and Yan, Chao and Wei, Daijun and Hu, Yong and Mahadevan, Sankaran and Deng, Yong}, journal = {arXiv preprint arXiv:1401.2181}, title = {A biologically inspired model for transshipment problem}, year = {2014}, }

@Article{liao2014optimal, author = {Liao, Yi and Shen, Wenjing and Hu, Xinxin and Yang, Shilei}, journal = {Omega}, title = {Optimal responses to stockouts: Lateral transshipment versus emergency order policies}, year = {2014}, pages = {79--92}, volume = {49}, publisher = {Elsevier}, }

@Article{njoh2008implications, author = {Njoh, Ambe J}, journal = {The Review of Black Political Economy}, title = {Implications of Africa's transportation systems for development in the era of globalization}, year = {2008}, number = {4}, pages = {147--162}, volume = {35}, publisher = {SAGE Publications Sage CA: Los Angeles, CA}, }

@Article{ozdemir2006multi, author = {{"O}zdemir, Deniz and Y{"u}cesan, Enver and Herer, Yale T}, journal = {European Journal of Operational Research}, title = {Multi-location transshipment problem with capacitated transportation}, year = {2006}, number = {1}, pages = {602--621}, volume = {175}, publisher = {Elsevier}, }

@Article{paterson2011inventory, author = {Paterson, Colin and Kiesm{"u}ller, Gudrun and Teunter, Ruud and Glazebrook, Kevin}, journal = {European Journal of Operational Research}, title = {Inventory models with lateral transshipments: A review}, year = {2011}, number = {2}, pages = {125--136}, volume = {210}, publisher = {Elsevier}, }

@Article{paterson2012enhanced, author = {Paterson, Colin and Teunter, Ruud and Glazebrook, Kevin}, journal = {European Journal of Operational Research}, title = {Enhanced lateral transshipments in a multi-location inventory system}, year = {2012}, number = {2}, pages = {317--327}, volume = {221}, publisher = {Elsevier}, }

@Article{singh2017new, author = {Singh, Rashmi and Saxena, Vipin}, journal = {International journal of advanced research in computer science}, title = {A New Data Transfer Approach Through Fuzzy Vogel's Approximation Method.}, year = {2017}, number = {3}, volume = {8}, }

@Article{slater1997architects, author = {Slater, Rodney E}, journal = {Public Roads}, title = {Architects of Change: Creating America's 21st Century Intermodal Transportation System}, year = {1997}, number = {3}, volume = {60}, }

@Article{tagaras2001periodic, author = {Tagaras, George and Vlachos, Dimitrios}, journal = {Management Science}, title = {A periodic review inventory system with emergency replenishments}, year = {2001}, number = {3}, pages = {415--429}, volume = {47}, publisher = {INFORMS}, }

@Article{van2009optimal, author = {Van Wijk, ACC and Adan, IJBF and van Houtum, Geert-Jan}, journal = {Eurandom report, Eindhoven University of Technology}, title = {Optimal lateral transshipment policy for a two location inventory problem}, year = {2009}, publisher = {Citeseer}, }

@Article{wee2005optimal, author = {Wee, Kwan Eng and Dada, Maqbool}, journal = {Management Science}, title = {Optimal policies for transshipping inventory in a retail network}, year = {2005}, number = {10}, pages = {1519--1533}, volume = {51}, publisher = {INFORMS}, }

Warnings I get: LaTeX Warning: Citation 'slater1997architects' on page 2 undefined on input line X LaTeX Warning: Empty bibliography on input line X Here are a few links I have tried.

Question mark or bold citation key instead of citation number.
Biblatex with Biber: Configuring my editor to avoid undefined citations

LaTex compiler says: Package biblatex Warning: Please (re)run Biber on the file: main and rerun LaTex afterwards. I tried that as well. No luck.

I use LaTex Workshop (VS Code).

  • The code as posted works for me. (Even though the combination of \PassOptionsToPackage and \RequirePackage is unusual in the document preamble, where you'd normally go for \usepackage[<options>]{<package>}). If your editor indeed runs Biber for you, you should be able to find a .blg file (Windows may classify it as a "performance monitor file", but it is just a normal text file you can open). Check if that mentions anything suspicious. Also check the .log file of the LaTeX run. – moewe May 22 '21 at 07:30
  • Try compiling the document from the command line with pdflatex mydoc, biber mydoc, pdflatex mydoc, pdflatex mydoc (assuming your file is called mydoc.tex), to check if the problem is your TeX system or your editor setup. You might also be interested in https://tex.stackexchange.com/q/286706/35864. – moewe May 22 '21 at 07:32
  • @moewe actually I had to strip out a lot. these options were in my preamble.sty file. – Spirit_bird May 22 '21 at 12:01
  • @moewe I tried manually doing that. Didn't work. It turns out the problem was that VS Code was not setup to run biber. What I dont get is I have run it in the past a lot of times so I don't know what changed. Thank you very much. – Spirit_bird May 22 '21 at 12:03

1 Answers1

1

VS code isn't by default set up to run biber when necessary. I will walk you through the modifications you need to make:

  1. Press Ctrl+Shift+P, and type "Settings". Then select "Preferences: Open Settings (JSON)". This should open your settings.json file.

  2. Scroll down to the end of the file. On the last line with text, add a comma to the end, and then paste on a new line:

    "latex-workshop.latex.recipes": [
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "pdflatex+biber",
            "tools": [
                "pdflatex",
                "biber",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "biber only",
            "tools": [
                "biber"
            ]
        },
        {
            "name": "latexmk ",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "latexmk (latexmkrc)",
            "tools": [
                "latexmk_rconly"
            ]
        },
        {
            "name": "latexmk (lualatex)",
            "tools": [
                "lualatexmk"
            ]
        },
        {
            "name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "Compile Rnw files",
            "tools": [
                "rnw2tex",
                "latexmk"
            ]
        },
        {
            "name": "Compile Jnw files",
            "tools": [
                "jnw2tex",
                "latexmk"
            ]
        }
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-xelatex",
                "-shell-escape",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "lualatexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-lualatex",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "latexmk_rconly",
            "command": "latexmk",
            "args": [
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ],
            "env": {}
        },
        {
            "name": "rnw2tex",
            "command": "Rscript",
            "args": [
                "-e",
                "knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"
            ],
            "env": {}
        },
        {
            "name": "jnw2tex",
            "command": "julia",
            "args": [
                "-e",
                "using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"
            ],
            "env": {}
        },
        {
            "name": "jnw2texmintex",
            "command": "julia",
            "args": [
                "-e",
                "using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"
            ],
            "env": {}
        }
    ]
    
  3. Save this file, close it, and close VS Code. Then reopen VS Code.

  4. Go to the document you showed.

  5. In the activity bar (far left of VS Code), go to the TeX menu.

  6. Expand the 'Build LaTeX project' menu, and click on Recipe: pdflatex+biber. This should compile the right PDF.

  7. Click on View LaTeX PDF in the TeX menu. Now everything should work!

What was going on here? The package biblatex doesn't do all the bibliography stuff by itself. Instead, it relies on the bibliography getting processed by a program called biber. In the previous setup, biber was never run.

If you compile your file normally, then it won't ask biber to update all the bibliography references. Hence, each time you change a bibliography entry, or add or remove the only citation of an entry, biber needs to be run again. You do this by clicking on Recipe: pdflatex+biber like in the steps above.

You can change the default compilation to always do this pdflatex+biber. Then the PDF is never out of sync with the code. However, this might take longer to compile. To change this default, change the code for the recipes as

"latex-workshop.latex.recipes": [
    {
        "name": "pdflatex+biber",
        "tools": [
            "pdflatex",
            "biber",
            "pdflatex",
            "pdflatex"
        ]
    },
    {
        "name": "pdflatex",
        "tools": [
            "pdflatex"
        ]
    },
    (all the defaults)
]

I just swapped the first two elements, because the first one in the list is the default for compilation.

You could also look into assigning a keyboard shortcut to a recipe: VScode build recipe with keybinding

Has this answer helped you?