我正在尝试在longtable
使用中的一个特定单元格中添加额外的水平空间\hspace
。
在下面的例子中,我想稍微缩进“(1) be great”和“(2) be even more great”,但\hspace
编译时被忽略了。hspace 似乎可以与常规表格一起使用,但似乎对没有任何作用longtable
。感谢您的任何建议或解决方法。
\begin{longtable}{|p{0.15\linewidth}|p{0.15\linewidth}|p{0.6\linewidth}|}
Hawaii & 1997 &
(a) In January 1997, Hawaii will \newline
\hspace{1cm} (1) be great \newline
\hspace{1cm} (2) be even more great
\end{longtable}
答案1
它在常规表格中也不起作用。您处于 p 列中,行首的空格将被忽略。使用 \hspace*:
\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|p{0.15\linewidth}|p{0.15\linewidth}|p{0.6\linewidth}|}
Hawaii & 1997 &
(a) In January 1997, Hawaii will \newline
\hspace*{1cm} (1) be great \newline
\hspace*{1cm} (2) be even more great
\end{longtable}
\end{document}
答案2
enumerate
正如 @David Carlisle 所建议的,使用嵌套s 并带有合适参数的解决方案:
\documentclass{article}
\usepackage{enumitem}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|p{0.15\linewidth}|p{0.15\linewidth}|p{0.6\linewidth}|}
Hawaii & 1997 & \begin{enumerate}[label=(\alph*), wide=0pt, labelsep=0pt, leftmargin=*, nosep, before = \vspace*{-\baselineskip}]
\item In January 1997, Hawaii will
\begin{enumerate}[label = (\arabic*), wide=0.25cm, leftmargin=*, labelsep=4pt, nosep]
\item be great
\item be even more great
\end{enumerate}
\end{enumerate}
\end{longtable}
\end{document}