0

I am on LyX 2.3.0 on Windows trying to write a beamer prsesentation, and the citation are not displayed correctly. For some settings it yields "author?" while for other, it displays something like "king_matrix_2014". In any case, it never displays "King (2014)" as it should. When I choose a "number" style instead of "author", I always get "?".

The log depends on the style I choose.

.bib file:

@article{king_matrix_2014,
    title = {Matrix method for comparing system and individual energy return ratios when considering an energy transition},
    volume = {72},
    issn = {0360-5442},
    url = {http://www.sciencedirect.com/science/article/pii/S0360544214005817},
    doi = {10.1016/j.energy.2014.05.032},
    abstract = {ERRs (Energy return ratios) are valuable metrics for understanding and comparing the contributions of individual energy technologies. It is also important to calculate ERRs in the context of a system, or economy, using a mix of energy technologies. In this paper I demonstrate a framework to simultaneously consider individual energy technology and system-wide ERRs using a process-based input{\textendash}output model approach. I demonstrate the approach via an example calculating grid electricity ERRs assuming constant technology with only a shift in dominance from fossil to renewable technology. The framework also enables interpretation of changes in individual ERRs due to a shift from one technology to another, with implications for energy scenario analyses. Another finding of this paper is that the ERR GER (gross energy ratio, often assumed equal to EROImm (energy return on energy invested at the {\textquoteleft}mine mouth{\textquoteright})), is only well-defined for primary energy extraction and not energy carriers such as gasoline and electricity. NER (Net energy ratio) and NEER (net external energy ratio), also known as EPR (energy payback ratio), are the most appropriate metrics for describing energy carriers sold to consumers.},
    urldate = {2018-03-29},
    journal = {Energy},
    author = {King, Carey W.},
    month = aug,
    year = {2014},
    note = {00011},
    keywords = {excellent, EROI, Net energy, Energy, system, Life cycle assessment, Energy economics, Input{\textendash}output},
    pages = {254--265},
    file = {King 2014 home:U\:\\Zotero\\storage\\D7F3PPBD\\King 2011 home.pdf:application/pdf;ScienceDirect Full Text PDF:U\:\\Zotero\\storage\\VDAXI9WZ\\King - 2014 - Matrix method for comparing system and individual .pdf:application/pdf}
}

.lyx file:

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass beamer
\begin_preamble
\usepackage{url}
%\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{tabularx}
%\usepackage[super,sort&compress]{natbib}
\usetheme{Warsaw}
\usepackage{dsfont}
%\usepackage[table]{xcolor}
%\usepackage{dcolumn}
\addtobeamertemplate{footline}{\insertframenumber/\inserttotalframenumber}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package auto
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "libertine-ntxm" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine natbib
\cite_engine_type authoryear
\biblio_style plainnat
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 1
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Title (Plain Frame)
Bibliography not working
\end_layout

\begin_layout Frame
\begin_inset Argument 4
status open

\begin_layout Plain Layout

\end_layout

\end_inset


\begin_inset Separator latexpar
\end_inset


\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset CommandInset citation
LatexCommand citet
key "king_matrix_2014"
literal "false"

\end_inset


\end_layout

\end_deeper
\begin_layout Standard
\begin_inset CommandInset bibtex
LatexCommand bibtex
btprint "btPrintCited"
bibfiles "C:/Users/a.fabre/Google Drive/Economie/Articles/Environment"
options "plain"

\end_inset


\end_layout

\end_body
\end_document

.tex file:

%% LyX 2.3.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{beamer}
\usepackage[libertine]{newtxmath}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}
\usepackage[authoryear]{natbib}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
% (ERT) argument for the TOC
\AtBeginDocument{%
  \let\origtableofcontents=\tableofcontents
  \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
  \def\gobbletableofcontents#1{\origtableofcontents}
}
% plain title style, override default
\renewcommand\makebeamertitle{\frame[plain]{\maketitle}}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{url}
%\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{tabularx}
%\usepackage[super,sort&compress]{natbib}
\usetheme{Warsaw}
\usepackage{dsfont}
%\usepackage[table]{xcolor}
%\usepackage{dcolumn}
\addtobeamertemplate{footline}{\insertframenumber/\inserttotalframenumber}

\makeatother

\usepackage{babel}
\begin{document}

\title{Bibliography not working}
\makebeamertitle
\begin{frame}{}

\citet{king_matrix_2014}
\end{frame}
\bibliographystyle{plain}
\bibliography{\string"C:/Users/a.fabre/Google Drive/Economie/Articles/Environment\string"}

\end{document}

[EDIT] including \usepackage{dsfont} helped to display the bibliography at the end (before it didn't even appear).

  • 3
    Please edit your question to include the files there to make it independent from external sites. Can you also export your file from lyx to tex so that we can test? – user36296 Oct 12 '18 at 16:05
  • 1
    More likely a problem with one of the citations and not with the number of slides. Impossible to diagnose without having the .tex and .bib code – user36296 Oct 12 '18 at 16:27
  • I put the .tex, the .bib was already there. But it may be a LyX problem, and the .tex won't help in this case. – bixiou Oct 12 '18 at 16:50
  • Please add it to this site, not a google link. In case you get in trouble with maximal post length, you could use a respectable site such as pastebin.com – user36296 Oct 12 '18 at 16:52
  • How do I do this? – bixiou Oct 12 '18 at 17:06
0

You encounter your problem when you use \citet, which is a natbib specific command. To use, employ a style which is compatible with natbib, e.g. replace the plain stylewithplainnat`.

Some other comments:

  • latin9 is nowadays a very uncommon encoding. Check if this is really the encoding your file is saved in

  • There should be a frame around \bibliographystyle{plainnat}\bibliography{test}. Otherwise alignment is broken and other features, such as automatic frame breaks won't work

  • Using \usepackage{indentfirst} with beamer does not make much sense

  • \addtobeamertemplate{footline}{\insertframenumber/\inserttotalframenumber} will result in ugly white boxes, I would use \setbeamertemplate{page number in head/foot}[totalframenumber]


%% LyX 2.3.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{beamer}
\usepackage[libertine]{newtxmath}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}
\usepackage[authoryear]{natbib}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
% (ERT) argument for the TOC
\AtBeginDocument{%
  \let\origtableofcontents=\tableofcontents
  \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
  \def\gobbletableofcontents#1{\origtableofcontents}
}
% plain title style, override default
\renewcommand\makebeamertitle{\frame[plain]{\maketitle}}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{url}
%\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{tabularx}
%\usepackage[super,sort&compress]{natbib}
\usetheme{Warsaw}
\usepackage{dsfont}
%\usepackage[table]{xcolor}
%\usepackage{dcolumn}
\addtobeamertemplate{footline}{\insertframenumber/\inserttotalframenumber}

\makeatother

\usepackage{babel}
\begin{document}

\title{Bibliography not working}
\makebeamertitle
\begin{frame}{}

\citet{king_matrix_2014}
\end{frame}

\begin{frame}
\bibliographystyle{plainnat}
\bibliography{test}
\end{frame}

\end{document}

enter image description here

  • Awesome, thanks! I don't know where the encoding is defined in LyX. And when I put the bibliography in a frame, it gives only the 5 first references (only one frame of references). Also, do you have a tip for "references" not being in the contents in the header? Finally, I always have ugly white boxes, even with setbeamertemplate – bixiou Oct 15 '18 at 12:22
  • @bixiou If you have more questions, please ask them as new questions - it is easier to respond to them – user36296 Oct 15 '18 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.