[Tex/LaTex] How to suppress caption numbering in a table

captionsfloatsnumbering

How can the auto-numbering on table captions be suppressed? For example, I have a table:

\section{Data}
\begin{table}[h]
\setlength{\arrayrulewidth}{1.5px}
\centering
\begin{tabular}{lcccc} \bottomrule 
\bottomrule
\end{tabular}
\caption{This is my caption.}
\end{table}

I just want the caption to read This is my caption. However, when I compile this code into a PDF file my table is automatically named Table 1. This is my caption. I've tried using \caption*, to suppress the auto-generated Table 1., but this does not solve my problem. Can anyone help?

Best Answer

You can suppress the caption label in saveral ways using features provided by the caption package:

  1. Using \caption* instead of \caption:

    \documentclass{article}
    \usepackage{caption}
    
    \begin{document}
    
    \begin{table}[h]
      \centering
      \begin{tabular}{c} 
        text1\\
        text2
      \end{tabular}
      \caption*{This is my caption.}
    \end{table}
    
    \end{document}
    
  2. Using the option labelformat=empty for \captionsetup.

    \documentclass{article}
    \usepackage{caption}
    
    \captionsetup[table]{labelformat=empty}
    
    \begin{document}
    
    \begin{table}[h]
      \centering
      \begin{tabular}{c} 
        text1\\
        text2
      \end{tabular}
      \caption{This is my caption.}
    \end{table}
    
    \end{document}
    

Since I used table as optional argument for \captionsetup, this change will only affect the table environments; of course, you can use figure instead (to affect only the figure environment), or no optional argument at all, which means that the change will affect all your floating objects.

Also, as I used \captionsetup in the preamble, the change will affect all the (in this case) table environments in your document; if you want the change to affect only a particular table environment, you can use

\captionsetup{labelformat=empty} 

inside that particular table environment.

The result after compilation of any of my example codes is

enter image description here