Graphics, Figures & TablesLabel/Numbering inside a table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
nasask8r
Posts: 1
Joined: Thu Mar 24, 2011 6:12 am

Label/Numbering inside a table

Post by nasask8r »

Hi everyone,

I would like to create a table with labels for an element in each line -- but I want these labels to start at 1 without interfering with the rest of my labels for figures, tables, etc. I'm trying to create a table for a list of requirements (one on each line), and each requirement is assigned a numerical ID.

I'm using the tabularx environment because I'd like to stretch the table across the entire page.

For example, I have:

Code: Select all

\documentclass[pdftex]{book}
\usepackage{tabularx}
\begin{document}
\begin{table} \label{tab
\begin{tabularx}{\linewidth}{|c|X|}
\em{ID} & \em{Name} \\
1.0 & Requirement 1 \\
1.1 & Subrequirement 1 \\
2.0 & Requirement 2 \\
%...
\end{tabularx}
\caption{My list of requirements}
\label{tab:reqs}
\end{table}
The table above is Table \ref{tab:reqs}.
\end{document}
I want to be able to make a reference to Requirement 1 (producing 1.0), a reference to Requirement 2 (producing 2.0), etc. later in the text.

I've tried putting a label after "Requirement 1" and referencing to it in the ID column, but shows nothing in the ID column or in subsequent references (outside the table doesn't generate anything either).

I'm using pdflatex and I don't seem to be getting any warnings or errors indicating that it cannot find the label.

Thanks in advance,
Alex

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply