0

I have a problem with references in beamer (metropolis theme) and the use of include commands. Indeed, my presentation consists of several files. Each file is included via the include command.

The problem is that when I make a reference from these files, I have a problem of an undefined reference whereas if I make a reference from a frame in the master file, there is no problem. Do you have an idea ?

Just below the master file (MWE):

\documentclass[10pt]{beamer}
\usetheme[subsectionpage=progressbar]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{booktabs}
\usepackage[scale=2]{ccicons}
\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}

\begin{document}
%  myfile included via include commande
\include{./myfile}   

% reference here works fine
\begin{frame}  
   The reference here works fine \cite{ridge04}
\end{frame}

    \begin{frame}[allowframebreaks]{Références}
  \bibliography{./biblio/biblio}
  \bibliographystyle{abbrv}
\end{frame}
\end{document}

myFile.tec looks like this:

\section{Contribution}
\begin{frame}
The reference does not work here  \cite{ridge04} !
\end{frame}
ZchGarinch
  • 213
  • 2
  • 7

1 Answers1

2

The solution here is to replace the \include by \input.

The \input{file} command is equivalent to copy-pasting the contents of file to the place where the \input is called.

The \include{file} command, on the other hand, does a few other fancies. It does a \clearpage before and after including the contents of the file and creates a separate .aux for the included file. [reference]

Generally \include is used when writing something like a book, when you want the sections heads on separate pages. Otherwise \input can be used.

(My 2 cents: I always use \input and take care of the page breaking manually just to avoid the multiple .aux files).

There is something in your file that breaks the cross referencing for some reason I don't quite understand. It would be necessary more than a Minimal Working Example to see what's going on because the code from your MWE works perfectly.

TL;DR: The solution is to replace \include by \input to avoid the multiple .aux files.