由于某种原因,当我尝试增加和添加列时,它会消失在屏幕外。为什么会发生这种情况: 乳胶:
\documentclass[a4paper,svgnames,11pt]{article}
\textheight = 220mm
\textwidth = 150mm
\topmargin = 10mm
\oddsidemargin = 5.0mm
\evensidemargin = 5.0mm
\unitlength = 1mm
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{array}
\usepackage{booktabs}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{threeparttable}
\usepackage{tikz}
\usepackage{tabularray}
\usepackage{bbding}
\usepackage{pifont}
\usepackage{wasysym}
\usepackage{amssymb}
\begin{document}
{\renewcommand{\arraystretch}{1.6}%
\small
\begin{table}[htbp]
\centering
\caption{Comparison}\label{tab:comparison}
\begin{tabular}{ |p{5cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}| }
\hline
OS & \hfil Secure & \hfil Fast & \hfil Beautiful & \hfil Smart & \hfil Error free \\ \hline
Windows & \hfil \checkmark & \hfil \checkmark & \hfil \checkmark & \\ \hline
MAC OSX & \hfil \checkmark & \hfil \checkmark & \hfil \checkmark & \\ \hline
Linux & \hfil \checkmark & \hfil \checkmark & \hfil \checkmark & \\ \hline
\end{tabular}
\end{table}}
\end{document}
答案1
您的 MWE (最小工作示例) 存在更多问题:
- 文档布局不一致。我建议使用
geometry
包来定义它 - 因为您加载了
tabularray
包,所以我会用它来编写您的表格: - MWE 仅与您的问题相关的软件包是:
\documentclass[a4paper,svgnames,11pt]{article}
\usepackage[hmargin=5mm, vmargin={10mm,67mm}]{geometry} % new
\usepackage{amssymb}
\usepackage{tabularray}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Comparison}\label{tab:comparison}
\begin{tblr}{hlines, vlines,
colspec={l *{5}{c}},
}
OS & Secure & Fast & Beautiful & Smart & Error free \\
Windows & \checkmark & \checkmark & \checkmark & & \\
MAC OSX & \checkmark & \checkmark & \checkmark & & \\
Linux & \checkmark & \checkmark & \checkmark & & \\
\end{tblr}
\end{table}
\end{document}
(灰线为页面边框)
文本区域也可以容纳七列:
\documentclass[a4paper,svgnames,11pt]{article}
\usepackage[hmargin=5mm, vmargin={10mm,67mm}]{geometry} % new
\usepackage{amssymb}
\usepackage{tabularray}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Comparison}\label{tab:comparison}
\begin{tblr}{hlines, vlines,
colspec={l *{7}{X[c,m]}},
}
OS & Secure & Fast & Beautiful & Smart & Error free & & \\
Windows & \checkmark & \checkmark & \checkmark & & & & \\
MAC OSX & \checkmark & \checkmark & \checkmark & & & & \\
Linux & \checkmark & \checkmark & \checkmark & & & & \\
\end{tblr}
\end{table}
\end{document}