BibTeX, biblatex and biberelsarticle-num v2.1: month field of article ignored if pages are present

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
user49915
Posts: 81
Joined: Wed Apr 17, 2019 12:51 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user49915 »

Consider the following input:

Code: Select all

\documentclass{elsarticle}% V3.2 from http://ctan.org/tex-archive/macros/latex/contrib/elsarticle
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Holzmann-TheModelCheckerSPIN,
  author = {Gerard Johan Holzmann},
  title = {The model checker {SPIN}},
  journal = {{IEEE} {TSE}},
  volume = 23,
  number = 5,
  month = may,
  year = 1997,
  pages = {279--295}
}
@article{Sutter-TheFreeLunchIsOver,
  author={Herb Sutter},
  title={The free lunch is over: a fundamental turn toward concurrency in software},
  journal={Dr.\@ Dobb's Journal},
  year = 2005,
  volume=30,
  number=3,
  month=mar
}
\end{filecontents}
\begin{document}
\cite{Holzmann-TheModelCheckerSPIN,Sutter-TheFreeLunchIsOver}
\bibliographystyle{elsarticle-num}% V2.1 from http://ctan.org/tex-archive/macros/latex/contrib/elsarticle
\bibliography{\jobname}
\end{document}
Consider the output of the standard pdflatex-bibtex loop:
Output of the standard pdflatex-bibtex loop
Output of the standard pdflatex-bibtex loop
test.png (198.45 KiB) Viewed 4887 times
Notice that the month is missing if the pages are given and present if the pages are not given. I think the month should be there regardless of the pages according to various manuals (e.g., http://mirror.utexas.edu/ctan/info/bibt ... ttb_en.pdf or http://en.wikipedia.org/wiki/BibTeX). What's the right (I do know that the term is vague) way to repair `elsarticle-num.bst`? (An aside: to the best of my knowledge, the authors of the package were contacted but have not reacted so far.)
Last edited by user49915 on Wed Apr 24, 2019 2:44 pm, edited 2 times in total.

Recommended reading 2024:

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

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

user22741
Posts: 35
Joined: Fri Nov 09, 2018 12:03 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user22741 »

You use a bibliography style that does not show the month if pages are given. If you want to show the month, use a bib style that shows it, create a bib style of your own or remove the pages.

Code: Select all

\documentclass{elsarticle}% V3.2 from <!-- m --><a class="postlink" href="https://ctan.org/tex-archive/macros/latex/contrib/elsarticle">https://ctan.org/tex-archive/macros/lat ... elsarticle</a><!-- m -->
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Holzmann-TheModelCheckerSPIN,
  author = {Gerard Johan Holzmann},
  title = {The model checker {SPIN}},
  journal = {{IEEE} {TSE}},
  volume = 23,
  number = 5,
  month = may,
  year = 1997,
  pages = {279--295}
}
\end{filecontents}


\biboptions{}

\begin{document}
\cite{Holzmann-TheModelCheckerSPIN}
\bibliographystyle{plainnat}% V2.1 from <!-- m --><a class="postlink" href="https://ctan.org/tex-archive/macros/latex/contrib/elsarticle">https://ctan.org/tex-archive/macros/lat ... elsarticle</a><!-- m -->
\bibliography{\jobname}
\end{document}
Last edited by user22741 on Wed Apr 24, 2019 4:39 pm, edited 2 times in total.
user49915
Posts: 81
Joined: Wed Apr 17, 2019 12:51 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user49915 »

user22741 wrote:You use a bibliography style that does not show the month if pages are given.
I don't think that it was intended this way; there is no good reason for this strange conditional behavior. I think it's simply a bug in `elsarticle-num.bst`.
user22741
Posts: 35
Joined: Fri Nov 09, 2018 12:03 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user22741 »

why would the source code contain a special if-case to check for empty page fields, if this behavior was not intended?

Code: Select all

pages empty$  
	  { format.date "year" output.check }
    'skip$ 
  if$
user49915
Posts: 81
Joined: Wed Apr 17, 2019 12:51 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user49915 »

user22741 wrote:why would the source code contain a special if-case to check for empty page fields
I don't know. Given that the prior edition of elsarticle-num.bst from January 2019 had more bugs (cf. https://tex.stackexchange.com/questions ... -for-entry, https://tex.stackexchange.com/questions ... aphy-entry), I bet on the side that the authors simply err.
user22741
Posts: 35
Joined: Fri Nov 09, 2018 12:03 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user22741 »

user49915 wrote:
user22741 wrote:why would the source code contain a special if-case to check for empty page fields
I don't know. Given that the prior edition of elsarticle-num.bst from January 2019 had more bugs (cf. https://tex.stackexchange.com/questions ... -for-entry, https://tex.stackexchange.com/questions ... aphy-entry), I bet on the side that the authors simply err.
Then why ask here and not write to the authors?
user49915
Posts: 81
Joined: Wed Apr 17, 2019 12:51 pm

elsarticle-num v2.1: month field of article ignored if pages are present

Post by user49915 »

user22741 wrote:Then why ask here and not write to the authors?
This problem is mentioned in the aside in my OP.
Post Reply