I am writing a document using multiple files. I've been using the standalone package without any problem until today. I need to create an appendix chapter containing some Matlab code, so I decided to use the listings package. However, now I am getting an error which prevents my bibliography, which comes afterwards, form being compiled. Basically now I can see my whole document down to the last page of this appendix, but no bibliography. I have no problem in compiling the standalone appendix, nor compiling the rest of the document without said chapter.
Here is my relevant code. First the main.tex file.
\documentclass[12pt,a4paper,twoside,openright,titlepage]{book}
\usepackage[subpreambles=true]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian,english]{babel}
\usepackage{siunitx}
\usepackage{csquotes}
\MakeOuterQuote{"}
\usepackage{microtype}
\usepackage[binding=5mm]{layaureo}
\usepackage{calc}
\usepackage[strict]{changepage}
\usepackage{import}
\usepackage[hidelinks]{hyperref}
\usepackage{tocbibind}
\usepackage[overload]{empheq}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
% CAPTIONS settings
\usepackage{caption}
\captionsetup{tableposition=top,figureposition=bottom,font=small}
% HEADERS settings
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}
\fancyhead{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[CE]{\nouppercase{\small{\leftmark}}}
\fancyhead[CO]{\nouppercase{\small{\rightmark}}}
\fancyfoot{}
% TITLES settings
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\Huge \bfseries}
{\flushright \chaptername \ \thechapter}
{40pt}
{\Huge \bfseries}
%BIBLIOGRAPHY settings
\usepackage[backend=biber,style=science,sorting=none,sortcites=true,maxnames=1,date=year,doi=false,isbn=false,url=true,useeditor=false]{biblatex}
\bibliography{/usr/local/texlive/texmf-local/bibtex/bib/local/library.bib}
\renewcommand{\autocite}[1]{\textsuperscript{\cite{#1}}}
\begin{document}
\pagenumbering{gobble}
\import{title_page/}{source}
\import{dedica/}{source}
\frontmatter
\pagenumbering{Roman}
\tableofcontents
\listoffigures
\mainmatter
\import{chapters/chapter_01/}{source}
\import{chapters/chapter_02/}{source}
\import{chapters/chapter_03/}{source}
\import{chapters/chapter_04/}{source}
\import{chapters/chapter_05/}{source}
\import{chapters/chapter_06/}{source}
\import{chapters/appendix_A/}{source}
\backmatter
\printbibliography[heading=bibintoc]
\end{document}
And now the appendix.
\documentclass[class=book,float=false,crop=false]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{courier}
\definecolor{mygreen}{rgb}{0.133,0.545,0.133}
\definecolor{myviolet}{rgb}{0.627,0.125,0.941}
\usepackage{listings}
\lstset{basicstyle=\footnotesize\ttfamily,language=Matlab,numbers=left,breaklines=true,keywordstyle=\color{blue},commentstyle=\color{mygreen},numberstyle=\tiny\color{gray},stringstyle=\color{myviolet}
}
\usepackage[backend=biber]{biblatex}
\bibliography{/usr/local/texlive/texmf-local/bibtex/bib/local/library.bib}
\begin{document}
\appendix
\renewcommand\chaptername{Appendix}
\chapter{Implemented code}
The developed code is organized in multiple files. The analysis is called either invoking BLA BLA BLA
\lstinputlisting{/PATH/TO/FILE.m}
\end{document}
I simplified this last file neglecting lots of lstinputlinstings
calls. This is because the error shows up even with just one input.
Thanks in advance to whoever will give some help :)
listings.sty
file. Row 1576: "Undefined control sequence. \fi}" Row 1576: "Extra \else. \fi}" Row 1576: "Command \c@listings already defined. \fi}" Row 1576: "Extra \fi. \fi}" Thanks for your interest!standalone
is more intendent for diagrams etc. and not for whole chapters. Usually the\includeonly
feature is good with compiling only single chapters (when they were\include
d).