SFI-Visual-Intelligence / nldl

Template for NLDL
1 stars 0 forks source link

[bug] Crash: LaTeX Error: Command \bibhang already defined. #2

Closed sbrl closed 10 months ago

sbrl commented 10 months ago

Describe the bug After upgrading to this new template from the original one that was recommended, I get an unfortunate crash I have spent at least an hour debugging with no clues as to what's going on.

To Reproduce I am unsure how to reproduce the error, as I can't even tell what's wrong. All attempts to convince LaTeX to give some sort of debugging output have not been successful.

Expected behavior The template should compile without issues.

Screenshots I fail to understand how a screenshot would help. Please see the actual details of the bug outside of this template at the bottom of this report.

Desktop (please complete the following information):

pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)
kpathsea version 6.3.4/dev
Copyright 2021 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03

Additional context With the template information out of the way, I can describe the crash itself. I get the following error:

! LaTeX Error: Command \bibhang already defined.
               Or name \end... illegal, see p.192 of the manual.

The following texlive apt packages are installed:

Expand to see list

ii  texlive-base                                                2021.20220204-1                                                all          TeX Live: Essential programs and files
ii  texlive-bibtex-extra                                        2021.20220204-1                                                all          TeX Live: BibTeX additional styles
ii  texlive-binaries                                            2021.20210626.59705-1ubuntu0.1                                 amd64        Binaries for TeX Live
ii  texlive-extra-utils                                         2021.20220204-1                                                all          TeX Live: TeX auxiliary programs
ii  texlive-fonts-extra                                         2021.20220204-1                                                all          TeX Live: Additional fonts
ii  texlive-fonts-recommended                                   2021.20220204-1                                                all          TeX Live: Recommended fonts
ii  texlive-lang-greek                                          2021.20220204-1                                                all          TeX Live: Greek
ii  texlive-latex-base                                          2021.20220204-1                                                all          TeX Live: LaTeX fundamental packages
ii  texlive-latex-extra                                         2021.20220204-1                                                all          TeX Live: LaTeX additional packages
ii  texlive-latex-recommended                                   2021.20220204-1                                                all          TeX Live: LaTeX recommended packages
ii  texlive-luatex                                              2021.20220204-1                                                all          TeX Live: LuaTeX packages
ii  texlive-pictures                                            2021.20220204-1                                                all          TeX Live: Graphics, pictures, diagrams
ii  texlive-plain-generic                                       2021.20220204-1                                                all          TeX Live: Plain (La)TeX packages
ii  texlive-science                                             2021.20220204-1                                                all          TeX Live: Mathematics, natural sciences, computer science packages

The following content is present in the top-level LaTeX file (git repository of paper not available as it is mixed in with personal and private information):

Expand to see latex

\documentclass[fullpaper,final]{nldl}
% \documentclass[a4paper,headings=small,11pt,oneside,bibliography=totoc]{scrartcl} % section numbering
% \renewcommand\familydefault{\sfdefault} % The conference paper style is difficult to read, but nothing doing I think
% \usepackage[document]{ragged2e} % Justified text can be challenging to read for people with Dyslexia, but this is commented out for now as the NLDL conference's provided style is justified. Ref https://www.bdadyslexia.org.uk/advice/employers/creating-a-dyslexia-friendly-workplace/dyslexia-friendly-style-guide
\paperID{42}
\vol{233}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{stackrel}
% \usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{microtype}
\usepackage{palatino}
\usepackage[square,numbers]{natbib}
\usepackage{hyperref}
\newcommand{\theHalgorithm}{\arabic{algorithm}}
\usepackage[titletoc]{appendix}
\usepackage{authblk}
\pagestyle{headings}
\usepackage{parskip}
\usepackage{listings}
\usepackage{booktabs}
\lstset{
    basicstyle=\small\ttfamily,
    breaklines,
}

% \usepackage{anysize}
% \marginsize{3em}{3em}{2em}{2em}
\sisetup{detect-all}

% We don't have a DOI yet
\renewcommand{\DOI}{12345}

\newcommand{\comments}[1]{\textcolor{OliveGreen}{[\emph{#1}]}}

\newcommand{\compresslist}{%
\setlength{\itemsep}{1pt}%
\setlength{\parskip}{0pt}%
\setlength{\parsep}{0pt}%
}
\renewcommand{\arraystretch}{0.6}
\setlength\arraycolsep{2pt}

\title{Towards AI for approximating hydrodynamic simulations as a 2D segmentation task}
\author[1]{Name redacted for privacy, as it is unclear whether the paper can be deanonymised at this stage\thanks{Corresponding Author: redacted@example.com}}
\author[2]{Name redacted for privacy}
\affil[1,2]{Affiliation redacted for privacy}

% Remove the date by providing empty date
% \date{\vspace{-5ex}}
\date{}

\begin{document}
\nldlmaketitle{}

\hypersetup{
    pdftitle={Towards AI for approximating hydrodynamic simulations as a 2D segmentation task},
    pdfauthor={Name redacted for privacy, as it is unclear whether the paper can be deanonymised at this stage},
    % pdfauthor={},
    pdfsubject={Computer Science},
    pdflang={en-GB} % Set this to the ISO code for the primary language you are writing in
}

\input{chapters/0-abstract}
\input{chapters/1-introduction}
\input{chapters/2-related-works}
\input{chapters/3-data}
\input{chapters/3.5-approach}
\input{chapters/4-experiments}
\input{chapters/5-conclusion}

\bibliographystyle{abbrvnat}
\bibliography{rrconference}

\end{document}

I have identified that the problem is likely something to do with a BibTeX package being loaded twice in the new template. I do not see natbib, etc loaded in my template and the error occurs on the very first line of the LaTeX document provided above as I understand it, before the rest of the document has had a chance to execute.

adinriv commented 10 months ago

The template is using biblatex to handle the references.

Are you using the chain pdflatex -> biber -> pdflatex?

You should not use natbib since it is already loaded in the template when biblatex is loaded. (I just noticed that the template still compiles, but it is advised against.)

However, without a MWE it is impossible to tell what you are doing or what the problem is.

Edit: I checked the packages you provide in the excerpt, and even with the duplicates for natbib and authblk the template compiles. My guess is that you are not using biber and biblatex correctly. I see at the end that you are loading the bibliography using bibtex (which is from the old template and not the new one).

Similarly, you are using the setup from the old template, e.g., \nldlmaketitle{} and \DOI which are not part of the new template.

I strongly advise you to start with the new template and add your content to it. It should be straightforward given that you have the chapters and can \input them.

Moreover you shouldn't change the typeface of the template with \usepackage{palatino}.

sbrl commented 10 months ago

Many thanks! With your advice I have been able to get the new template to compile :-)