0

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

@online{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, doi: https://doi.org/10.1038/nprot.2009.37",
  DOI =          "https://doi.org/10.1038/nprot.2009.37",
  keywords =     "Spectrometry"
}

I have my main.tex file with the following:

\documentclass[twoside, a4paper, 11pt]{article}
\usepackage[figuresright]{rotating}
\renewcommand{\baselinestretch}{1.2}
 
\usepackage[top=2.5cm, left=2.5cm, right=2.5cm, bottom=2.5cm, headheight=1.25cm, footskip=1.25cm, margin=1in]{geometry}

\usepackage{tabularx}
\usepackage{array}
\usepackage{caption}
\captionsetup[figure]{name=Figure}
\captionsetup[table]{name=Table}
\usepackage{longtable}

\usepackage{ragged2e}
\justifying

\usepackage{fontspec}
\setmainfont{Times New Roman}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{afterpage}
\usepackage{esint}
\usepackage{listings}
\usepackage{color}
\usepackage{tcolorbox}
\usepackage{changepage}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{url}
\usepackage{multirow}
\usepackage{minted}

\setlength{\parindent}{0em}

\usepackage{float}

\usepackage{titlesec}
\titleformat{\section}
{\normalfont\LARGE\bfseries}{Chapter~\thesection :}{1em}{}

\usepackage{cite} 
\usepackage{xurl}
\bibliographystyle{IEEEtran}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    citecolor=black,
    filecolor=black,      
    urlcolor=black,
    pdftitle={Comparative Study of Electronic Circuits for Bacterial Identification},
    pdfauthor={Dimitrios D. Koliouskas},
    pdfpagemode=FullScreen,
    }
\urlstyle{same}



\begin{document}

\section{Example}
\input{Chapter 1}
\clearpage

\pagestyle{plain}
\nocite{*}

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

\end{document}

I also have a Chapter 1.tex file with the following example code:

\subsection{Also an example}
Typing...
\cite{Bacterial_Classification}

\subsubsection{example no.2}
Typing...
\cite{Mass_Spectrometry}

With THIS specific example in a new blank project it works as it should. BUT in my real document it does not work and my 2nd cited paper (Mass_Spectrometry) appears first in references, with the number [1], instead of second, although I mentioned first the Bacterial_Identification. I must clarify that in my real document I really do not have anything else from packages to anything. Literally the only thing that changes is the text in the document and the number of .tex files. I really do not know where the problem is.

I JUST figured that any bibliography that I cite in the following will go first in references (This is an edit and I did not include the packages for figures/tables in my main.tex):

\begin{figure}[hbt]
\center
\resizebox{1\textwidth}{!}{\includegraphics{A bacterial sample to a protein extraction and the final analysis by mass spectrometry.jpg}}
\caption{A bacterial sample subjected to a protein extraction and the final analysis by mass spectrometry. \cite{Mass_Spectrometry}}
  \label{Fig:Mass Spectrometry}
\end{figure}

why is this happening? The funny thing is that the \cite{Bacterial_Classification} is mentioned 4 times before the above figure (1 inside the text and 3 in 3 different figures, all before the above-mentioned figure).

8
  • The first mentioning is in the list of figures. Use \caption[text without cite for the list of figures]{text with cite} Nov 29, 2023 at 10:24
  • 1
    There is no point in posting dozens of lines of code that no one can use as it includes files we don't have, make a small self contained example removing all packages not needed in the example. For example including minted means you need --shell-escape and I would not use --shell-escape on a document copied from the internet Nov 29, 2023 at 10:44
  • 1
    in your figure, never use \center that is part of the implementation of teh center environment, the command form is \centering and don't use \resizebox simply use width= key on the \includegraphics, wow, you really use file names like A bacterial sample to a protein extraction and the final analysis by mass spectrometry.jpg It should work in recent latex but using spaces is brave and I'm not sure I've ever seen a filename with that many spaces:-) Nov 29, 2023 at 10:46
  • 1
    @DGuys spaces are a problem because on the commandline to (say) move a file you need mv two word.jpeg new name.jpg which fails as the spaces separate the arguments, so you need mv 'two word.jpeg' 'new name.jpg' but that means when generating such commands in strings you have to be really careful with losing quotes (eg if ' is used to delimit the whole string) and things can easily go wrong. people used to GUI interfaces naturally use more spaces as those of us more used to command lines hardly ever do as even creating a file with a space in its name is more work than you want to do Nov 29, 2023 at 11:04
  • 1
    @DGuys - The former command is provided by the LaTeX kernel, whereas the latter is provided by the ragged2e package. Please read the user guide of the ragged2e package to learn about the differences between the two commands.
    – Mico
    Nov 29, 2023 at 11:24

0

You must log in to answer this question.

Browse other questions tagged .