在常规表格环境中,我们可以使用 来\setlength{\tabcolsep}
指定列之间的空间大小,但这在 中不起作用longtable
。有类似的命令吗?
\documentclass[12pt]{article}
\usepackage{longtable}
\begin{document}
\begin{longtable}{rl}
\setlength{\tabcolsep}{2pt}
2: $x^3$&= $6x^2-4x-16$ \\
4: $x^5$ &= $6x^4-8x^3+8x^2-16x-64$ \\
6: $x^9$ &= $6x^8-4x^7-24x^6+48x^5-32x^4-64x^3-384x^2+256x+1024 $ \\
8: $x^{15}$ &=$6x^{14}-4x^{13}-16x^{12}-32x^{11}+192x^{10}-128x^{9}-512x^8+512x^7$\\
&$\hspace{.25cm}-3072x^6+2048x^5+8192x^4+4096x^3-24576x^2+16384x+65536$
\end{longtable}
\end{document}
答案1
您需要在输入之前设置长度longtable
,就像在之前设置一样tabular
。但是请注意,由于您已=
设置数学模式,因此间距不正确。第二个示例显示了=
在数学模式下设置了数学间距。最后建议不要使用,longtable
而要使用专用的数学显示环境,例如对齐。
\documentclass[12pt]{article}
\usepackage{longtable,amsmath}
\begin{document}
{\setlength{\tabcolsep}{2pt}
\begin{longtable}{rl}
2: $x^3$&= $6x^2-4x-16$ \\
4: $x^5$ &= $6x^4-8x^3+8x^2-16x-64$ \\
6: $x^9$ &= $6x^8-4x^7-24x^6+48x^5-32x^4-64x^3-384x^2+256x+1024 $ \\
8: $x^{15}$ &=$6x^{14}-4x^{13}-16x^{12}-32x^{11}+192x^{10}-128x^{9}-512x^8+512x^7$\\
&$\hspace{.25cm}-3072x^6+2048x^5+8192x^4+4096x^3-24576x^2+16384x+65536$
\end{longtable}
}
\begin{longtable}{l@{:\qquad}r@{}l}
2& $x^3$&${}= 6x^2-4x-16$ \\
4& $x^5$ &${}= 6x^4-8x^3+8x^2-16x-64$ \\
6& $x^9$ &${}= 6x^8-4x^7-24x^6+48x^5-32x^4-64x^3-384x^2+256x+1024 $ \\
8& $x^{15}$ &${}=6x^{14}-4x^{13}-16x^{12}-32x^{11}+192x^{10}-128x^{9}-512x^8+512x^7$\\
&&$\hspace{.25cm}{}-3072x^6+2048x^5+8192x^4+4096x^3-24576x^2+16384x+65536$
\end{longtable}
\begin{align*}
x^3&= 6x^2-4x-16 \tag{2}\\
x^5 &= 6x^4-8x^3+8x^2-16x-64 \tag{4}\\
x^9 &= 6x^8-4x^7-24x^6+48x^5-32x^4-64x^3-384x^2+256x+1024 \tag{6}\\
x^{15} &=6x^{14}-4x^{13}-16x^{12}-32x^{11}+192x^{10}-128x^{9}-512x^8+512x^7\tag{8}\\
& \qquad-3072x^6+2048x^5+8192x^4+4096x^3-24576x^2+16384x+65536
\end{align*}
\end{document}