[英]Multirow multicolumn in overleaf
I want to make a table like this in overleaf using multi row and column.我想使用多行和多列在背面制作这样的表格。 Unable to figure out how to use these commands
无法弄清楚如何使用这些命令
for make a css like the image.制作像图像一样的 css。 you can use this style:
你可以使用这种风格:
table {
border-top: 1px solid black;
border-collapse: collapse;
}
th{
border-right: 1px solid black;
border-bottom: 1px solid black;
}
th:last-child {
border-right: none;
}
td{
border-right: 1px solid black;
}
td:last-child {
border-right: none;
}
</style>
You can use the tabularx
package, then latex will automatically adapt your column widths to the available space:您可以使用
tabularx
package,然后 latex 将自动调整您的列宽以适应可用空间:
\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{geometry}
\begin{document}
\begin{tabularx}{\textwidth}{p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}X}
\toprule
& Largest problem solved & Computer & Time & Remarks\\
\midrule
Dynamic programming (Held and Karp) & 13 & 7090 & 0.98 &
\vspace*{-\baselineskip}
\begin{enumerate}
\item Storage limitations prevented the solution of larger problems
\item Required computer time is deterministic
\end{enumerate}\\
\bottomrule
\end{tabularx}
\end{document}
Here is a solution with better spacing.这是一个间距更好的解决方案。 I also used a smaller font (
footnotesize
) for the table.我还为表格使用了较小的字体(
footnotesize
)。
\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[shortlabels]{enumitem}
% See https://tex.stackexchange.com/a/6454/113546
\newcommand\compress{\csname @minipagetrue\endcsname}
\newenvironment{smallenum}{\begin{enumerate}[(1), left=0pt, nosep]\compress}{\end{enumerate}}
\newcolumntype{q}[1]{>{\centering}p{#1}}
\newcolumntype{r}[1]{>{\centering}m{#1}}
\begin{document}
\begin{footnotesize}\noindent
\begin{tabularx}{\textwidth}{@{}p{3cm} q{8mm} q{8mm} q{6mm} X}
\toprule
& \multicolumn{1}{r{8mm}}{Largest problem solved} & \multicolumn{1}{r{8mm}}{Com\-puter} & \multicolumn{1}{r{6mm}}{Time (min)} &
\multicolumn{1}{>{\centering}m{5cm}}{Remarks} \\
\midrule Dynamic programming (Held and Karp) & 13 & 7090 & 0.98 &
\begin{smallenum}
\item Storage limitations prevented the solution of larger problems
\item Required computer time is deterministic
\end{smallenum} \\
Branch-and-Bound (Little, et al) & 40 & 7090 & 8.37 &
\begin{smallenum}
\item Time reported is the expected time and one might experience large deviations for a particular problem.
\item Time reported refers to randomly selected, asymmetric $c_{ij}$. Considerable difficulty reported for Euclidean problems.
\end{smallenum}\\
\bottomrule
\end{tabularx}
\end{footnotesize}
\end{document}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.