2

I'm currently working on an article using the elsarticle class, and I'm encountering some issues with combining the elsarticle-num-names bibliography style and the pagebackref feature. My goal is to have the "Cited on page X" information along with the ability to use the \citeauthor command and still have a numbered reference section.

Here's what I've observed so far:

  1. When using the elsarticle-num bibliography style, I can achieve the desired results in the reference section. However, the \citeauthor command is not available. See below. enter image description here

  2. If I switch to using the elsarticle-num-names style, I encounter a compilation error, and the "Cited on page X" information appears in the wrong position. I suspect that the issue might be related to the bst file, but I haven't been able to find a solution. See below. enter image description here

I am compiling pdfLaTeX in Overleaf. I'd greatly appreciate any help or guidance on resolving these issues. To facilitate troubleshooting, here is the test code I'm using:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[final,10pt]{elsarticle}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{mathpazo} % I am using pdfLaTeX

\usepackage[pagebackref]{hyperref} % Setup hyperlinks
\hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue, urlcolor=blue}
\usepackage{xurl}
\AtBeginDocument{
  \urlstyle{same}
}

% Setup backref
\renewcommand*{\backrefsep}{, }
\renewcommand*{\backreflastsep}{, and~}
\renewcommand*{\backreftwosep}{ and~}
\renewcommand*{\backref}[1]{}   % empty definition for \backrefalt to be used, i.e. disable standard 
\renewcommand*{\backrefalt}[4]{%
   % alternative interface
   % #1: number of distinct back references
   % #2: backref list with distinct entries
   % #3: number of back references including duplicates
   % #4: backref list including duplicates
%%%%%%%%
    \!\scriptsize\itshape\mbox{
    \ifnum#1=1 %
     (Cited on page~%
    \else
      (Cited on pages~%
    \fi
    #2)
    } }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents}{example.bib}
@book{prince,
    author = {Antoine de Saint-Exupéry},
    title = {The Little Prince},
    year = {2000},
    isbn = {978-0156012195},
    publisher = {Clarion Books},
}
@Article{jasa:2022eac,
  author  = {Fonseca, William {\relax D'A}ndrea and Brandão, Eric and Mareze, Paulo Henrique and Viviane Suzey Melo and Roberto A. Tenenbaum and Christian Santos and Dinara Xavier Paixão},
  title   = {{A}coustical {E}ngineering: a complete academic undergraduate program in {B}razil},
  doi     = {10.1121/10.0013570},
  issn    = {0001-4966, 1520-8524},
  number  = {2},
  pages   = {1180--1191},
  volume  = {152},
  journal = {The Journal of the Acoustical Society of America},
  year    = {2022},
}
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bib Options: elsarticle uses natbib
\biboptions{sort&compress,square}
%% Fix DOI in elsarticle-num-names
\makeatletter
\providecommand{\doi}[1]{%
  \begingroup
    \let\bibinfo\@secondoftwo
    \urlstyle{same}%
    ~\href{http://dx.doi.org/#1}{%
      \discretionary{}{}{}%
      \nolinkurl{#1}%
    }%
  \endgroup
}
\makeatother
%% Fix font for DOI in elsarticle num
\makeatletter
\let\path\relax 
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Test Section}

\textbf{Reference with several names:}
%
\begin{itemize}
    \item citeauthor: \citeauthor{jasa:2022eac}
    \item citeauthor*: \citeauthor*{jasa:2022eac}    
    \item citet: \citet{jasa:2022eac}
    \item cite: \cite{jasa:2022eac}
\end{itemize}

\vspace{2em}

Reference with one name:
%
\begin{itemize}
    \item citeauthor: \citeauthor{prince}
    \item citeauthor*: \citeauthor*{prince}    
    \item citet: \citet{prince}
    \item cite: \cite{prince}
\end{itemize}

\bibliographystyle{elsarticle-num-names}
% \bibliographystyle{elsarticle-num}
\bibliography{example.bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The error meassage says:

\bibinfo {author}{A.~d. Saint-Exupéry}, \bibinfo {title}{The Little\ETC.
! File ended while scanning use of \BR@@lbibitem.
<inserted text> 
                \par 
l.105 \bibliography{example.bib}

Thanks.

4
  • 1
    backref requires that \bibitem's in the bbl are separated by an empty line, but your first style doesn't do that. You can try this: make a copy of elsarticle-num-names.bst (under a new name), find all occurrences of this "%Type = XXXX" write$ (with XXXX something like article or misc or ) and delete them. Then try with this new style. Jan 23 at 14:51
  • 1
    Off-topic: Please, please replace author = {Saint-Exupéry, Antoine de} with author = {Antoine de Saint-Exupéry}, so as to avoid misleading BibTeX into treating the name's "von component" (here: "de") as if it were a given name. The "de" particle should never be truncated to "d."
    – Mico
    Jan 23 at 15:49
  • 1
    Also, it makes no sense to set the document class option times if you're going to clobber its effect by executing \usepackage{mathpazo}.
    – Mico
    Jan 23 at 15:52
  • Thanks, @UlrikeFischer, I got it working. Mico, I did the tuning in the tex. Jan 23 at 16:38

1 Answer 1

0

Here is the solution based on the comment by @Ulrike Fischer. Thanks, Danke!

  1. Copy the file elsarticle-num-names.bst
  2. Seach for all the instances of "%Type =" and replace with "\par %Type =". I found 14 of them.
  3. Put the "new" elsarticle-num-names.bst file in the same folder of your main tex file
  4. Done, it is working! I have also tested with an article with many references and it is working now. See below. enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .