GeneralHow do I Label a table and use ref to show Table6.1

LaTeX specific issues not fitting into one of the other forums of this category.
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

How do I Label a table and use ref to show Table6.1

Post by akira32 »

How do I Label a table and use ref to show Table6.1,like figure mechanism:
I want to type some words in the bottom of table like figure.

Code: Select all

\begin{figure}[H]
\centerline{\epsfig{file=eps/6-diff_tech_1024x512_sv_with_UI.eps,width=1.25\linewidth}}
\caption{\small Shadow Volumes, FPS=8.69}
\label{fig:6-diff_tech_1024x512_sv_with_UI}
\end{figure}

In Figure \ref{fig:6-diff_tech_1024x512_CSM_with_UI} and Figure \ref{fig:6-diff_tech_1024x512_ASM_with_UI},

Code: Select all

\begin{center}
  \begin{tabular}{ l | c || r | }
    \hline
    1 & 2 & 3 \\ \hline
    4 & 5 & 6 \\ \hline
    7 & 8 & 9 \\
    \hline
  \end{tabular}
\end{center}

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How do I Label a table and use ref to show Table6.1

Post by Stefan Kottwitz »

Hi akira32,

use the table environment similar to figure or \captionof with the caption package. Have a look at this example:

Code: Select all

\documentclass[a4paper,10pt]{book}
\usepackage{caption}
\begin{document}
\chapter{One}
\section{one}
\begin{center}
  \begin{tabular}{ l | c || r | }
    \hline
    1 & 2 & 3 \\ \hline
    4 & 5 & 6 \\ \hline
    7 & 8 & 9 \\
    \hline
  \end{tabular}
  \captionof{table}{test table}\label{tab:1}
\end{center}
See table \ref{tab:1}.
\end{document}
Stefan
LaTeX.org admin
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

Re: How do I Label a table and use ref to show Table6.1

Post by akira32 »

I add the line of \usepackage{caption} to preamble.
When I build, MiTex seems to download some thing.
But I compiled agagin, it appear two errors and one warning as the picture I attached.
Could you tell how to solve it.
Attachments
One waring
One waring
onewarningofcaption.jpg (17.22 KiB) Viewed 9498 times
two errors when I compile
two errors when I compile
twoerrorofcaption.jpg (29.91 KiB) Viewed 9500 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How do I Label a table and use ref to show Table6.1

Post by Stefan Kottwitz »

caption is a very good package, but you can fix this problem by another very small package. Try

Code: Select all

\usepackage{capt-of}
instead of \usepackage{caption}.

In order to get the caption package working I would have to see your complete preamble.

Stefan
LaTeX.org admin
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

How do I Label a table and use ref to show Table6.1

Post by akira32 »

Stefan_K wrote:caption is a very good package, but you can fix this problem by another very small package. Try

Code: Select all

\usepackage{capt-of}
instead of \usepackage{caption}.

In order to get the caption package working I would have to see your complete preamble.

Stefan
It appear many error messages.
Attachments
capt-of error
capt-of error
caption_error.jpg (22.48 KiB) Viewed 9484 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How do I Label a table and use ref to show Table6.1

Post by Stefan Kottwitz »

Also with capt-of use \captionof:

Code: Select all

\captionof{table}{test table}
\caption only for standard figure or table environments, \captionof for the tabular inside center or similar.

Stefan
LaTeX.org admin
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

How do I Label a table and use ref to show Table6.1

Post by akira32 »

Stefan_K wrote:Also with capt-of use \captionof:

Code: Select all

\captionof{table}{test table}
\caption only for standard figure or table environments, \captionof for the tabular inside center or similar.

Stefan
The errors still appear.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How do I Label a table and use ref to show Table6.1

Post by Stefan Kottwitz »

Hi akira32,
akira32 wrote:The errors still appear.
it's not possible, if you replaced \caption by \captionof then that errors cannot appear again, because those errors concerned caption but not captionof. Of course we want to help you, just show us the new error messages (or the logfile) and perhaps the code that causes the errors.

Stefan
LaTeX.org admin
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

Re: How do I Label a table and use ref to show Table6.1

Post by akira32 »

I attched the my preamble and log.
Attachments
AkiraShadow.tex
AkiraShadow.tex is my preamble
(2 KiB) Downloaded 274 times
results.log
results.txt's log file
(65.57 KiB) Downloaded 355 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Re: How do I Label a table and use ref to show Table6.1

Post by Stefan Kottwitz »

Hi,

it seems to me like you just compiled one chapter (results.tex), not the complete document. A single chapter cannot be compiled. results.log shows that \begin{document} is missing etc. Compile the complete document and send that log.

Regarding \caption and \captionof I still recommend my message above of Sun Jul 06, 2008 2:18 pm.

Stefan
LaTeX.org admin
Post Reply