0

I'm trying to automate a conversion from .md to PDF via pdflatex. In concept I've got this working but now noticed that the citekeys, e.g. \footcite{citekey} weren't being processed. Then I noticed that neither were they being processed in TeXStudio.

I had this working fine a few months ago, not sure if something updated or how it broke. Since I started using TeXStudio again a few days ago I've also noticed that all commands related to citations (e.g. addbibresource, footcite, printbibliography) are marked as unknown. Not sure if that's related?

As I'm not sure what exactly all packages do, I'm including more than likely necessary in the MWE.

MWE:

% Options for packages loaded elsewhere
%\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
    \DeclareUnicodeCharacter{02BE}{}
\documentclass[a4paper, 12pt, oneside]{article}
\usepackage[a4paper, portrait, margin=0.9in,headheight=14.5pt]{geometry}

\usepackage[]{nohyperref} \usepackage[normalem]{ulem}

\usepackage[dvipsnames]{xcolor}

\definecolor{lightred}{RGB}{252,156,156}

\usepackage{lmodern} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi

% CITATION

% Load BibLaTeX and set the style to Author-Year \usepackage[authordate,autocite=footnote, cmsdate=both, backend=biber, isbn=false, noibid, url=false]{biblatex-chicago}

% Tell BibLaTeX to use the file example.bib for the bibliography database \addbibresource{/home/RG42/Documents/LaTeX/My Templates/MWE/MWELibrary.bib}

% START DOCUMENT %

\begin{document}

textabc\footcite{Cowles2020Scientific}

\printbibliography[title=References]

\end{document}

Contents of MWELibrary.bib:


@book{Cowles2020Scientific,
  title = {The Scientific Method: An Evolution of Thinking from {{Darwin}} to {{Dewey}}},
  shorttitle = {The Scientific Method},
  author = {Cowles, Henry M.},
  year = {2020},
  publisher = {{Harvard University Press}},
  address = {{Cambridge, Massachusetts}},
  abstract = {"abstract blablabla"--},
  isbn = {978-0-674-97619-1},
  lccn = {Q174.8 .C69 2020},
  file = {/home/RG42/Documents/Zotero/storage/FGEN2GVI/Cowles - 2020 - The scientific method an evolution of thinking fr.pdf}
}

And here's the config window, in case that's important. enter image description here

However, as the problem is also happening when I do this from the command line via pdflatex file.tex I don't think the last bit is the case.

I've found that in the "Log" of TeXStudio, I'm getting a bunch of these warnings. Citation 'Cowles2020Scientific' on page 1 undefined

This citekey is definitely in the .bib file.

  • 1
    Welcome. You have a space in the path to your bibfile: My Templates. This could lead to TeX not finding the file. Maybe try to escape the space and compile again. – lukeflo Jul 22 '23 at 16:52
  • 1
    Running pdflatex on this document is not enough. It needs to be compiled with at least pdflatex file, biber file, pdflatex file, pdflatex file for all references to resolve. See https://tex.stackexchange.com/q/63852/35864 for more background. Some editors have a heuristic to decide whether or not to run Biber for you, which may or may not be always right, but almost all editors should give you an option to run Biber manually. – moewe Jul 23 '23 at 05:35
  • 1
    If you did run LaTeX, Biber, LaTeX, LaTeX as suggested in my last comment and still don't get the expected output, you need to check the .log file (LaTeX log) and .blg file (Biber log) for warnings or errors. https://tex.stackexchange.com/q/286706/35864 – moewe Jul 23 '23 at 05:36
  • @lukeflo that was just because for the MWE I put the .bib file in the same folder as the .tex file. The actual path doesn't include a space. but good catch! – ReaderGuy42 Jul 23 '23 at 09:50
  • @moewe with the help of someone on reddit, I've changed the Build & View command to this: txs:///biber | txs:///compile | txs:///view and now it works. So I'm generally happy, but could you maybe tell me why all the citation commands (e.g. the \addbibresource) are all still unrecognized? It works, it just throws me off that TeXstudio is not recognizing them. – ReaderGuy42 Jul 23 '23 at 09:52
  • I'm assuming "unrecognized" means that your editor says that it doesn't know the command and not that there is an actual error message or warning during the LaTeX run. Usually these features of editors rely on the editor parsing your code and checking with a list of known commands per package. Maybe your editor does not know that the biblatex-chicago package loads biblatex and thus also defines \addbibresource. Maybe your editor has trouble parsing the very long line loading biblatex-chicago. ... – moewe Jul 23 '23 at 11:11
  • That's possible, but it's just odd since I didn't change anything in my template that I was using a few months ago, where there was no mention of commands being unrecognized. And yes TeXstudio runs the commands, just marks them as unrecognized – ReaderGuy42 Jul 23 '23 at 15:03
  • Strip down your document to the bare minimum (i.e. remove everything that is unrelated to biblatex) and report the failure to recognise \addbibresource as a bug at https://github.com/texstudio-org/texstudio/issues if you think it should recognise the command. – moewe Jul 23 '23 at 15:10
  • I think the problem may have to do with my texstudio version. The Linux Mint Software Manager has the 4.2.1 version, and the current 4.5.2 flatpak. I switched to the flatpak and now it's not calling the biblatex commands unrecognized any more. – ReaderGuy42 Jul 23 '23 at 21:42
  • It's possible that older versions had trouble identifying that biblatex-chicago loads biblatex. Now that all issues are resolved I marked your question as a duplicate of our generic "how do I configure my editor for Biber" issue. – moewe Jul 24 '23 at 03:51

0 Answers0