Graphics, Figures & TablesSkip labeling a single table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
zhiwanxu
Posts: 16
Joined: Thu Aug 07, 2008 5:14 pm

Skip labeling a single table

Post by zhiwanxu »

Hi,

I use \setcounter{section}{3}, \usepackage[all]{hypcap}, and \caption commands to label and anchor link position of my tables to Table 3.1, Table 3.2....etc. If I don't want to label the first table and want to label from the second table as Table 3.1, what should I do? Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Skip labeling a single table

Post by localghost »

You could use the caption package which provides a starred version of the \caption command. Tables then will only get a caption but no label.


Best regards
Thorsten¹
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Skip labeling a single table

Post by gmedina »

Hi,

will the first table have a caption or not?

Edit: I didn't realize that localghost had already answered. However I would like to suggest another option, but my answer depends on the reply to the question I asked.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
zhiwanxu
Posts: 16
Joined: Thu Aug 07, 2008 5:14 pm

Re: labeling table

Post by zhiwanxu »

The first table doesn't have a caption, what's your other option?

Thanks.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Skip labeling a single table

Post by gmedina »

I apologize for the late response, but I've been really busy. Here's the other option: to use the \capstartfalse and \capstarttrue commands provided by the hypcap package, as the following simple example suggests:

Code: Select all

\documentclass{article}
\usepackage{hyperref}
\usepackage[all]{hypcap}[2008/09/08]

\begin{document}

\section{Dummy section}

\capstartfalse
%A table without caption
\begin{table}[!ht]
  \centering
  \begin{tabular}{cc}\hline
    column1 table 1 & column2 table 1\\\hline
  \end{tabular}
\end{table}

\vspace{1cm}

\capstarttrue
\begin{table}[!ht]
  \centering
  \begin{tabular}{cc}\hline
    column1 table 2 & column2 table 2\\\hline 
  \end{tabular}
  \caption{A table with caption}
\end{table}

\vspace{1cm}

\begin{table}[!ht]
  \centering
  \begin{tabular}{cc}\hline
    column1 table 3 & column2 table 3\\\hline 
  \end{tabular}
  \caption{Another table with caption}
\end{table}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
zhiwanxu
Posts: 16
Joined: Thu Aug 07, 2008 5:14 pm

Re: labeling table

Post by zhiwanxu »

Thank you very much for your help. I will try your suggestion to see if it works.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: labeling table

Post by sommerfee »

Do you use the caption package 3.1? Then I would simple remove the usage of the hypcap package. My caption package v3.1 has an own "hypcap" feature which have no problems with situations like this.

Regards,
Axel
Last edited by sommerfee on Wed Mar 04, 2009 8:25 pm, edited 1 time in total.
zhiwanxu
Posts: 16
Joined: Thu Aug 07, 2008 5:14 pm

Skip labeling a single table

Post by zhiwanxu »

Thanks for all your suggestions. I prefer keep hypcap package so that I can anchor my tables the way I want, to the top. I tried gmedina's suggestion but didn't work. The following is my style file, I guess maybe the problem is because of packages conflict. Any idea? Thanks for your help.

Code: Select all

%% This is file `datacomp.sty'
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{datacomp}
\usepackage{times}
\usepackage{color}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{lscape}
\usepackage[hyperindex, pdfmark, colorlinks, linkcolor=blue, citecolor=red, urlcolor=blue]{hyperref}
\usepackage[all]{hypcap}
...
I forgot to mention that I received "Undefined control sequence" of \capstartfalse and \capstarttrue when I ran gmedina's method.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Skip labeling a single table

Post by sommerfee »

zhiwanxu wrote:I prefer keep hypcap package so that I can anchor my tables the way I want, to the top.
If you use the caption package v3.1 (which you seem to use anyway), this will be done without hypcap package, too. If you load the hypcap package additionally, the caption package will still provide the "core" code of this feature (means: The core code of the hypcap package will be replaced by code of the caption package), the only difference is that the hypcap package now controls *when* and *how* the feature will be used - and the way the hypcap package does it causes your problem.

So I still suggest not using the hypcap package in your case. If the caption package you use is the recent one (v3.1) you will still get the hyperlink anchors pointing to the top of the figures and tables.
I forgot to mention that I received "Undefined control sequence" of \capstartfalse and \capstarttrue when I ran gmedina's method.
\capstartfalse and \capstarttrue are offered by the very recent version of hypcap only. So I assume your version of the hypcap package is an older one.

Regards,
Axel
Post Reply