1

I want to include a table at the beginning of my document, which is not counted. So, the second table starts with number 1. All the following tables will then continue with number 2, 3 etc.

How can I do that in latex?

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\documentclass[12pt]{report}

\begin{document}

\begin{table}[]
    \centering
    \begin{tabular}{c|c}
         &  \\
         & 
    \end{tabular}
    \caption*{Should have no numbering}
\end{table}

\begin{table}[]
    \centering
    \begin{tabular}{c|c}
         &  \\
         & 
    \end{tabular}
    \caption{Should be table 1}
    \label{tab:my_label}
\end{table}

\end{document}
6
  • Hi and welcome. Please give a fully compilable code.
    – AndréC
    Jul 23 '20 at 20:12
  • What gets numbered is captions. No caption, no number.
    – Don Hosek
    Jul 23 '20 at 20:12
  • you can achieve by setting the counter value of the tables after your first table back to 0, as follows: \setcounter{table}{0}
    – G. de Man
    Jul 23 '20 at 20:14
  • I am sorry, I did not know my code was not working. The setcounter option works! Thank you so much!
    – es_dutch
    Jul 23 '20 at 20:17
  • 1
    @G.deMan - Your piece of advice does not let the OP achieve his/her goal of generating an unnumbered caption via \caption*.
    – Mico
    Jul 23 '20 at 20:41
5

In order for \caption* to produce an unnumbered caption, the caption package has to be loaded.

enter image description here

With this setup, there's absolutely no need to fiddle with the table counter.

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{caption} % <-- this is important

\begin{document}
\begin{table}[h]\caption*{Should have no numbering}\end{table}
\begin{table}[h]\caption{Should be table 1}\label{tab:my_label}\end{table}
\end{document}
5
  • caption automatically adds some extra vertical spaces above and below \caption, hence changes the default caption style. Here \usepackage[strut=false]{caption} is more recommended. Jul 23 '20 at 22:55
  • @muzimuzhiZ - Thanks. I guess that what is "recommended" depends very much on what one wants to achieve, typographically speaking. Suppose the objective is to emulate the "look" produced if the caption package isn't loaded, in terms of the vertical distance between the caption and the \hline at the top of the subsequent tabular environment. In that's the case, then running \usepackage[skip=0pt]{caption} is probably "recommended".
    – Mico
    Jul 23 '20 at 23:15
  • Regarding the \[above|below]captionskip you mentioned, I think \usepackage[strut=false, figureposition=below]{caption} emulates better. That is, in standard document classes, \abovecaptionskip is always 10pt and \below... is always 0pt. But by default caption exchanges the value of them for \caption used in figure float env. Package option figureposition=below restores the exchange. If strict emulation is really needed, one might need option style=base as well. Jul 23 '20 at 23:34
  • @muzimuzhiZ - The one and only point I tried to make in my answer is that if the OP wants to create an unnumbered caption, then \caption* can only do this job if the caption package is loaded. AFAICT, the discussion in the preceding comments neither detracts from nor adds to this main point. Let's see if the OP weighs in and provides information about his/her preferences for the "look" of captions,
    – Mico
    Jul 23 '20 at 23:44
  • 1
    I agree with you. My previous comment is already off-topic. Jul 24 '20 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.