Graphics, Figures & Tables ⇒ cross-reference to cell inside table
cross-reference to cell inside table
I have a document with a very, very long table, over many pages. Therefore, making a reference to this table is quite ridiculous.
Is there a way to make a reference to a particular cell/row in LaTeX???
I tried making sections and subsections inside the table, but the compiler complains.
Thank you in advance. Cheers
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
cross-reference to cell inside table
But I can offer a workaround. You could mark a single cell or a row with a certain color by using the colortbl package. A small colored box in the describing text could be done with pgf/tikZ as some kind of reference. Consider the following example.
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{array,multirow}
\usepackage[svgnames,table]{xcolor}
\usepackage{tikz}
\usepackage{blindtext}
\parindent0em
\begin{document}
\blindtext
\begin{table}[!ht]
\caption{A table with a colored row for reference}\label{tab:colorrow}
\centering
\begin{tabular}{*{4}{c}} \hline
Some Text & Some Text & Some Text & Some Text \\ \hline
Some Values & Some Values & Some Values & Some Values \\
Some Values & Some Values & Some Values & Some Values \\
\rowcolor{gray!25}
Some Values & Some Values & Some Values & Some Values \\
Some Values & Some Values & Some Values & Some Values \\
Some Values & Some Values & Some Values & Some Values \\
Some Values & Some Values & Some Values & \cellcolor{gray!50} Some Values \\ \hline
\end{tabular}
\end{table}
As seen in Table~\ref{tab:colorrow}, the values of a row could be referenced by color marks (\,\tikz\fill[gray!25] (0,0) rectangle (16pt,8pt);\,). Even single cells could be pointed out (\,\tikz\fill[gray!50] (0,0) rectangle (16pt,8pt);\,).
\medskip
\blindtext
\end{document}
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: cross-reference to cell inside table
Thank you for your proposition, but this is not precisely what I want. But through your comments, I search some more, and found a solution that suits me very well.
Everyone using LaTeX knows that you can label any part of text where LaTeX generates a number, like a table, equation, section... But my problem is that I want to make a reference to part of a table, which I cannot create a section from within.
My solution is to use the \phantomsection \label{mylabel} anywhere in my table. The \phantomsection is part of the hyperref package, and generates a phanton section (duh!!!) within my table.
It seems to work well. Cheers