1

I want to make a biblatex item appear in the bibliography without having cited it explicitly. This can be done with \nocite{*}, but in the bibliography, only the items that have been cited with \cite appear to have a number. A MWE

\documentclass{article}
\\usepackage[backend=biber,
style=numeric,
sorting=nyt]
{biblatex}
\addbibresource{smth.bib}

\begin{document}
According to \cite{first item}...
\nocite{second item}

\printbibliography
\end{document}

I would get:

[1] First item
Second item

Instead of

[1] First item
[2] Second item

EDIT: It seems like the issue comes from a figure and a center environment:

\documentclass{article}
\usepackage{graphicx}
\usepackage[backend=biber,
style=numeric,
sorting=nyt]
{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{example.bib}
  @misc{guion,
author= "{Laboratorio de Física.}",
title="Determinación de índices de refracción",
year="2023",
howpublished=" Disponible en \url{https://fisicas.ucm.es/file/prac22-2223-v0?ver}",
}

@misc{sears,
    author    = "{Sears y Zemansky}",
    title     = "Física Universitaria con Física Moderna",
    publisher = "Pearson",
    volume   = "2",
    edition  = "13",
    year      = "2013",
}
\end{filecontents*}
\addbibresource{example.bib}
\begin{document}
According to \cite{guion}...
\nocite{*}

\section{Lorem ipsum}
%\centering


%---------------------Figure with \centering inside -------------%
%\begin{figure}[h]
%\centering
%\includegraphics[]{dummy.png}
%\end{figure}

\begin{center} % Should be equivalent to centering
\printbibliography[title=Bibliography]
\end{center}
 
%\includegraphics[]{dummy.png}

%\end{center}
\end{document}

Toggling \centering instead of a center environment makes it work, but not the other way round.

I don't get how introducing a figure with \centering before the bibliography can affect it in any way. Isn't it supposed to be a condition that only holds inside the float?

4
  • The number of \nocited entries should appear in the bibliography. If I turn the code snippet into code I can compile (I don't have smth.bib): gist.github.com/moewew/c292ce00ef26a471e5288676a7373f92 I obtain i.sstatic.net/v8TDB.png with a number also for the \nocited entry. Please change your MWE so that we can compile it and post a screenshot of the MWE, not your larger document.
    – moewe
    Mar 18, 2023 at 10:13
  • How should I change the MWE? I'm new here so I don't know what's wrong. 'smth.bib' is just a dummy name. Mar 18, 2023 at 20:43
  • Have a look at tex.meta.stackexchange.com/q/228/35864 and tex.meta.stackexchange.com/q/4407/35864. It's important that your code is compilable as-is and that you compiled it and verified it reproduces the issue.
    – moewe
    Mar 19, 2023 at 5:37
  • It seems like the \center environment was causing problems. Yet I have another project with exactly the same lines of code (that is, \begin{center}, \printbibliography, and end{center}) but it does work. ???? Mar 20, 2023 at 11:50

1 Answer 1

4

Don't use \begin{center}...\end{center} to centre section headings. The environment creates a list (and grouping), which may interfere with other typesetting. In this case it messes with the bibliography, which is also typeset as a list, leading to a nested list.

The following reproduces the issue more compactly

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem\cite{sigfridsson,worman}

\section{Ipsum}

\begin{center}
\printbibliography
\end{center}
\end{document}

The best solution here depends be on your requirements. Presumably you used \begin{center}...\end{center} to typeset the bibliography heading centred. Do you want to centre all section headings, all unnnumbered section headings or only the bibliography heading?

If you only want to change the bibliography heading, one fairly clean solution is to insert a \centering into the \section* call.

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\defbibheading{bibliography}[\refname]{%
  \section*{\centering#1}%
  \@mkboth{\abx@MakeMarkcase{#1}}{\abx@MakeMarkcase{#1}}}
\makeatother

\begin{document}
Lorem\cite{sigfridsson,worman}

\section{Ipsum}

\printbibliography
\end{document}

References with numbering

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .