Latex调整表格宽度

Latex调整表格列的间距

\renewcommand{\arraystretch}{1.3}%调行距

\setlength\tabcolsep{3pt}%调列距

LaTeX在编译时总会遇到各种各样的问题,今天遇到问题如题所示,解决方法如下:

LaTeX表格代码:

\begin{table}[htbp]
\center
\caption{ Example}
\begin{tabular}{lll}
\hline
Example&  Example&  Example\\
\hline
S1& Example&Example \\
S2& Example&ExampleExampleExampleExampleExample \\
\hline
\end{tabular}
\end{table}

(1)若表格过宽,则

\begin{table}[htbp]
\center

\caption{ Example}

 \resizebox{\textwidth}{12mm}{ %12可随机设置,调整到适合自己的大小为止

\begin{tabular}{lll}
\hline
Example&  Example&  Example\\
\hline
S1& Example&Example \\
S2& Example&ExampleExampleExampleExampleExample \\
\hline
\end{tabular}}%注意这里还有一个半括号
\end{table}

(2)若表格过窄,则

\begin{table}[htbp]
\center

\caption{ Example}

\setlength{\tabcolsep}{7mm}{%7可随机设置,调整到适合自己的大小为止

\begin{tabular}{lll}
\hline
Example&  Example&  Example\\
\hline
S1& Example&Example \\
S2& Example&ExampleExampleExampleExampleExample \\
\hline
\end{tabular}}%注意这里还有一个半括号
\end{table}


————————————————
版权声明:本文为CSDN博主「Rained_99」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:

猜你喜欢

转载自blog.csdn.net/qq_27403925/article/details/118612664