2

I have the following table:

\begin{table}[hbt]
\centering
\tabcolsep=0.3cm
\caption{Gram Negative Bacteria.}{\cite{Bacterial_Classification}}
\label{Tab:Gram Negative Bacteria}
\renewcommand{\arraystretch}{1.5}
\small
\begin{tabularx}{\textwidth}{ p{5em} >{\raggedright\arraybackslash}X p{5em} p{5em} >{\raggedright\arraybackslash}X >{\raggedright\arraybackslash}X }
    \toprule
    \textbf{Name} & \textbf{Morphology} & \textbf{O\textsubscript{2} Require\-ments} & \textbf{Commensal} & \textbf{Reservoirs / Sites \-of colonization, Transmission} & \textbf{Types of Infections} \\ \midrule
    Entero\-bacteriaceae (E. coli, klebsiella, salmonella, shigella) & Rods & facultative anaerobe & Some species & GI tract, animals / Endogenous, fecal oral & Diarrhea, uninary tract, food poisoning, sepsis \\
    Bacteroides & Rods & anaerobic & Yes & GI tract / Endogenous & Abscesses \\
    Pseudomonas & Rods & aerobic & No & Water, soil / Endogenous, breach of skin barrier & Infections in immunocompromised hosts, Cystic Fibrosis \\
    Vibrio (cholera) & Rods, curved shap & micro\-aerophilic & No & Water / Contaminated food, water & Diarrhea \\
    Campylobac\-ter & Rods, curved shape & micro\-aerophilic & No & Food / Ingestion of contaminated food & Diarrhea, Bacteremia \\
    Legionella & Rods, poorly stained & micro\-aerophilic & No & Water Inhalation of aerosol & Pneumonia, febrile illness \\
    Neisseriam & Cocci, kidney-bean shaped & Micro\-aerophilic & No (\textit{N. meningitidis} sometimes) & Humans / Sexual, aerosol & Meningitis, pelvic inflammatory disease \\
    Hemophilus & Coccobacillary-pleomorphic & facultative anaerobe & Some species & Respiratory tract / Endogenous, aerosol & Respiratory, sinusitis, otitis, meningitis \\
    Bartonella & Small, pleomorphic rods & aerobic/micro\-aerophilic & No & Cats, fleas, lice / cat bites, lice or fleas? & Cat scratch disease, endocarditis, bacillary angiomatosis \\\bottomrule
\end{tabularx}
\end{table}

I also have the following figure:

\begin{figure}[hbt]
\centering
\resizebox{1\textwidth}{!}{\includegraphics{Thesis/Images/Chapters/Chapter 1/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}

These 2 represent the same example I want you to focus. The citation is appearing under the table or figure caption and not in the end of the text of table/figure caption.

If I cite like this: \caption{A bacterial sample subjected to a protein extraction and the final analysis by mass spectrometry. \cite{Mass_Spectrometry}} we will end up with a problem in referencing order cause the list of figures. So we must keep the form \caption{A bacterial sample subjected to a protein extraction and the final analysis by mass spectrometry.}{\cite{Mass_Spectrometry}}. This is also the correct way to do it: \caption[text without cite for the list of figures]{text with cite}

P.S. I do not include the packages used in preamable because I assume they do not matter for this problem. If you want it, just comment it and I will edit.

7
  • 1
    \caption only has one mandatory argument, I assume you meant \caption[Gram Negative Bacteria.]{\cite{Bacterial_Classification}} not \caption{Gram Negative Bacteria.}{\cite{Bacterial_Classification}} Nov 30, 2023 at 10:37
  • 3
    "P.S. I do not include the packages used in preamable because I assume they do not matter for this problem. " it always helps to provide an example that shows the problem. No one can run these fragments. Don't include all the packages from your real document but make a small complete document that shows the problem. Nov 30, 2023 at 10:39
  • 1
    \resizebox{1\textwidth}{!}{\includegraphics{...}} sounds like a very complicated way to say \includegraphics[width=\textwidth]{...} Nov 30, 2023 at 10:40
  • seing as the question is about captions you could also change the text of the figure (to sayABC as currently people need to guess at least booktabs, tabularx and graphicx packages to run these fragments Nov 30, 2023 at 10:40
  • 1
    @samcarter_is_at_topanswers.xyz a very wise person made the same comment yesterday Nov 30, 2023 at 10:42

1 Answer 1

3

\caption only has one mandatory argument, I assume you meant

\caption[Gram Negative Bacteria.]{\cite{Bacterial_Classification}}

not

\caption{Gram Negative Bacteria.}{\cite{Bacterial_Classification}}

14
  • Correct! Once again, you save the day from silly mistakes.
    – DGuys
    Nov 30, 2023 at 10:51
  • 1
    +1. I think it would be helpful to include some text in the main argument of \caption as well. Thus, \caption[Gram Negative Bacteria.]{Gram Negative Bacteria \cite{Bacterial_Classification}.}.
    – Mico
    Nov 30, 2023 at 10:57
  • @Mico Thank you, I agree! I did it myselft. In order for it to appear in the list of figures too.
    – DGuys
    Nov 30, 2023 at 11:06
  • In a long table, how could this be fixed? Because there we have this: caption = {Gram Positive Bacteria.}{\cite{Bacterial_Classification}} and it does not fix if I but [] instead of {}.
    – DGuys
    Nov 30, 2023 at 11:10
  • 1
    @DGuys no it won't that is the point of using [...] a version without cite for the list. You have probably not re-run latex. Nov 30, 2023 at 11:12

You must log in to answer this question.

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