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).
\caption[text without cite for the list of figures]{text with cite}– Ulrike Fischer Nov 29 '23 at 10:24mintedmeans you need--shell-escapeand I would not use--shell-escapeon a document copied from the internet – David Carlisle Nov 29 '23 at 10:44\centerthat is part of the implementation of tehcenterenvironment, the command form is\centeringand don't use\resizeboxsimply usewidth=key on the\includegraphics, wow, you really use file names likeA bacterial sample to a protein extraction and the final analysis by mass spectrometry.jpgIt 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:-) – David Carlisle Nov 29 '23 at 10:46mv two word.jpeg new name.jpgwhich fails as the spaces separate the arguments, so you needmv '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 – David Carlisle Nov 29 '23 at 11:04ragged2epackage to learn about the differences between the two commands. – Mico Nov 29 '23 at 11:24