![如何向现有的表格环境添加列?](https://linux22.com/image/403086/%E5%A6%82%E4%BD%95%E5%90%91%E7%8E%B0%E6%9C%89%E7%9A%84%E8%A1%A8%E6%A0%BC%E7%8E%AF%E5%A2%83%E6%B7%BB%E5%8A%A0%E5%88%97%EF%BC%9F.png)
我正在创建一个包含表格的答题表,其中有一个部分从 4 列变成了 7 列。我该如何增加表格中的列数,以便我可以从问题 18 开始继续使用该表格?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[document]{ragged2e}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{array}
\usepackage{color}
\usepackage{enumitem}
\usepackage[export]{adjustbox}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\begin{document}
\vspace{0.3cm}
\begin{center}
\textbf{Response sheet}
\end{center}
\begin{Form}
\def\arraystretch{2}
\def\DefaultHeightofText{12pt}
% Use the following line to create the fillable textbox for responses
% \mbox{\TextField[bordercolor=, name = four,width=13cm]{}}
\begin{tabular}{ |p{0.5cm}|p{0.5cm}|p{12cm}|p{1cm}| }
\hline
\multicolumn{4}{|l|}{\mbox{\TextField[bordercolor=, name = Name,width=12cm]{Name:}}} \\
\hline
8 & a) & \mbox{\TextField[bordercolor=,name = 8a,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8a,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
& b) & \mbox{\TextField[bordercolor=,name = 8b,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8b,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
& c) & \mbox{\TextField[bordercolor=,name = 8c,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8c,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
10 & a) & \mbox{\TextField[bordercolor=,name = 8a,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8a,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
& b) & \mbox{\TextField[bordercolor=,name = 8b,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8b,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
11 & a) & \mbox{\TextField[bordercolor=,name = 8c,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8c,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
13 & a) & \mbox{\TextField[bordercolor=,name = 8a,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8a,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
& b) & \mbox{\TextField[bordercolor=,name = 8b,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8b,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
& c) & \mbox{\TextField[bordercolor=,name = 8c,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8c,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
15 & a) & \mbox{\TextField[bordercolor=,name = 8a,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8a,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
& b) & \mbox{\TextField[bordercolor=,name = 8b,width=12cm, height = 0.6cm,
multiline=true, maxlen = 50]{}} &
\mbox{\TextField[bordercolor=,name = grade8b,width=0.5cm, height = 0.6cm, maxlen = 4]{}
/1} \\
\hline
\end{tabular}
\end{Form}
答案1
找到MWE
下面修改的部分:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[document]{ragged2e}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{array}
\usepackage{color}
\usepackage{enumitem}
\usepackage[export]{adjustbox}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{makecell}%
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\begin{document}
\vspace{0.3cm}
\begin{center}
\textbf{Response sheet}
\end{center}
\begin{Form}
\def\arraystretch{2}
\def\DefaultHeightofText{12pt}
% Use the following line to create the fillable textbox for responses
% \mbox{\TextField[bordercolor=, name = four,width=13cm]{}}
\begin{tabular}{ |c|c|c|c|c|c|c|c|}
\Xhline{0.5pt}
13 &a & & & & & &/1\\
\cline{2-8}
&b & & & & & &/1\\
\cline{2-8}
&c & & & & & &/1\\
\Xhline{0.5pt}
15 &a & & & & & &/1\\
\cline{2-8}
&b & & & & & &/1\\
\Xhline{0.5pt}
18 & &Hospital &$r=distance$ from &\multicolumn{2}{c|}{\multirow{2}{*}{$d=depth$ of
sediments (m)}} &\multirow{2}{*}{$V_s30$ (m/s)} &\\
& &name &epicenter (km) &\multicolumn{1}{c}{} & & &\\
\cline{2-8}
& &USC &(a) &\multicolumn{2}{c|}{(b)} &(c) &/3 \\
& &University & &\multicolumn{1}{c}{} & & &\\
& &Hopsital & &\multicolumn{1}{c}{} & & &\\
\hline
19 & &Hospital &$\mu$ &PGA (g) &PGA (cm/s$^{2}$) &IMM &\\
\hline
& &USC &(a) &(b) &(c) &(d) &/4\\
& &University & & & & &\\
& &Hospital & & & & &\\
\hline
\end{tabular}
\end{Form}
\end{document}
输出