如何自動對 [sideways] 表格中的行和列進行編號

如何自動對 [sideways] 表格中的行和列進行編號

我正在嘗試排版橫向表格,自動對行進行編號並在列中進行子編號。我用了這個答案對行進行編號,但這只能讓我取得行標題編號。我希望各列具有與每行相對應的子編號(例如 1. 行標題 1a. 大約兩行...、1b....、1c....)。 MWE 保留了我的文件所需的一些格式,因此某些元素(例如橫向的表格)可能不是必需的。我的嘗試導致在行中繼續計數,而不是獲取子數字(例如,我在第一行中得到 1.2.3.4.,然後第二行從 5 開始。)我是 LaTeX 的新手,這是我的第一篇文章,如果這是顯而易見的或我在其他地方錯過了答案,我很抱歉。

微量元素:

\documentclass[11pt,a4paper,openright,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{rotating}

\renewcommand{\arraystretch}{1.5}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcounter{rowcount}
\setcounter{rowcount}{0}

\begin{document}
\begin{sidewaystable}
\centering
\caption{An Appropriate Table Title}
\small
\label{tab:valued_language_capabilities}
\begin{tabular}{@{\stepcounter{rowcount}\therowcount.\hspace*{\tabcolsep}}L{40mm}L{45mm}L{45mm}L{45mm}}
\multicolumn{1}{>{\makebox[3em][r]{}}l}{}   & column header & column header & column header\\
\hline
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
\hline
\end{tabular}
\end{sidewaystable}
\end{document}

編譯為:

對行進行編號,但每列中的行中沒有子編號

答案1

像這樣? (我\hskip只是為了減少字母數量。)

\documentclass[11pt,a4paper,openright,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{rotating}

\renewcommand{\arraystretch}{1.5}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\newcounter{colcount}[rowcount]% auto reset
\renewcommand{\thecolcount}{\therowcount\alph{colcount}}

\begin{document}
\begin{sidewaystable}
\centering
\caption{An Appropriate Table Title}
\small
\label{tab:valued_language_capabilities}
\begin{tabular}{@{\stepcounter{rowcount}\therowcount.\hskip\tabcolsep}L{40mm}
  @{\hskip\tabcolsep\stepcounter{colcount}\thecolcount\hskip\tabcolsep}L{45mm}
  @{\hskip\tabcolsep\stepcounter{colcount}\thecolcount\hskip\tabcolsep}L{45mm}
  @{\hskip\tabcolsep\stepcounter{colcount}\thecolcount\hskip\tabcolsep}L{45mm}}
\multicolumn{1}{>{\makebox[3em][r]{}}l}{}   & column header & column header & column header\\
\hline
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
row header  & approximately two lines of row subcontent & approximately two lines of row subcontent & approximately two lines of row subcontent\\
\hline
\end{tabular}
\end{sidewaystable}
\end{document}

相關內容