我正在尝试排版一个横向表格,自动对行进行编号,对列进行子编号。我使用了这个答案对行进行编号,但这样只能得到行标题编号。我希望列有与每行对应的子编号(例如 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}