LyXLyx-2.2.0 fails on Biblatex/natbib

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
ExecutorElassus
Posts: 94
Joined: Wed Sep 07, 2011 3:14 pm

Lyx-2.2.0 fails on Biblatex/natbib

Post by ExecutorElassus »

I have the following preamble:

Code: Select all

%% LyX 2.2.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,oneside,american]{scrbook}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text,Numbers=OldStyle]{Linux Libertine O}
\setsansfont[Mapping=tex-text]{Linux Biolinum O}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=3cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{polyglossia}
\setdefaultlanguage{usenglish}
\usepackage[notes,natbib,backend=biber,alldates=iso8601,idemtracker=context,ibidtracker=context,dateabbrev=false,language=american]{biblatex-chicago}
\renewcommand\citet{\autocite}
\addbibresource{/[$HOME]/bookbib.bib}
\errorcontextlines=10

\makeatother

\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\begin{document}
blah \citet{aarseth1994nonlinearity}

\bibliographystyle{plainnat}
\bibliography{/[$HOME]/bookbib}

\end{document}

Under Document→Settings→Bibliography, I have natbib(author-year) and biber as the processor.

When I try to compile, I get the following errors:

Code: Select all

\bibliographystyle{plainnat}
                                 
Use the package option 'style' instead.
I'm ignoring this command.
and

Code: Select all

\bibliography
                  {71_home_[$HOME]_bookbib}
Your command was ignored.
(that one also says it can only appear in the preamble).
and so forth.

In short, it looks like Lyx isn't formatting its bibliography commands in a way that XeTeX can use anymore.

There's a lot of cruft I have in my preamble in addition to this, largely to get around certain limitations of bibliography handling (ie, single-spacing the bibliography in a onehalf-spaced document, using biblatex-chicago, but also being able to format numerical dates as yyyy-mm-dd, support for non-western characters, etc.). But compiling is failing on this.

Any advice?

Cheers,

EE

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Lyx-2.2.0 fails on Biblatex/natbib

Post by Johannes_B »

Kick out \bibliographystyle and \bibliography and replace them with \printbibliography.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
ExecutorElassus
Posts: 94
Joined: Wed Sep 07, 2011 3:14 pm

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by ExecutorElassus »

So far as I can see, those two TeX strings are inserted by LyX itself, and there doesn't seem to be any way to remove them from a document compiled within Lyx. Unless I just insert "\bibliography{bookbib}" manually (but then how do I ensure that it's listed in the TOC?).

ETA: did that (the \bibliography string has to be in the preamble, and the Lyx bibliography has to be embedded into a note for it to work), but it still won't format the citations (ie, it just prints the citation's label).

Any suggestions why it won't work?

Cheers,

EE
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by Johannes_B »

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
ExecutorElassus
Posts: 94
Joined: Wed Sep 07, 2011 3:14 pm

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by ExecutorElassus »

I'm not sure which part of that guide I'm supposed to be looking at, but that's the guide I followed when I set up my initial file. I'm using biblatex-chicago here (incidentally, also recently updated to the latest version), and still getting this error.

Cheers,

EE
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by Johannes_B »

Since LyX is inserting bibliography related stuff, which it is not supposed to, you did something different.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
ExecutorElassus
Posts: 94
Joined: Wed Sep 07, 2011 3:14 pm

Lyx-2.2.0 fails on Biblatex/natbib

Post by ExecutorElassus »

here is the current file:

Code: Select all

%% LyX 2.2.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,oneside,american]{scrbook}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text,Numbers=OldStyle]{Linux Libertine O}
\setsansfont[Mapping=tex-text]{Linux Biolinum O}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=3cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{polyglossia}
\setdefaultlanguage{usenglish}
\usepackage[notes,natbib,backend=biber,alldates=iso8601,idemtracker=context,ibidtracker=context,dateabbrev=false,language=american]{biblatex-chicago}
\renewcommand\citet{\autocite}
\bibliography{/home/[$HOME]/bookbib}
\addbibresource{/home/[$HOME]/bookbib.bib}
\errorcontextlines=10

\makeatother

\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\begin{document}
blah \citet{aarseth1994nonlinearity}

\printbibliography
\end{document}
The "Lyx note" will not be printed in the tex file, but the .lyx file continues as follows:

Code: Select all

\begin_body

\begin_layout Standard
blah 
\begin_inset CommandInset citation
LatexCommand citet
key "aarseth1994nonlinearity"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Note Note
status collapsed

\begin_layout Plain Layout
\begin_inset CommandInset bibtex
LatexCommand bibtex
bibfiles "/home/[$HOME]/bookbib"
options "bibtotoc,plainnat"

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
printbibliography
\end_layout

\end_inset


\end_layout

\end_body
\end_document
I'm pretty sure I'm following that guide, but maybe there's something subtle I'm missing?

Cheers,

EE
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by scottkosty »

This used to work for you with LyX 2.1.x?

If so, can you please provide a .lyx file minimal example that works with 2.1.4 but fails with 2.2.0? (and a .bib file as well if necessary to reproduce). Since you have a complicated preamble, please narrow things down as much as possible: i.e. get the smallest possible file that gives an error with 2.2.0 but succeeds with 2.1.4. Can you also provide the log files that you get from *both* 2.1.4 and 2.2.0?

I know that's a lot of work but if you're willing to spend that time then I will spend the time to look into the possible regression.
ExecutorElassus
Posts: 94
Joined: Wed Sep 07, 2011 3:14 pm

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by ExecutorElassus »

I was just about to come back here and post this. Yes, it worked under 2.1.5 (I think that was the latest version).

It will take me some time, though, to collect all the information.

Thanks for the help.

EE
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Lyx-2.2.0 fails on Biblatex/natbib

Post by scottkosty »

Note also that LyX 2.2.0 reports BibTeX errors where 2.1.x did not report all of them, so it is possible that there was an error that you just did not notice (because LyX did not report it). There is a button in the error dialog "Show Output Anyway". When you click that do you see the same output PDF you saw with 2.1.x?
Post Reply