有没有办法在不使用横向布局的情况下在 A4 页面上显示这个宽表?
\documentclass[12pt,addpoints]{exam}
\usepackage[a4paper,left=1.5cm, right=1.5cm, top=3.5cm,bottom=3cm]{geometry}
\usepackage{tabularx}
\usepackage{hyperref}
\begin{document}
\begin{table}[!ht]
\tiny
\centering
\begin{tabularx}{18cm}{*{26}{l}}
\hline
Hostaddress &
2 &
0 &
0 &
1 &
: &
0 &
1 &
9 &
8 &
: &
0 &
2 &
0 &
0 &
: &
1 &
0 &
0 &
0 &
: &
: &
C &
C &
C &
C
\\ \hline
binary &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0010,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0001,charsize = 5pt]{} &
: &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0010,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=1001,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=1000,charsize = 5pt]{} &
: &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0010,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
: &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0001,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=0000,charsize = 5pt]{} &
: &
: &
\TextField[name=2,height=0.3cm, width=0.6cm, value=1100,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=1100,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=1100,charsize = 5pt]{} &
\TextField[name=2,height=0.3cm, width=0.6cm, value=1100,charsize = 5pt]{}
\\ \hline
\end{tabularx}
\end{table}
\end{document}
答案1
- 表中
tabularx
至少有一列必须是X
类型。 - 您可以通过设置
\tabcolsep
为例如 2pt 来减少列之间的间隔。 - 两个连续的细胞会
:
尝试合并为一个。
考虑上述因素并使用\scriptsize
字体大小,您将获得:
(灰线表示页面边框)
\documentclass[12pt,addpoints]{exam}
\usepackage[a4paper,left=1.5cm, right=1.5cm, top=3.5cm,bottom=3cm]{geometry}
\usepackage{tabularx}
\usepackage{hyperref}
\begin{document}
\begin{table}[!ht]
\scriptsize
\centering
\setlength\tabcolsep{2pt}
\begin{tabularx}{\linewidth}{@{} X*{24}{c} @{}}
\hline
Hostaddress &
2 &
0 &
0 &
1 &
: &
0 &
1 &
9 &
8 &
: &
0 &
2 &
0 &
0 &
: &
1 &
0 &
0 &
0 &
:: &
C &
C &
C &
C
\\ \hline
binary &
\TextField[name=2,height=1em, width=2em, value=0010,charsize = 5pt]{}
&
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0001,charsize = 5pt]{} &
: &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0010,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=1001,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=1000,charsize = 5pt]{} &
: &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0010,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,,height=1em, width=2em, value=0000,charsize = 5pt]{} &
: &
\TextField[name=2,height=1em, width=2em, value=0001,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=0000,charsize = 5pt]{} &
:: &
\TextField[name=2,height=1em, width=2em, value=1100,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=1100,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=1100,charsize = 5pt]{} &
\TextField[name=2,height=1em, width=2em, value=1100,charsize = 5pt]{}
\\ \hline
\end{tabularx}
\end{table}
\end{document}