2

As shown in the following code, a few references are cited in a Beamer presentation with BibLatex \footcite command. The content except the citations is the same across three Beamer pages. It is confusing why both the columns in a page are distored in the second and third pages.

Could you help to comment how to debug and solve this problem ? Many thanks !

shell command to run

rm MWE1.aux MWE1.bbl MWE1.bcf MWE1.blg MWE1.log MWE1.nav MWE1.out MWE1.pdf MWE1.snm MWE1.toc MWE1.run.xml ; xelatex MWE1.tex && biber MWE1 && xelatex MWE1.tex && xelatex MWE1.tex

MWE1.tex

\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[10pt,ignorenonframetext,]{beamer}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
    \setmainfont[]{Times New Roman}
  \ifxetex
    \usepackage{xeCJK}
    \setCJKmainfont[]{FangSong}
  \fi
  \ifluatex
    \usepackage[]{luatexja-fontspec}
    \setmainjfont[]{FangSong}
  \fi
\fi
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\usepackage{hyperref}
\hypersetup{
            pdftitle={Sample title},
            pdfauthor={Author},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\newif\ifbibliography
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
\centering
\begin{beamercolorbox}[sep=16pt,center]{part title}
  \usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{part title}
  \usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{part title}
  \usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
}
\AtBeginPart{
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \frame{\subsectionpage}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}

% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother

\usepackage{caption}\captionsetup{labelformat=empty,labelsep=none,singlelinecheck=false,justification=centering}
\settowidth{\leftmargini}{\usebeamertemplate{itemize item}}
\addtolength{\leftmargini}{\labelsep}
\setlength{\leftmarginii}{0.5em}
\makeatletter
\@ifpackageloaded{subfig}{}{\usepackage{subfig}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\captionsetup[subfloat]{margin=0.5em}
\AtBeginDocument{%
\renewcommand*\figurename{Figure}
\renewcommand*\tablename{Table}
}
\AtBeginDocument{%
\renewcommand*\listfigurename{List of Figures}
\renewcommand*\listtablename{List of Tables}
}
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{ruled}
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
\makeatother
\usepackage[backend=biber,bibencoding=utf8,citestyle=authortitle,bibstyle=authortitle]{biblatex}
%\renewcommand{\footnotesize}{\tiny}
\addbibresource{MWE1.bib}
\usepackage{xpatch}
\xpretobibmacro{cite}{\printfield{year}\setunit{\nametitledelim}}{}{}

\title{Sample title}
\author{Author}
\date{}

\begin{document}
{
\setbeamertemplate{footline}{} % no page number here
\frame{
  \titlepage
  % Include a note for the title slide here, because we cannot do so in the 
  % Pandoc markdown file. If you want the title note to contain actual text, 
  % use the titlepage-note field in the YAML header. Otherwise, we use a 
  % non-breaking space so that it is not empty.
  \note{~}
}
}

\begin{frame}{Title of frame 1}
\protect\hypertarget{title-of-frame-1}{}

\begin{columns}[T]
\begin{column}{0.50\textwidth}
\begin{block}{Block title 1 on left}

\begin{itemize}
\item
  \small Sentence 1.
\item
  \small \emph{\textbf{Sentence 2.}}
\end{itemize}

\end{block}
\end{column}

\begin{column}{0.50\textwidth}
\begin{figure}
\centering
\includegraphics[width=\textwidth,height=0.8\textheight]{example-image-a}
\caption{\footnotesize \emph{\textbf{Example image}}}
\end{figure}
\end{column}
\end{columns}

\note{NOTES}

\end{frame}

\begin{frame}{Title of frame 2}
\protect\hypertarget{title-of-frame-2}{}

\begin{columns}[T]
\begin{column}{0.50\textwidth}
\begin{block}{Block title 1 on left}

\begin{itemize}
\item
  \small Sentence 1. \autocite{dijkstra1959note}
\item
  \small \emph{\textbf{Sentence 2.}}
\end{itemize}

\end{block}
\end{column}

\begin{column}{0.50\textwidth}
\begin{figure}
\centering
\includegraphics[width=\textwidth,height=0.8\textheight]{example-image-a}
\caption{\footnotesize \emph{\textbf{Example image}}}
\end{figure}
\end{column}
\end{columns}

\note{NOTES}

\end{frame}

\begin{frame}{Title of frame 3}
\protect\hypertarget{title-of-frame-3}{}

\begin{columns}[T]
\begin{column}{0.50\textwidth}
\begin{block}{Block title 1 on left}

\begin{itemize}
\item
  \small Sentence 1. \autocite{dijkstra1959note}
\item
  \small \emph{\textbf{Sentence 2.}}
  \autocites{dijkstra1959note,zipf1946p1}
\end{itemize}

\end{block}
\end{column}

\begin{column}{0.50\textwidth}
\begin{figure}
\centering
\includegraphics[width=\textwidth,height=0.8\textheight]{example-image-a}
\caption{\footnotesize \emph{\textbf{Example image}}}
\end{figure}
\end{column}
\end{columns}

\note{NOTES}

\end{frame}

\end{frame}

\end{document}

MWE1.bib

@article{dijkstra1959note,
    Author = {Dijkstra, Edsger W},
    Date-Added = {2014-04-28 19:35:12 +0000},
    Date-Modified = {2014-04-28 19:35:12 +0000},
    Journal = {Numerische mathematik},
    Number = {1},
    Pages = {269--271},
    Publisher = {Springer},
    Title = {A note on two problems in connexion with graphs},
    Volume = {1},
    Year = {1959}}

@article{zipf1946p1,
    Author = {Zipf, George Kingsley},
    Date-Added = {2014-04-28 19:32:00 +0000},
    Date-Modified = {2014-04-28 19:32:00 +0000},
    Journal = {American sociological review},
    Pages = {677--686},
    Publisher = {JSTOR},
    Title = {The P1 P2/D hypothesis: On the intercity movement of persons},
    Year = {1946}}

Update:

In this SE post, lockstep's answer seems to solve this problem of distortion, although the reason is beyond me.

SOUser
  • 227
  • 1
    see https://tex.stackexchange.com/questions/352281/citation-at-the-end-of-minipage-rather-than-at-the-end-of-frame/352363#352363 If this does not help, please make your code more minimal. – samcarter_is_at_topanswers.xyz Mar 19 '18 at 18:15
  • 1
    Mhhh, your example is not exactly minimal and I had a few problems because I don't have the CJK font installed (is that relevant to the question?). Additionally you have a few \IfFileExists so I'm not sure that I get the same output you get. Anyway, I can see a 'distortion' in that the right column is magically shifted to the right even more if you add a footnote. – moewe Mar 19 '18 at 18:18
  • 1
    Incidentally, I think the \footnote command is causing this and not biblatex's citations in general ... Maybe you can make your example even more minimal so people investigating this don't get sidetracked by things that actually don't matter to the core of the problem. – moewe Mar 19 '18 at 18:19
  • @samcarter and moewe Many thanks for your efforts ! The .tex file is based on one generated with Pandoc. I am new to Latex to minimize it... I will try to see if there are snippets from other SE answers which I could use to demostrate the problem. – SOUser Mar 19 '18 at 18:24

1 Answers1

2

Based on citation at the end of minipage rather than at the end of frame

\documentclass[10pt,ignorenonframetext]{beamer}

\usepackage{filecontents}
\begin{filecontents*}{MWE1.bib}
@article{dijkstra1959note,
    Author = {Dijkstra, Edsger W},
    Date-Added = {2014-04-28 19:35:12 +0000},
    Date-Modified = {2014-04-28 19:35:12 +0000},
    Journal = {Numerische mathematik},
    Number = {1},
    Pages = {269--271},
    Publisher = {Springer},
    Title = {A note on two problems in connexion with graphs},
    Volume = {1},
    Year = {1959}}

@article{zipf1946p1,
    Author = {Zipf, George Kingsley},
    Date-Added = {2014-04-28 19:32:00 +0000},
    Date-Modified = {2014-04-28 19:32:00 +0000},
    Journal = {American sociological review},
    Pages = {677--686},
    Publisher = {JSTOR},
    Title = {The P1 P2/D hypothesis: On the intercity movement of persons},
    Year = {1946}}
\end{filecontents*}

\usepackage[bibencoding=utf8,citestyle=authortitle,bibstyle=authortitle]{biblatex}
\addbibresource{MWE1.bib}

\begin{document}

\begin{frame}
\frametitle{Title of frame 2}

\begin{columns}[T]
\begin{column}{0.45\textwidth}
\begin{block}{Block title 1 on left}

\begin{itemize}
\item Sentence 1.\footnotemark[1] 
\item Sentence 2.\footnotemark[2]
\end{itemize}

\end{block}
\end{column}

\begin{column}{0.45\textwidth}
\begin{figure}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Example image}
\end{figure}
\end{column}
\end{columns}

\setcounter{footnote}{1}
\footcitetext{dijkstra1959note}
\stepcounter{footnote}
\footcitetext{zipf1946p1}

\end{frame}

\end{document}

Some other comments:

  • Please do not load the same package multiple times

  • you don't need hyperref with beamer

  • If your tex installation is reasonable up to date, you don't need fixltx2e

  • pdfborder={0 0 0} is unnecessary, beamer already does that

  • hard coded values for pdftitle={Sample title}, pdfauthor={Author} are not a good idea. If you remove this, the title and author of your document will be used.

  • You don't need \usepackage{graphicx} with beamer

  • In a documentclass that does not have floats \def\fps@figure{htbp} does not make much sense

  • I don't understand the sense of \@ifpackageloaded{subfig}{}{\usepackage{subfig}} \@ifpackageloaded{caption}{}{\usepackage{caption}}. Why not use \RequirePackage{} instead?

  • backend=biber unnecessary as this is the default behaviour

  • \protect\hypertarget{title-of-frame-1}{} is strange, better use \begin{frame}[label=title-of-frame-1]

  • you should not have two columns of .5\textwidth, as there is some seperation between them. Either make them smaller, say .48\textwidth or at least use \begin{columns}[T,onlytextwidth]

  • formatting instructions should be separated from the content, so instead of \item \small text better do \setbeamerfont{itemize\enumerate body}{size=\small}. Same for the caption font.

  • only specify either the width or the height in \includegraphics[width=\textwidth,height=0.8\textheight]{example-image-a}, not both.

In general it would be better if you only load the packages you really need and only do the modifications you need instead of this very chaotic the-whole-kitchen-sink-preamble.