테이블의 열 이름을 어떻게 상호 참조할 수 있나요?

테이블의 열 이름을 어떻게 상호 참조할 수 있나요?

내 라텍스 문서에 꽤 큰 표가 있고 표와 함께 제공되는 텍스트에 다음과 같이 말하고 싶습니다.

표 III의 A열에 제시된 바와 같이 ...

테이블을 상호 참조하는 방법을 알고 있는데, 열 이름을 상호 참조하려면 어떻게 해야 합니까? 내가 그렇게 하고 싶은 이유는 열 이름이 변경될 수 있고 열 이름을 사용한 모든 인스턴스에 대해 내 문서를 검색하고 싶지 않기 때문입니다.

내 테이블의 단순화된 버전은 다음과 같습니다.

\begin{table}[htbp]
\caption{The caption}
\label{tbl:data}
\tiny
\begin{tabularx}{\columnwidth}{l X c c c c c}
\textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} & \textbf{E} & \# Changed &F\\
\hline
\multirow{4}{*}{X} & X1 & 1 & 2 & 3 & 4 & 5\\
& X2 & 6 & 7 & 8 & 9 &\\
& X3 & 10 & 11 & 12 & 13 & 14\\
& X4 & 15 & 16 & 17 & 18 & 19\\
\hline
\end{tabularx}
\end{table}

답변1

.aux이는 '모든' 열 제목과 함께 작동하고 에 가짜 라벨을 작성 하고 로 참조하는 버전입니다 \nameref*.

열 제목이 순수 A등인 경우 카운터 기반 접근 방식이 더 좋습니다!

\documentclass{article}

\usepackage{tabularx}
\usepackage{multirow}

\newcommand{\columnheaddisplaystyle}[1]{%
  \textbf{#1}%
}

\makeatletter
\newcommand{\labelthis}[2]{%
  \columnheaddisplaystyle{#2}%
  \immediate\write\@auxout{%
    \string\newlabel{#1}{{}{}{#2}{}}
  }%
}

\usepackage{hyperref}

\makeatletter


\begin{document}

\begin{table}[htbp]
\caption{The caption} 
\label{tbl:data}
\tiny
\begin{tabularx}{\columnwidth}{l X c c c c c}
\labelthis{mycolumn}{A}  & \textbf{B} & \textbf{C} & \textbf{D} & \textbf{E} & \# Changed &F\\
\hline
\multirow{4}{*}{X} & X1 & 1 & 2 & 3 & 4 & 5\\
& X2 & 6 & 7 & 8 & 9 &\\
& X3 & 10 & 11 & 12 & 13 & 14\\
& X4 & 15 & 16 & 17 & 18 & 19\\
\hline
\end{tabularx}
\end{table}

As presented in column \nameref*{mycolumn} in Table \ref{tbl:data}, it is ...

\end{document}

관련 정보