设置表格单元格内的文本间距

设置表格单元格内的文本间距

我尝试使用来\begin{Spacing}{Factor}...\end{Spacing}设置下表单元格中的文本间距:

在此处输入图片描述

然而,单元格之间存在着意想不到的垂直空间。

如何全局修复此错误(即不使用vspace, \\etc)?

欢迎任何可以在单元格中设置单倍行距的类似方法。

\begin{Spacing}{Factor}...\end{Spacing}如果将整个表都包装起来并设置,NB会工作得很好\renewcommand*{\arraystretch}{1.5}。然而,这并不是我需要的效果。

梅威瑟:

    \documentclass[14pt]{memoir}
    \usepackage{longtable}
    \OnehalfSpacing* % document settings
    \begin{document}
        \begin{table} % only 2 cells need to be with a single spacing
        \centering\small
            \begin{tabular}{|p{2cm}|p{11cm}|l|} 
                \hline
                Column1&Column2&Column3\\
                \hline
                Row1 Long Title &   \begin{Spacing}{0.78}  Single spacing of the text (checked with Adobe Acrobat Pro) Long text    Long text   Long text   Long text   Long text   Long text   Long text   Long text   Long text
                        \end{Spacing}  & Some text  \\ \hline
                Row2 &  Short text  & Some text \\ \hline
                Row3 &      \begin{Spacing}{0.78}  Single spacing of the text (checked with Adobe Acrobat Pro) Long text    Long text   Long text   Long text   Long text   Long text   Long text   Long text   Long text
                \end{Spacing}  & Some text  \\ \hline
            \end{tabular}
        \normalsize
        \end{table}
    \end{document}

答案1

问题\setSpacing{1}而不是环境。

\documentclass[14pt]{memoir}

\OnehalfSpacing* % document settings

\begin{document}

\begin{table} % only 2 cells need to be with a single spacing
\centering\small

\begin{tabular}{|p{2cm}|p{11cm}|l|} 
\hline
Column1 & Column2 & Column3 \\
\hline
Row1 Long Title &
  \setSpacing{1}%
  Single spacing of the text (checked with Adobe Acrobat Pro) 
  Long textLong text   Long text   Long text   Long text   
  Long text   Long text   Long text   Long text  &
  Some text \\
\hline
Row2 &  Short text  & Some text \\ \hline
Row3 &
  \setSpacing{1}%
  Single spacing of the text (checked with Adobe Acrobat Pro) 
  Long textLong text   Long text   Long text   Long text   
  Long text   Long text   Long text   Long text &
  Some text  \\
\hline
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

答案2

那这个呢?

\documentclass[14pt]{memoir}
\usepackage{longtable}
\OnehalfSpacing* % document settings
\begin{document}
    \begin{table} % only 2 cells need to be with a single spacing
    \centering\small
        \begin{tabular}{|p{2cm}|p{11cm}|l|} 
            \hline
            Column1&Column2&Column3\\
            \hline
            Row1 Long Title & \begin{minipage}[t]{11cm}\begin{Spacing}{0.78} Single spacing of the text (checked with Adobe Acrobat Pro) Long text    Long text   Long text   Long text   Long text   Long text   Long text   Long text   Long text\end{Spacing}\end{minipage} & Some text  \\ \hline
            Row2 &  Short text  & Some text \\ \hline
            Row3 &      \begin{Spacing}{0.78}  Single spacing of the text (checked with Adobe Acrobat Pro) Long text    Long text   Long text   Long text   Long text   Long text   Long text   Long text   Long text
            \end{Spacing}  & Some text  \\ \hline
        \end{tabular}
    \normalsize
    \end{table}
\end{document}

在此处输入图片描述

PS:不要尝试使用inner sep=0outer sep =0,但是可以使用固定的新命令来完成所有这些操作\vspace

\documentclass[14pt]{memoir}
\usepackage{longtable}
\OnehalfSpacing* % document settings
\newenvironment{mySpacing}[2]{\begin{minipage}[t]{#2}\begin{Spacing}{#1}}{\end{Spacing}\vspace{0.8\baselineskip}\end{minipage}}
\begin{document}
    \begin{table} % only 2 cells need to be with a single spacing
    \centering\small
        \begin{tabular}{|p{2cm}|p{11cm}|l|} 
            \hline
            Column1&Column2&Column3\\
            \hline
            Row1 Long Title & \begin{mySpacing}{0.78}{11cm} Single spacing of the text (checked with Adobe Acrobat Pro) Long text    Long text   Long text   Long text   Long text   Long text   Long text   Long text   Long text\end{mySpacing}& Some text  \\ \hline
            Row2 &  Short text  & Some text \\ \hline
            Row3 &      \begin{Spacing}{0.78}  Single spacing of the text (checked with Adobe Acrobat Pro) Long text    Long text   Long text   Long text   Long text   Long text   Long text   Long text   Long text
            \end{Spacing}  & Some text  \\ \hline
        \end{tabular}
    \normalsize
    \end{table}
\end{document}

在此处输入图片描述

相关内容