我希望将文本换行到第 3 列,这样表格在文档中呈现的尺寸就不会太小(且不成比例)。这是我的代码:
\begin{table}[]
\resizebox{\textwidth}{!}{\begin{tabular}{|l|l|l|cc|}
\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{Species}} & \multicolumn{1}{c|}{\multirow{2}{*}{Strain}} & \multicolumn{1}{c|}{\multirow{2}{*}{Resistance mechanisms (if applicable)}} & \multicolumn{2}{c|}{Insecticide / n bioassays (n mosquitoes)} \\ \cline{4-5}
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{Chlorfenapyr} & Tralopyril \\ \hline
\multirow{3}{*}{\textit{An coluzzii}} & Banfora & Kdr995F, Kdr1570Y, Rdl296S & \multicolumn{1}{c|}{6 (420)} & \\ \cline{2-5}
& Tiefora & Kdr995F, Kdr1570Y, Rdl296G, CYP6P4 & \multicolumn{1}{c|}{6 (422)} & \\ \cline{2-5}
& VK7-2014 & Kdr995F, Kdr1570Y, Rdl296G, CYP6M2, CYP6P3, CYP6P4, CYP6Z1, GSTE2 & \multicolumn{1}{c|}{6 (412)} & 6 (421) \\ \hline
\multirow{2}{*}{\textit{An funestus}} & FANG & Susceptible & \multicolumn{1}{c|}{6 (416)} & \\ \cline{2-5}
& FUMOZ-R & CYP6P9A, CYP6P9B & \multicolumn{1}{c|}{6 (412)} & \\ \hline
\multirow{4}{*}{\textit{An gambiae}} & Bakaridjan & Kdr995F, Kdr1570Y, Rdl296G, CYP9K1, CYP6M2, CYP6P4 & \multicolumn{1}{c|}{9 (621)} & \\ \cline{2-5}
& Gauora-a ra & \begin{tabular}[c]{@{}l@{}}Kdr995F, Kdr995S, Rdl296S,\\ \\ CYP6Z1\end{tabular} & \multicolumn{1}{c|}{9 (413)} & 9 (650) \\ \cline{2-5}
& Kisumu & Susceptible & \multicolumn{1}{c|}{6 (401)} & 9 (660) \\ \cline{2-5}
& Tiassalé-13 & Kdr995F, Ace-1, CYP6M2, CYP6P3, CYP6P4, CYP6Z1 & \multicolumn{1}{c|}{6 (426)} & \\ \hline
\end{tabular}}
\end{table}
任何帮助/提示都值得感激!!
答案1
您不仅需要允许第 3 列单元格自动换行,还需要允许第 4 列和第 5 列的标题自动换行。tabular
我建议您使用表格型环境,目标宽度为\textwidth
,X
第 3 列使用的列类型。
我看不出这么多的\multirow
和\multicolumn{1}{c|}{...}
[双关语] 包装器有什么用处。把它们扔掉吧。我还会扔掉所有垂直规则,因为它们是不需要的,也不会被遗漏。我不会,再说一遍:不是,使用\resizebox
大锤。
\documentclass[10pt]{article} % or some other suitable document class and font size
%\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters as needed
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage{tabularx} % for 'X' col. type and 'tabularx' environment
\usepackage{ragged2e} % for '\RaggedRight' macro
\newcolumntype{L}{>{\RaggedRight}X} % disable full justification
% Calculate usable width of combination of columns 4 and 5:
\newlength\mylen
\settowidth\mylen{ChlorfenapyrTralopyril} % longest words in cols 4 and 5
\newcolumntype{C}{>{\Centering}p{\dimexpr\mylen+2\tabcolsep\relax}}
\usepackage[T1]{fontenc}
\begin{document}
\begin{table}[ht]
\setlength\tabcolsep{4pt} % default: 6pt
\caption{Bugs, bugs, and more bugs\strut} % set as needed
\begin{tabularx}{\textwidth}{@{} ll L cc @{}}
\toprule
Species & Strain & Resistance mechanisms (if applicable) &
\multicolumn{2}{C@{}}{Insecticide\slash $n$ bioassays ($n$ mosquitoes)} \\
\cmidrule(l){4-5}
& & & Chlorfenapyr & Tralopyril \\
\midrule
\textit{An coluzzii} & Banfora & Kdr995F, Kdr1570Y, Rdl296S & 6 (420) & \\
\addlinespace
& Tiefora & Kdr995F, Kdr1570Y, Rdl296G, CYP6P4 & 6 (422) & \\
\addlinespace
& VK7-2014 & Kdr995F, Kdr1570Y, Rdl296G, CYP6M2, CYP6P3, CYP6P4, CYP6Z1, GSTE2 & 6 (412) & 6 (421) \\
\addlinespace
\textit{An funestus} & FANG & Susceptible & 6 (416) & \\
\addlinespace
& FUMOZ-R & CYP6P9A, CYP6P9B & 6 (412) & \\
\addlinespace
\textit{An gambiae} & Bakaridjan & Kdr995F, Kdr1570Y, Rdl296G, CYP9K1, CYP6M2, CYP6P4 & 9 (621) & \\
\addlinespace
& Gauora-a ra & Kdr995F, Kdr995S, Rdl296S, CYP6Z1 & 9 (413) & 9 (650) \\
\addlinespace
& Kisumu & Susceptible & 6 (401) & 9 (660) \\
\addlinespace
& Tiassalé-13 & Kdr995F, Ace-1, CYP6M2, CYP6P3, CYP6P4, CYP6Z1 & 6 (426) & \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}