![更改边距以使表格适合当前页面](https://linux22.com/image/361008/%E6%9B%B4%E6%94%B9%E8%BE%B9%E8%B7%9D%E4%BB%A5%E4%BD%BF%E8%A1%A8%E6%A0%BC%E9%80%82%E5%90%88%E5%BD%93%E5%89%8D%E9%A1%B5%E9%9D%A2.png)
答案1
这里我使用 ,\makebox[\textwidth]{}
在其中放置了比 更宽的东西\textwidth
。虽然我在 里面展示了它table
,但这并不是采用这种技术的必要条件。
\documentclass{article}
\usepackage{lipsum,tabularx}
\begin{document}
\lipsum[1]
\begin{table}[ht]
\makebox[\textwidth]{\begin{tabularx}{1.2\textwidth}{|c|c|X|}
\hline
This & is & a test\\
\hline
\end{tabularx}}
\end{table}
\lipsum[2]
\end{document}
答案2
以下是如何在adjustwidth
环境中执行此操作:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{changepage}
\usepackage{ragged2e, lipsum}
\usepackage{tabularx, caption, booktabs}
\begin{document}
\lipsum[1]
\begin{table}[!htb]
\centering
\captionsetup{singlelinecheck=off, skip =4pt}
\begin{adjustwidth}{-0.12\textwidth}{-0.12\textwidth}
\caption{A wide table}\label{tab:wide}
\begin{tabularx}{\linewidth}{@{}>{\RaggedRight}X@{}}
\toprule
Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Ut pellentesque augue sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id,
sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce
blandit. Aliquam erat volutpat. Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec do-
lor. \\
\bottomrule
\end{tabularx}
\end{adjustwidth}
\end{table}
\lipsum[2]
\end{document}
答案3
我们希望保持简单,并将 放在tabular
里面\makebox
。
\textwidth
实际tabular
材料会很好地居中。
\documentclass{article}
\pagenumbering{gobble}
\usepackage{lipsum}
\usepackage[showframe,a4paper]{geometry}
\begin{document}
\lipsum[1]
\begin{table}[!tb]
\makebox[\textwidth][c]{%
\begin{tabular}{p{0.4\textwidth}p{0.4\textwidth}p{0.4\textwidth}}
\hline
\lipsum[1]&\lipsum[1]&\lipsum[1]\\
\hline
\end{tabular}}
\caption{This table is wider than the page.}
\label{tab:toowide}
\end{table}
\lipsum[2]
\end{document}