使用 longtable p 的第二列中有奇怪的空间

使用 longtable p 的第二列中有奇怪的空间

我有一个longtable,除了第二行之外,运行良好。第二列有奇怪的自由空间,而之后的其他行中没有出现。

我需要如何修复我的代码?

\documentclass[a4paper,12pt,twoside]{book}

\usepackage[table]{xcolor}                   %% allow colour
\definecolor{Tmaroon}{RGB}{119,36,50}
\definecolor{Lblue}{RGB}{0,65,101}
\definecolor{Cgray}{RGB}{169,178,177}
\definecolor{Hyellow}{RGB}{242,223,116}

\usepackage[textwidth=450pt, textheight=680pt,top=3cm, left=2.5cm]{geometry} %margins
%
\usepackage{tabularx} % for the table format

\usepackage{microtype} % reduces the number of hyphenations
%
%\usepackage{longtable} % allows list to split over the page
\usepackage{ltablex} %using because of tabularx environment
%\usepackage{pgfplotstable} % for "continued on next page"

\setlength{\parindent}{0pt} % never indent first line

\usepackage{array}       % Adds m{...} type column

%multi-row
\usepackage{multirow}

% p columns which are raggedright
\newcolumntype{Q}{>{\bfseries\raggedright\arraybackslash}p{0.14\textwidth}}
\newcolumntype{R}{>{\raggedright\arraybackslash}p{0.37\textwidth}}
\newcolumntype{S}{>{\raggedright\arraybackslash}p{0.41\textwidth}}

\begin{document}

{\renewcommand{\arraystretch}{1.2}
\centering
\begin{longtable}{| Q | S| R | }
\hline
Order of Events (prompt) &
               \textbf{What to say} &
              \textbf{ Responses} \\ \hline
\endhead
\begin{tabular}{l} Stand, \\
Smile, \\
Accept \\  \quad gavel \end{tabular}  &
Thank you, Mr/Madam Toastmaster. With the permission of the meeting, I shall conduct the Business Session from a seated position.  & \\ \hline
            \hline   
\multirow{ 2}{*}{\begin{tabular}{l} Quorum\\ \end{tabular} } &
Mr/Madam Secretary – do we have a quorum present? &
\textbf{Secretary:} We have \underline{\hspace{0.5cm}} present out  of \underline{\hspace{0.5cm}} active members.  \\ \cline{2-3}

 & \begin{tabular}{>{\raggedright}p{0.19\textwidth} | >{\raggedright} p{0.19\textwidth} } 
Yes, a quorum is present.
I will open the business meeting at \textit{(time)} pm. &
No, we do not have a quorum. (\textcolor{Tmaroon} {The business must be ratified at next meeting.})  \end{tabular} & \\ \hline
\hline
\multirow{ 5}{*}{\begingroup \small \begin{tabular}{l} \normalsize{Apologies} \\
\\
Secretary, 
\\
Mover, \\
Seconder, \\
Vote, \\
 \quad Carried, \\ 
\quad Gavel
\end{tabular} \endgroup}&
I will now call for apologies. Mr/Madam Secretary, do we have any written apologies? &
\textbf{Secretary:} Mr/Madam Chairman, we have written apologies as per program and from: (names). \\ \cline{2-3}

& Are there any further apologies from the floor? & \textit{wait for responses} \\ \cline{2-3}

 & I ask for a motion that the apologies as stated be accepted. & \textbf{Mover:} I, \textit{(name)}, so move. \\ \cline{2-3}

& Do we have a seconder? & \textbf{Seconder:} I, (name), second the motion. \\ \cline{2-3}

& Is there anything to discuss on the issue of apologies? & \textit{wait for responses} \\ \cline{2-3}

& Those in favour, raise one hand \textit{(pause)};  those against, raise one hand \textit{(pause)}  \par The motion is carried - (or lost). & \\ \hline

\hline
\end{longtable}
}

\end{document}

在此处输入图片描述

答案1

对于您的表格,您不需要嵌套表格或\multirow单元格:

在此处输入图片描述

\documentclass[a4paper,12pt,twoside]{book}

\usepackage[table]{xcolor}                   %% allow colour
\definecolor{Tmaroon}{RGB}{119,36,50}
\definecolor{Lblue}{RGB}{0,65,101}
\definecolor{Cgray}{RGB}{169,178,177}
\definecolor{Hyellow}{RGB}{242,223,116}

\usepackage[textwidth=450pt, textheight=680pt,top=3cm, left=2.5cm]{geometry} %margins

\setlength{\parindent}{0pt} % never indent first line

\usepackage{longtable,}       % Adds m{...} type column

% p columns which are raggedright
\newcolumntype{Q}{>{\bfseries\raggedright\arraybackslash}p{0.14\textwidth}}
\newcolumntype{R}{>{\raggedright\arraybackslash}p{0.34\textwidth}}
\newcolumntype{S}{>{\raggedright\arraybackslash}p{0.37\textwidth}}

\begin{document}

{\renewcommand{\arraystretch}{1.2}
\centering
\begin{longtable}{| Q | S| R | }
\hline
Order of Events (prompt) 
            &   \textbf{What to say}
                & \textbf{ Responses}   \\ \hline
\endhead
% body
Stand,\newline
Smile,\newline
Accept      &   Thank you, Mr/Madam Toastmaster. 
                With the permission of the meeting, I shall conduct the Business Session from a seated position.
                &                       \\ \hline
            \hline
Quorum      &   Mr/Madam Secretary – do we have a quorum present? 
                &   \textbf{Secretary:} We have \underline{\hspace{0.5cm}} present out  of \underline{\hspace{0.5cm}} active members.  
                                        \\ \cline{2-3}
\hline
\end{longtable}
}

\end{document}

附录:

  • 如果你愿意使用tabularray包,相对简单的得到以下结果:

在此处输入图片描述

  • 在您编辑答案之后(顺便说一句,它仍然不可编译,缺少加载longtable,使用了哪些sont/sffamily在表中定义了什么...),multirow单元格有了一些意义,但是,似乎仍然不需要嵌套表格(从提供的信息得出结论),但我可能是错的。
  • tabularray有自己的机制来写入多行(和多列)单元格,因此您不需要加载multirow包。
  • 可能的解决方案:
    • 不包含表格嵌套:
      • 假设表中只有一个部分法定人数
      • 在这种情况下,我将插入另一列来写入第四行,并在所有其他行合并第二列和第三列。
\documentclass[a4paper,12pt,twoside]{book}
\usepackage[textwidth=450pt, textheight=680pt,
            top=3cm, left=2.5cm]{geometry} %margins
\setlength{\parindent}{0pt} % never indent first line

\usepackage[table]{xcolor}                   %% allow colour
\definecolor{Tmaroon}{RGB}{119,36,50}
\definecolor{Lblue}{RGB}{0,65,101}
\definecolor{Cgray}{RGB}{169,178,177}
\definecolor{Hyellow}{RGB}{242,223,116}

\usepackage{ragged2e}
\usepackage{tabularray}

\begin{document}
\sffamily

\begin{longtblr}[
    label=none,     % <---
      entry=none]{hlines, vlines,
                 colspec = {Q[l, font=\bfseries, wd=0.13\linewidth]
                            *{2}{X[cmd=\RaggedRight]}
                            X[2,j]},
                 cell{1-3}{2} = {c=2}{j},
                 cell{5-Z}{2} = {c=2}{j},
                 hspan=minimal,     
                 rulesep=0pt,
                 row{1} = {font=\bfseries},
                 rowhead=1           
                 }

Order of Events (prompt) 
        &   What to say 
            &   &   Responses           \\ 
Stand, 
Smile, 
Accept \newline \null \quad gavel 
    &   Thank you, Mr/Madam Toastmaster. With the permission of the meeting, I shall conduct the Business Session from a seated position.  
        &   &                           \\
    \hline
\SetCell[r=2]{h}    Quorum
    &   Mr/Madam Secretary – do we have a quorum present? 
        &   &   \textbf{Secretary:} We have \underline{\hspace{0.5cm}} present out  of \underline{\hspace{0.5cm}} active members.  
                                        \\ 
    &   Yes, a quorum is present.I will open the business meeting at \textit{(time)} pm. 
        &   No, we do not have a quorum. (\textcolor{Tmaroon}{The business must be ratified at next meeting.})
            &                           \\
    \hline
\SetCell[r=6]{h}    {Apologies\\
    \bigskip
    Secretary,
    Mover, 
    Seconder, 
    Vote, \\
        \quad Carried, \\
        \quad Gavel}
    &   I will now call for apologies. Mr/Madam Secretary, do we have any written apologies? 
        &   &   \textbf{Secretary:} Mr/Madam Chairman, we have written apologies as per program and from: (names). \\

    & Are there any further apologies from the floor? 
        &   &   \textit{wait for responses} \\

    & I ask for a motion that the apologies as stated be accepted. 
        &   &   \textbf{Mover:} I, \textit{(name)}, so move. 
                                            \\ 

    & Do we have a seconder? 
        &   &   \textbf{Seconder:} I, (name), second the motion. 
                                            \\
    & Is there anything to discuss on the issue of apologies? 
        &   &   \textit{wait for responses} \\
    &   Those in favour, raise one hand \textit{(pause)}; \quad
        those against, raise one hand \textit{(pause)}  \par The motion is carried - (or lost).
        &   &                               \\ 
\end{longtblr}
\end{document}
  • 带有表格嵌套:
    • 假设表中有更多部分法定人数
    • 在这种情况下,插入具有两列的表格可能会更方便。
    • 对于表格,我建议使用˙tblr oftabularray 包,对于行,这些单元格在哪里,本地设置垂直距离(参见下面的 MWE)
\documentclass[a4paper,12pt,twoside]{book}
\usepackage[textwidth=450pt, textheight=680pt,
            top=3cm, left=2.5cm]{geometry} %margins
\setlength{\parindent}{0pt} % never indent first line

\usepackage[table]{xcolor}                   %% allow colour
\definecolor{Tmaroon}{RGB}{119,36,50}
\definecolor{Lblue}{RGB}{0,65,101}
\definecolor{Cgray}{RGB}{169,178,177}
\definecolor{Hyellow}{RGB}{242,223,116}

\usepackage{ragged2e}
\usepackage{tabularray}

\begin{document}
\sffamily           % font settings are unknown, in table are used \sffamily font

\begin{longtblr}[
    label=none,     % <---
      entry=none]{hlines, vlines,
                 colspec = {Q[l, font=\bfseries, wd=0.13\linewidth]
                            *{2}{X[cmd=\RaggedRight]}
                            },
                 row{1} = {font=\bfseries},
                 rulesep=0pt,
                 rowhead=1
                 }

Order of Events (prompt)
        &   What to say
            &   Responses               \\
Stand,
Smile,
Accept \newline \null \quad gavel
    &   Thank you, Mr/Madam Toastmaster. With the permission of the meeting, I shall conduct the Business Session from a seated position.
        &                               \\
    \hline  % for thicke line
\SetCell[r=2]{h}    Quorum
    &   Mr/Madam Secretary – do we have a quorum present?
        &   \textbf{Secretary:} We have \underline{\hspace{0.5cm}} present out  of \underline{\hspace{0.5cm}} active members.                 \\

\SetRow{rowsep=0pt} 
    &   \begin{tblr}[t]{colspec={@{} X  |
                                  X  }
                     }
        Yes, a quorum is present.I will open the business meeting at \textit{(time)} pm.
            &   No, we do not have a quorum. (\textcolor{Tmaroon}{The business must be ratified at next meeting.})
        \end{tblr}
        &                               \\
    \hline  % for thicke line
\SetCell[r=6]{h}   {Apologies\\
                    \bigskip
                    Secretary,
                    Mover,
                    Seconder,
                    Vote, \\
                        \quad Carried, \\
                        \quad Gavel}
    &   I will now call for apologies. Mr/Madam Secretary, do we have any written apologies?
        &   \textbf{Secretary:} Mr/Madam Chairman, we have written apologies as per program and from: (names). \\
    & Are there any further apologies from the floor?
        &   \textit{wait for responses} \\
    & I ask for a motion that the apologies as stated be accepted.
        &   \textbf{Mover:} I, \textit{(name)}, so move.
                                            \\
    & Do we have a seconder?
        &   \textbf{Seconder:} I, (name), second the motion.
                                            \\
    & Is there anything to discuss on the issue of apologies?
        &   \textit{wait for responses}     \\
    &   Those in favour, raise one hand \textit{(pause)}; \quad
        those against, raise one hand \textit{(pause)}  \par The motion is carried - (or lost).
        &                                   \\
\end{longtblr}
\end{document}

两个例子都给出了相同的结果。

相关内容