我可以手动尝试缩进,但它只对单元格中的第一个“段落”有效,而 \hspace 甚至对第二个段落不起作用。有没有更简单的方法?
\ctable[
cap= A short caption,
caption= This is a longer caption,
]{lp{2in}p{2in}}{}{\FL
title1 & title2 & title3\ML
label &
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace{1em} This is paragraph two. This is paragraph two.&
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace{1em} This is paragraph two. This is paragraph two.\NN
label2 &
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace{1em} This is paragraph two. This is paragraph two.&
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace{1em} This is paragraph two. This is paragraph two.\LL
}
作为替代方案,我可能会尝试使用 minipages 模拟表格,但经过短暂的尝试后,似乎这应该是 e
答案1
使用\endgraf
宏 - 它的工作方式与 相同\par
,但也可以在\par
不允许的地方使用。(感谢 egreg 提供的提示。)
\documentclass{article}
\usepackage{ctable}
\newcolumntype{q}[1]{>{\setlength{\parindent}{1em}}p{#1}}
\begin{document}
\ctable[
cap= A short caption,
caption= This is a longer caption,
]{lq{2in}q{2in}}{}{\FL
title1 & title2 & title3\ML
label &
This is paragraph one. This is paragraph one.\endgraf
This is paragraph two. This is paragraph two.&
This is paragraph one. This is paragraph one.\endgraf
This is paragraph two. This is paragraph two.\NN
label2 &
This is paragraph one. This is paragraph one.\endgraf
This is paragraph two. This is paragraph two.&
This is paragraph one. This is paragraph one.\endgraf
This is paragraph two. This is paragraph two.\LL
}
\end{document}
答案2
在行尾/开头附近,LaTeX 会吞掉空格。要强制这些空格留在原处,请使用\hspace*{<length>}
:
\ctable[
cap= A short caption,
caption= This is a longer caption,
]{lp{2in}p{2in}}{}{\FL
title1 & title2 & title3\ML
label &
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace*{1em} This is paragraph two. This is paragraph two.&
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace*{1em} This is paragraph two. This is paragraph two.\NN
label2 &
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace*{1em} This is paragraph two. This is paragraph two.&
\hspace{1em} This is paragraph one. This is paragraph one.\newline
\hspace*{1em} This is paragraph two. This is paragraph two.\LL
}
另一种替代方法是删除表格中的段落缩进,因为表格的排版可能与常规文本略有不同。因此,将其设置\parindent
为适当的值\ctable
应该可以解决问题:
...
\setlength{\parindent}{1em}This is ... \endgraf &
\setlength{\parindent}{1em}This is ... \endgraf \\
...
但是,您必须使用\endgraf
int 和\setlength
command 来终止段落,因为\par
nor\newline
都没有帮助。