我的代码如下
\begin{table}[H]
\begin{tabular}{|c|c|c|c|}
\hline
\rule[-1ex]{0pt}{2.5ex} JP1/JP14 Pins 1 – 8 & Description & JP1/JP14 Pins 9 -16 & Description \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin1 & Ground & Pin9 & D2 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin2 & VCC (+5) & Pin10 & D3 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin3 & Contrast & Pin11 & D4 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin4 & Data/Command (R/S) & Pin12 & D5 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin5 & Read/Write (W) & Pin13 & D6 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin6 & Enable (E1) & Pin14 & D7 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin7 & D0 & Pin15 & VCC (LEDSV+) \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin8 & D1 & Pin16 & Ground \\
\hline
\end{tabular}
\caption{Pin configuration of LCD}
\end{table}
答案1
较小版本,行数较少,并有印刷错误修正:
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{>{Pin }l<{:}@{ }l>{Pin }l<{:}@{ }l}
\toprule
\multicolumn{2}{l}{JP1/JP14, Pins 1--8} &
\multicolumn{2}{l}{JP1/JP14, Pins 9--16} \\
\midrule
1 & Ground & 9 & D2 \\
2 & VCC (+5) & 10 & D3 \\
3 & Contrast & 11 & D4 \\
4 & Data/Command (R/S) & 12 & D5 \\
5 & Read/Write (W) & 13 & D6 \\
6 & Enable (E1) & 14 & D7 \\
7 & D0 & 15 & VCC (LEDSV+) \\
8 & D1 & 16 & Ground \\
\bottomrule
\end{tabular}
\caption{Pin configuration of LCD}
\end{table}
\end{document}
包含两个表格和上述标题的变体:
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption}
\begin{document}
\begin{table}
\centering
\caption{Pin configuration of LCD}
\begin{tabular}{>{Pin }l<{:}@{ }l}
\toprule
\multicolumn{2}{l}{JP1/JP14, Pins 1--8} \\
\midrule
1 & Ground \\
2 & VCC (+5) \\
3 & Contrast \\
4 & Data/Command (R/S) \\
5 & Read/Write (W) \\
6 & Enable (E1) \\
7 & D0 \\
8 & D1 \\
\bottomrule
\end{tabular}%
\quad
\begin{tabular}{>{Pin }l<{:}@{ }l}
\toprule
\multicolumn{2}{l}{JP1/JP14, Pins 9--16} \\
\midrule
9 & D2 \\
10 & D3 \\
11 & D4 \\
12 & D5 \\
13 & D6 \\
14 & D7 \\
15 & VCC (LEDSV+) \\
16 & Ground \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
不清楚“不完整”是什么意思。假设表格扩展了水平维度,我们可以纠正它,收紧列([H]
删除选项,因为它需要额外的包):
\documentclass{article}
\begin{document}
\begin{table}
\begin{tabular}{|c|c|c|c|}
\hline
%\rule[-1ex]{0pt}{2.5ex} JP1/JP14 Pins 1 – 8 & Description & JP1/JP14 Pins 9 -16 & Description \\
\rule[-1ex]{0pt}{2.5ex}\begin{tabular}{c} JP1/JP14 \\Pins 1 – 8\end{tabular} & Description & \begin{tabular}{c}JP1/JP14\\ Pins 9 -16 \end{tabular}& Description \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin1 & Ground & Pin9 & D2 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin2 & VCC (+5) & Pin10 & D3 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin3 & Contrast & Pin11 & D4 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin4 & Data/Command (R/S) & Pin12 & D5 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin5 & Read/Write (W) & Pin13 & D6 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin6 & Enable (E1) & Pin14 & D7 \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin7 & D0 & Pin15 & VCC (LEDSV+) \\
\hline
\rule[-1ex]{0pt}{2.5ex} Pin8 & D1 & Pin16 & Ground \\
\hline
\end{tabular}
\caption{Pin configuration of LCD}
\end{table}
\end{document}