我想要绘制下表:
我使用以下乳胶代码来制作上表:
\documentclass[12pt,twoside,a4paper]{book}
\usepackage[left=.45in,right=.45in,top=.6in,bottom=.6in,headheight=14.5pt]{geometry}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|c|c|c|c|c|c|c|}\hline
{\bf Prefix} & {\bf Type } & {\bf No of digits} & {\bf 2nd digits} & {\bf Text number} & {\bf Text-number} & {\bf Text digit} \\ \hline
\multicolumn{2}{|c|}{\multirow{2}{*}{12-14}} & Text-MCCC\\ \cline{3-3}
\multicolumn{2}{|c|}{} & Text-VSSS \\\hline
\end{tabular}
\end{document}
得出的结果为:
有谁能告诉我如何绘制我想要的表格。谢谢
答案1
这应该可以让你开始了。缺少的行留给你练习。
\documentclass[12pt,twoside,a4paper]{book}
\usepackage[left=.45in,right=.45in,top=.6in,bottom=.6in,headheight=14.5pt]{geometry}
\usepackage{fmtcount} % for \ordinalnum
\usepackage{array,multirow}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{tabular}{|c|c|C{1.2cm}|C{1.2cm}|c|c|C{1.2cm}|}
\hline
\textbf{Prefix} & \textbf{Type} & \textbf{No of digits} & \textbf{\ordinalnum{2} digits}
& \textbf{Text number} & \textbf{Text-number} & \textbf{Text digit} \\
\hline
\multirow{4}{*}{12-14} & \multirow{4}{*}{Text-MCCC} & \multirow{4}{*}{16} & 1
& \ordinalnum{2}-\ordinalnum{3} & \multirow{4}{*}{Long text here} & \multirow{4}{1.2cm}{\centering Text with digits}\\
\cline{4-5}
& & & 2 & \ordinalnum{2}-\ordinalnum{4} & & \\
\cline{4-5}
& & & 3 & \ordinalnum{2}-\ordinalnum{5} & & \\
\cline{4-5}
& & & 4 & \ordinalnum{2}-\ordinalnum{6} & & \\
\hline
\end{tabular}
\end{document}
答案2
我确实认为在 ConTeXt 中创建这样的表格比在 LaTeX 中容易得多。例如,您可以使用 Natural Tables(其工作原理与 HTML 表格非常相似)创建这样的表格。请注意,语法易读,并且内容和表示清晰分离。
\startsetups table:style
\setupTABLE[row][1][style=bold]
\setupTABLE[each][each][align={middle,lohi}, offset=0.5em]
\setupTABLE[column][last][width=1.5cm]
\stopsetups
\starttext
\bTABLE[setups={table:style}]
\bTR
\bTD Prefix \eTD
\bTD Type \eTD
\bTD No of \\ digits \eTD
\bTD 2nd \\ digits \eTD
\bTD Text number \eTD
\bTD Text-number \eTD
\bTD Text \\ digit \eTD
\eTR
\bTR
\bTD[nr=4] 12-14 \eTD
\bTD[nr=4] Text-MCCC \eTD
\bTD[nr=4] 16 \eTD
\bTD 1 \eTD
\bTD 2nd--3rd \eTD
\bTD[nr=4] Long text here \eTD
\bTD[nr=4] Text with digits \eTD
\eTR
\bTR
\bTD 2 \eTD
\bTD 2nd--4th \eTD
\eTR
\bTR
\bTD 3 \eTD
\bTD 2nd--5th \eTD
\eTR
\bTR
\bTD 4 \eTD
\bTD 2nd--6th \eTD
\eTR
\bTR
\bTD[nr=2] 4 \eTD
\bTD[nr=2] Text-VSSS \eTD
\bTD 13 \eTD
\bTD -- \eTD
\bTD[nr=2] 2nd--6th \eTD
\bTD 7th--12th \eTD
\bTD Text with digits\eTD
\eTR
\bTR
\bTD 16 \eTD
\bTD -- \eTD
\bTD 7th--15th \eTD
\bTD Text with digits \eTD
\eTR
\eTABLE
\stoptext
这使