我的程式碼如下
\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}