1

Compiler: XeLaTeX

I have a file Bibliography.bib with the following code included:

@misc{Bacterial_Classification,
    author = "Franklin D. Lowy",
    title = "Bacterial Classification, Structure and Function",
    howpublished = {\url{https://api.semanticscholar.org/CorpusID:49963607 (accessed: Columbia University, 2008)}},
    keywords = "Basics of Bacteria"
}

@article{Mass_Spectrometry,
  author =       "Anja Freiwald
and Sacsha Sauer",
  title =        "Phylogenetic classification and identification of bacteria by mass spectrometry",
  journal =      "Nat Protoc",
  volume =       "4",
  number =       "5",
  pages =        "732-742",
  year =         "2009, doi: https://doi.org/10.1038/nprot.2009.37",
  DOI =          "https://doi.org/10.1038/nprot.2009.37",
  keywords =     "Spectrometry"
}

In my main.tex file in the end which I want the bibliography to go I have the following code:

\pagestyle{plain}
\nocite{*}
\bibliographystyle{ieeetr}

\renewcommand{\refname}{REFERENCES}
\phantomsection
\addcontentsline{toc}{section}{REFERENCES}
\bibliography{Bibliography.bib}
\clearpage

So, I have written for IEEE style, correct? In IEEE style references appear in the order citations are mentioned in the text of the document. "Reference list entries should appear in the order the sources are cited in the text of the paper, beginning with [1], and continuing in the ascending numerical order, from the lowest number to the highest. Reference list entries do not follow an alphabetical order by author or title of sources."

I mention Bacterial_Classification first as \cite{Bacterial_Classification} and then I mention Mass_Spectrometry as \cite{Mass_Spectrometry} BUT in the resulting output on pdf, in the last section which references are, they appearing like this:

[1] A. Freiwald and S. Sauer, “Phylogenetic classification and identification of bacteria by mass spectrometry,” Nat Protoc, vol. 4, no. 5, pp. 732–742, 2009, doi: https://doi.org/10.1038/nprot.2009.37.

[2] F. D. Lowy, “Bacterial classification, structure and function.” https://api.semanticscholar.org/ CorpusID:49963607(accessed:ColumbiaUniversity,2008).

If I delete the citation of Mass_Spectrometry (\cite{Mass_Spectrometry}) of course the reference will go second (because 1) that is the order in the .bib file and 2) I have a citation of Bacterial_Classification either way), but if I cite it again (I am repeating after the citation of Bacterial_classification) it will once again go first …

Why exactly is this happening and the 2nd mentioned citation is appearing first with number [1] at the text too, while the 1st mentioned citation is appearing second with number [2] at the text. How can I solve this?

PS: Literally if I create a new document with exactly the same preamble it will fix the problem … I am going to lose my mind. Is something in my text causing the problem? How could it be? It is not code … I literally just created a new document with copy/paste the same preamble and I only wrote the bibliography code in the \begin{document} \end{document} phase.

PS2: (EDITED) I just found that the problem is I have many .tex files. I mean that I have my main but the I have .tex file for each of my chapters. So when I cite a bibliography in the other .tex files and not in the main, the references are appearing only by alphabetic order.

How to I fix this? What must I include in my code and where?

11
  • The ieeetr bibliography style is one of the original BibTeX styles (along with stalwarts such as plain, abbrv, unsrt, alpha, and apalike) and, as such, hasn't been modified meaningfully in more than 35 [!] years. If you want current IEEE style, please use IEEEtran.bst.
    – Mico
    Commented Nov 28, 2023 at 23:03
  • @Mico 1) You mean \bibliographystyle{IEEEtran.bst} instead of \bibliographystyle{ieeetr}? That is useful, obviously I want the current IEEE style. But when I am typing it it does not appear the coomand automatically like it does with ieeetr. Why isa that?
    – DGuys
    Commented Nov 28, 2023 at 23:08
  • 2) It does not solve my problem though.
    – DGuys
    Commented Nov 28, 2023 at 23:08
  • I found the problem and I explain it on P.S. 2 but I can not figure how to solve it.
    – DGuys
    Commented Nov 28, 2023 at 23:11
  • The proper syntax is \bibliographystyle{IEEEtran}, not \bibliographystyle{IEEEtran.bst}. For sure, after changing the argument of \bibliographystyle, one must run a full recompile cycle -- LaTeX, BibTeX, and LaTeX twice more -- to fully propagate all changes. I'm afraid I have no idea what "But when I am typing it it does not appear the coomand automatically like it does with ieeetr" is supposed to mean.
    – Mico
    Commented Nov 28, 2023 at 23:14

1 Answer 1

1

Please do yourself a big favor and stop using the grossly out of date ieeetr bibliography style. If, instead, you use the IEEEtran bibliography style, the bibliographic entries will be sorted by order of their appearance in the \cite commands in the body of the document.

enter image description here

In the code below, note that I've replaced

howpublished = {\url{https://api.semanticscholar.org/CorpusID:49963607 (accessed: Columbia University, 2008)}},

with

  url      = "https://api.semanticscholar.org/CorpusID:49963607",
  year     = 2008,
  note     = "Accessed: Columbia University",

I.e., the IEEEtran bib style knows about a field called url.


% !TEX TS-program = xelatex
\documentclass{article}

\begin{filecontents}[overwrite]{Bibliography.bib}
@misc{Bacterial_Classification,
  author   = "Franklin D. Lowy",
  title    = "Bacterial Classification, Structure and Function",
  url      = "https://api.semanticscholar.org/CorpusID:49963607",
  year     = 2008,
  note     = "Accessed: Columbia University",
  keywords = "Basics of Bacteria"
}
@article{Mass_Spectrometry,
  author   = "Anja Freiwald and Sascha Sauer",
  title    = "Phylogenetic classification and identification of bacteria by mass spectrometry",
  journal  = "Nat Protoc",
  volume   = "4",
  number   = "5",
  pages    = "732-742",
  year     = "2009",
  url      = "https://doi.org/10.1038/nprot.2009.37",
  keywords = "Spectrometry"
}
\end{filecontents}

\usepackage{cite} % classic citation management package for numeric citation call-outs
\bibliographystyle{IEEEtran} % <-- not 'ieeetr', please
\usepackage{xurl} % allow line breaks at arbitrary points in a URL string

\begin{document}
\noindent
\cite{Bacterial_Classification}, \cite{Mass_Spectrometry}
\bibliography{Bibliography}
\end{document}
4
  • 1) Thank you for the useful information! Really, the appearance of bibliography is much better now. 2) I see that I also can use online now instead of misc. Is this more appropriate? Because before I could not use online, I assume it was because of "ieeetr". 3) Finally, it did not solve the problem with the order. You mentioned something about set up per chapter bibliography. What exactly should I include?
    – DGuys
    Commented Nov 28, 2023 at 23:50
  • @DGuys - About 2): The @online entry type is an alias for the @electronic entry type. The file IEEEtran.bst has the following to say about the @electronic entry type: "the @electronic entry types use periods as inter-item punctuation rather than the commas used by the other entry types; and URLs are never followed by periods even though they are the last item in the entry". Whether this is more or less appropriate is not for me to decide. About 3): Please post a new query. Do you maybe have multiple \bibliographystyle directives in your tex file(s)? If so, only the first one counts.
    – Mico
    Commented Nov 29, 2023 at 0:22
  • 2) Thank you for that!! 3) No, I do not have multiple \bibliographystyle. I will ppst a new query and I will let you know.
    – DGuys
    Commented Nov 29, 2023 at 7:41
  • I just posted a new query for this, if you could please answer there. I think that I found where the problem appears but I do not know why or how to fix it.
    – DGuys
    Commented Nov 29, 2023 at 10:24

You must log in to answer this question.

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