tabularx 因某种原因破坏了页面格式

tabularx 因某种原因破坏了页面格式

我正在撰写化学博士论文,似乎遇到了 table/tabularx 实例问题。我有很多表格,还有几个 longtable(似乎总是正常中断)。我很难判断是否是所有 tabularx 环境导致了问题,因为问题似乎根据文本/表格的位置而移动,但我似乎始终看到页面内容继续超出页面范围(文本和表格都是这样)问题快照 表方案

\documentclass[a4paper, draft=true,11pt, openany]{scrbook}
% !BIB TS-program = biber

\usepackage[scaled]{helvet}
    \renewcommand\familydefault{\sfdefault} 
\usepackage[T1]{fontenc}
    \fontfamily{phv}\selectfont
\usepackage{textgreek}
\usepackage[margin=2.5cm]{geometry}             % Easy page layout
\usepackage{indentfirst}  %indents the first line after a section or chapter
\usepackage[section]{placeins} %should keep tables and figures in their sections
\usepackage{setspace}
    \onehalfspacing
\usepackage{lipsum}
\usepackage{graphicx}

%%%%%%%%%%%%Crap for Tables%%%%%%%%%%%%%%
\usepackage{array}
\usepackage{booktabs}               % Better table layouts
\usepackage{tabularx}               %Package to set table widths
\usepackage{ltablex}                %For Tables that overflow a row
\keepXColumns
\usepackage[svgnames,table]{xcolor} % note the table option

\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}} %\rownum is a counter for table rows

\newcolumntype{C}[1]{>{\centering}m{#1}} %manual width column widths
\newcolumntype{Y}{>{\centering\arraybackslash}X} %Autospaced column widths with centre alignment
\newcolumntype{F}{S[table-format=2,table-space-text-post=\footnotemark]} %column aligned in center to right digit ignoring superscript

\renewcommand{\arraystretch}{1.1} 

\usepackage{siunitx}
\sisetup{detect-all}
\usepackage{multicol}   % i think this is for columnd articles, can probably disable
%%%%%%%%%%%%Crap for Tables%%%%%%%%%%%%%%

\usepackage[version=3]{mhchem}      % Formula subscripts using \ce{}

\newcommand{\SupS}[1]{\textsuperscript{#1}} %modified SuperScript command
\usepackage[font=footnotesize,labelfont=bf,hypcap=false,singlelinecheck=false]{subcaption}
\setcapindent{0pt}    %setting cation indent to 0
\newcommand{\SubCap}[1]{\unskip\parbox{\columnwidth}{\raggedright\footnotesize{#1}}}  %My own subcaption command used under tabularx within table environment  


\def\pdfshellescape{1}

\begin{document}

\lipsum

\lipsum

\begin{table}[ht]  %Table 1

    \begin{tabularx}{\textwidth}{YYYFY}
        \toprule
        \textbf{Entry\SupS{a}}&\textbf{Ligand}&\textbf{Bite angle}& \textbf{Yield(\%)\SupS{b}}  &   \textbf{E:Z}\\ 
        \midrule
        \rownumber  &\ce{P(2-furyl)3}&  --  &27 &   1:3\\
        \rownumber  &\ce{PPh3}          &   --  &22 &   1:4\\
        \rownumber  &\ce{P(2-Tol)3} &   --  &13 &   1:2\\
        \rownumber  &\ce{PPh2Cy}    &   --  &3  &   1:2\\   
        \rownumber  &\ce{P(4-F-Ph)} &   --  &37 &   1:4\\
        \rownumber  &\ce{P(4-CF3-Ph)}&  -- &35  &   1:5\\
        \rownumber  &DavePhos           &   --  &12 &   1:3\\
        \rownumber  &XPhos                  &   --  &12 &   1:1\\
        \rownumber  &dppm                   & 72    & 79    &   1:4\\
        \rownumber  &dppe                   &   85 & 80 &   1:4\\
        \rownumber  &dppp                   &   91  & 79    &   1:4\\
        \rownumber  &dppf                   &   96  & 83    &   1:4\\
        \rownumber  &DPEPhos            &   102 &86\SupS{c}&1:4\\
        \rownumber  &NixantPhos     &   {~}114  &12 &   1:2\\
        \rownumber  &BINAP                  &   92 &48  &   1:4\\
        \rownumber  &AnthPhos           &   --  &36 &   1:4\\
        \bottomrule
    \end{tabularx}
    \SubCap{Sub-caption text}
\end{table}
    \setcounter{magicrownumbers}{0}





\begin{table}[htb] %Table2

    \begin{tabularx}{\textwidth}{YC{5cm}FY}
        \toprule
        \textbf{Entry\SupS{a}}&\textbf{Pd Source}&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &\ce{Pd2(dba)3.CHCl3} (2.5 mol{\%}) &86\SupS{c} &   1:4         \\
        \rownumber  &\ce{Pd(OAc)2} (5.0 mol\%)              &79                 &   1:4         \\  
        \rownumber  &\ce{Pd(dba)2} (5.0 mol\%)              &85\SupS{c} &   1:4         \\
        \rownumber  &\ce{Pd(Cp)Cinammyl} (5.0 mol\%)&80                 &   1:5         \\
        \rownumber  &\ce{PdCl2(PPh3)2} (5.0 mol\%)      &50                 &   1:4         \\
        \rownumber  &\ce{Pd(allyl)(COD)BF4} (5.0 mol\%)&60                  &   1:4         \\
        \rownumber  &\ce{Pd(OPiv)2} (5.0 mol\%)         &36                 &   1:5         \\
        \bottomrule
    \end{tabularx}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}





\begin{table}[htb] %Table 3

    \begin{tabularx}{\textwidth}{YYFY}
        \toprule
        \textbf{Entry\SupS{a}}&Acetal equiv.&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &               1.5         &86\SupS{c}                 &   1:9         \\
        \rownumber  &               1.1         &78                 &   1:7         \\
        \rownumber  &               2.0         &84                 &   1:8         \\
        \rownumber  &               3.0         &72                 &   1:7         \\
        \bottomrule
    \end{tabularx}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}
\lipsum[1-2]



\begin{table}[ht]  %Table 4

    \begin{tabularx}{\textwidth}{YYFY}
        \toprule
        \textbf{Entry\SupS{a}}&tether premix time&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &               60 min          &80\SupS{c}                 &   1:9         \\
        \rownumber  &               10 min          &83                 &   1:9     \\
        \rownumber  &               0 min           &83\SupS{c}                 &   1:9         \\
        \rownumber  &               Direct addition         &84                 &   1:8         \\
        \bottomrule
    \end{tabularx}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}


\begin{table}[htb]  %Table 5

    \begin{tabularx}{\textwidth}{YYYY}
        \toprule
        \textbf{Entry\SupS{a}}&Comment&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &               Ligand: XantPhos            &   trace  &    --  \\
        \rownumber  &               Base: \ce{Cs3PO4}           &   69      &   1:6 \\
        \rownumber  &               Addition of CsOTf           &   73          &   1:7         \\
        \bottomrule
    \end{tabularx}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}

\lipsum

\end{document}

答案1

  • 您的 MWE 无法重现所述问题
  • tabularx表格可以容纳在一页中,并封装成table浮动元素,不能超出页面

编辑:

  • 只要您不加载ltablexxltabular包,上述语句就有效。两者都可能导致表格即使在tabular浮动环境中在某些情况下也会突出文本底部。

  • 您可以通过两种方式避免这些包的不良特性:

    • 不使用这些包,即坚持使用@egreg 提出的解决方案
    • 使用这些包,您可以将table某些文本行的插入点向上或向下移动。

一些题外话推荐:

  • 对于表格来说,最好使用标准化的表格,caption而不是自己定义。如果你不喜欢给它们编号并贴上“表格”标签,那么就使用它\caption*{...}
  • 表格通常在表格上方有标题。
  • 可以使用以下列规范来简化表格的自动编号:
>{\rownumber}r<{\qquad\quad}
  • 可以使用etoolbox以下工具重置表格编号:
\usepackage{etoolbox}
\AtBegindEnvironment{<table environmentr>}{\setcounter{magicrownumbers}{0}}
  • 对于表格中的注释,使用threepattable包及其宏很方便\tnote。它还可以添加表格注释并将文本容纳到表格宽度(以防您希望表格比文本宽度窄)。
  • 对于带有数字的列,我将使用包S中定义的列类型siunitx。它也可用于书写单位。

MWE 的示例,它用于xltabular长表以及标准tabularx表并考虑了上述建议。不幸的是,它不能严格解决您的基本问题,但可以很好地避免它(参见在文本中插入点的表格,用红色文本标记以及表格的位置)。

\documentclass{article}
\usepackage[margin=2.5cm]{geometry}     % Easy page layout
\usepackage{lipsum}                     % for dummy texts
\usepackage{graphicx}                   % for including figures
\usepackage[version=4]{mhchem}          % Formula subscripts using \ce{}
\usepackage{ragged2e}                   % ragged with smart hyphenation
\usepackage{booktabs, makecell, multirow, xltabular, threeparttable}
\renewcommand\theadfont{\bfseries\small}
\newcolumntype{C}{>{\Centering}X}
\newcolumntype{L}{>{\RaggedRight}X}
\newcolumntype{R}{>{\RaggedLeft}X}
\newcommand\mcx[1]{\multicolumn{1}{>{\bfseries}C}{#1}}
\newcommand\mccx[1]{\multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep\relax
                                      \bfseries}C}{#1}}
%
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\themagicrownumbers}
\usepackage[table, dvipsname]{xcolor}
\usepackage{siunitx}
\usepackage[skip=1ex,
            font=footnotesize,
            singlelinecheck=false]{caption}

\usepackage{etoolbox}
\AtBeginEnvironment{xltabular}{\setcounter{magicrownumbers}{0}}

\begin{document}
\lipsum[11] \textbf{\textcolor{red}{Tab. 1 inserting point}}
    \begin{table}[ht]
\begin{threeparttable}
\begin{xltabular}{\linewidth}{%
                    >{\rownumber}r<{\qquad\qquad}
                                 X
                                 S[table-format=3]
                                 S[table-format=2,
                                   table-space-text-post={$^{m}$}]
                                 C
                                }
    \caption{My caption}
\label{my-label}                \\
    \toprule
\mcx{Entry\tnote{a}}
    &  \mcx{Ligand}
        &  \mcx{Bite angle}
            &  \mcx{Yield (\%)\tnote{b}}
                &   \mcx{E:Z}   \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27    &   1:3         \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86\tnote{c}   &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
     \bottomrule
\end{xltabular}\vspace{-\baselineskip}
    \begin{tablenotes}[para, flushleft]
    \item[a]    text;
    \item[b]    text;
    \item[c]    text.
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\lipsum[12] \textbf{\textcolor{red}{Tab. 2 inserting point}}
    \begin{table}[ht]
\begin{threeparttable}
\begin{xltabular}{\linewidth}{%
                    >{\rownumber}r<{\qquad\qquad}
                                 X
                                 S[table-format=3]
                                 S[table-format=2,
                                   table-space-text-post={$^{m}$}]
                                 C
                                }
    \caption{My caption}
\label{my-label}                \\
    \toprule
\mcx{Entry\tnote{a}}
    &  \mcx{Ligand}
        &  \mcx{Bite angle}
            &  \mcx{Yield (\%)\tnote{b}}
                &   \mcx{E:Z}   \\
    \midrule
    &   DPEPhos             & 102   & 86\tnote{c}   &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
     \bottomrule
\end{xltabular}\vspace{-\baselineskip}
    \begin{tablenotes}[para, flushleft]
    \item[a]    text;
    \item[b]    text;
    \item[c]    text.
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\lipsum[13]
    \begin{figure}[ht]
      \centering
      \includegraphics[width=0.5\linewidth]{example-image-duck}
      \caption{My lovely duck}\label{fig:duck}
    \end{figure}
\lipsum[1]
    \begin{figure}[ht]
      \centering
      \includegraphics[width=\linewidth]{example-image-duck}
      \caption{My lovely big duck}\label{fig:bigduck}
    \end{figure}
\lipsum[2] \textbf{\textcolor{red}{Tab. 3 inserting point}}
    \begin{table}[ht]
\begin{threeparttable}
\begin{xltabular}{\linewidth}{%
                    >{\rownumber}r<{\qquad\qquad}
                                 X
                                 S[table-format=3]
                                 S[table-format=2,
                                   table-space-text-post={$^{m}$}]
                                 C
                                }
    \caption{My caption}
\label{my-label}                \\
    \toprule
\mcx{Entry\tnote{a}}
    &  \mcx{Ligand}
        &  \mcx{Bite angle}
            &  \mcx{Yield (\%)\tnote{b}}
                &   \mcx{E:Z}   \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27    &   1:3         \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86\tnote{c}   &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
     \bottomrule
\end{xltabular}\vspace{-\baselineskip}
    \begin{tablenotes}[para, flushleft]
    \item[a]    text;
    \item[b]    text;
    \item[c]    text.
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\lipsum[3] \textbf{\textcolor{red}{Tab. 4 inserting point}}
    \begin{table}[ht]
\begin{threeparttable}
\begin{xltabular}{\linewidth}{%
                    >{\rownumber}r<{\qquad\qquad}
                                 X
                                 S[table-format=3]
                                 S[table-format=2,
                                   table-space-text-post={$^{m}$}]
                                 C
                                }
    \caption{My caption}
\label{my-label}                \\
    \toprule
\mcx{Entry\tnote{a}}
    &  \mcx{Ligand}
        &  \mcx{Bite angle}
            &  \mcx{Yield (\%)\tnote{b}}
                &   \mcx{E:Z}   \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27    &   1:3         \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86\tnote{c}   &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
     \bottomrule
\end{xltabular}\vspace{-\baselineskip}
    \begin{tablenotes}[para, flushleft]
    \item[a]    text;
    \item[b]    text;
    \item[c]    text.
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\lipsum  \textbf{\textcolor{red}{Tab. 5 inserting point}}
\begin{xltabular}{\linewidth}{%
                    >{\rownumber}r<{\qquad\qquad}
                                 X
                                 S[table-format=3]
                                 S[table-format=2,
                                   table-space-text-post={$^{m}$}]
                                 C
                                }
    \caption{Long table caption}
    \label{my-label}                
    \addtocounter{table}{-1}      \\
    \toprule
\mcx{Entry}
    &  \mcx{Ligand}
        &  \mcx{Bite angle}
            &  \mcx{Yield (\%)}
                &   \mcx{E:Z}   \\
    \midrule
\endfirsthead
    \caption{Long table caption (Cont.)}  \\
    \toprule
\mcx{Entry}
    &  \mcx{Ligand}
        &  \mcx{Bite angle}
            &  \mcx{Yield (\%)}
                &   \mcx{E:Z}   \\
    \midrule
\endhead
    \midrule
\multicolumn{5}{r}{\textit{Continue on the next page}}
\endfoot
    \bottomrule
\endlastfoot
%%%% table body
\multicolumn{5}{l}{First test}                             \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27    &   1:3         \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86            &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
    \midrule
\multicolumn{5}{l}{Second test}                             \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27            &   1:3 \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86            &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
    \midrule
\multicolumn{5}{l}{Third test}                             \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27            &   1:3 \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86            &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
    \midrule
\multicolumn{5}{l}{Fourth test}                             \\
    \midrule
    & \ce{P(2-furyl)3}      & {--}  & 27            &   1:3 \\
    &   \ce{PPh3}           & {--}  & 22            &   1:4 \\
    &   \ce{P(2-Tol)3}      & {--}  & 13            &   1:2 \\
    &   \ce{PPh2Cy}         & {--}  & 3             &   1:2 \\
    &   \ce{P(4-F-Ph)}      & {--}  & 37            &   1:4 \\
    &   \ce{P(4-CF3-Ph)}    & {--}  & 35            &   1:5 \\
    &   DavePhos            & {--}  & 12            &   1:3 \\
    &   XPhos               & {--}  & 12            &   1:1 \\
    &   dppm                &  72   & 79            &   1:4 \\
    &   dppe                &  85   & 80            &   1:4 \\
    &   dppp                &  91   & 79            &   1:4 \\
    &   dppf                &  96   & 83            &   1:4 \\
    &   DPEPhos             & 102   & 86            &   1:4 \\
    &   NixantPhos          & 114   & 12            &   1:2 \\
    &   BINAP               &  92   & 48            &   1:4 \\
    &   AnthPhos            & {--}  & 36            &   1:4 \\
\end{xltabular}
\lipsum[4]
\end{document}

这使:

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

答案2

假设您确实需要表格与文本块一样宽,那么您最好使用tabular*而不是tabularxltablex(当同一页面中出现多个浮点数时它们可能会混淆)。

在下面的代码中我删除了一些错误的设置并重新组织了序言。

注意:

  1. \fontfamily{phv}\selectfont是错误的,应该省略。
  2. \def\pdfshellescape{1}是应该绝不出現。永遠。
  3. p选项应该总是被给予。
  4. 确保heightrounded行数为整数。
\documentclass[a4paper,11pt, openany]{scrbook}

\usepackage[scaled]{helvet}
\usepackage[T1]{fontenc}
\usepackage{textgreek}
\usepackage[margin=2.5cm,heightrounded]{geometry}             % Easy page layout
\usepackage{indentfirst}  %indents the first line after a section or chapter
\usepackage[section]{placeins} %should keep tables and figures in their sections
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[font=footnotesize,labelfont=bf,hypcap=false,singlelinecheck=false]{subcaption}

%% tables
\usepackage{array}
\usepackage{booktabs}               % Better table layouts
%\usepackage{tabularx}               %Package to set table widths
%\usepackage{ltablex}                %For Tables that overflow a row
\usepackage[svgnames,table]{xcolor} % note the table option

%\usepackage{multicol}   % i think this is for columnd articles, can probably disable

%% chemistry
\usepackage{siunitx}
\usepackage[version=3]{mhchem}      % Formula subscripts using \ce{}

%% settings
\onehalfspacing
\renewcommand{\arraystretch}{1.1} 
\renewcommand\familydefault{\sfdefault} 
\setcapindent{0pt}    %setting caption indent to 0

%\keepXColumns

\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}} %\rownum is a counter for table rows

%\newcolumntype{C}[1]{>{\centering}m{#1}} %manual width column widths
%\newcolumntype{Y}{>{\centering\arraybackslash}X} %Autospaced column widths with centre alignment
\newcolumntype{F}{S[table-format=2,table-space-text-post=\footnotemark]} %column aligned in center to right digit ignoring superscript

\sisetup{detect-all}

%% personal commands

\newcommand{\SupS}[1]{\textsuperscript{#1}} %modified SuperScript command
\newcommand{\SubCap}[1]{\par\parbox[t]{\columnwidth}{\raggedright\footnotesize{#1}}}  %My own subcaption command used under tabularx within table environment  

%%%%\def\pdfshellescape{1} <----  ????????????????

\begin{document}

\lipsum

\lipsum

\begin{table}[htp]  %Table 1

    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}\hspace{\tabcolsep}}cccFc}
        \toprule
        \textbf{Entry\SupS{a}}&\textbf{Ligand}&\textbf{Bite angle}& \textbf{Yield(\%)\SupS{b}}  &   \textbf{E:Z}\\ 
        \midrule
        \rownumber  &\ce{P(2-furyl)3}&  --  &27 &   1:3\\
        \rownumber  &\ce{PPh3}          &   --  &22 &   1:4\\
        \rownumber  &\ce{P(2-Tol)3} &   --  &13 &   1:2\\
        \rownumber  &\ce{PPh2Cy}    &   --  &3  &   1:2\\   
        \rownumber  &\ce{P(4-F-Ph)} &   --  &37 &   1:4\\
        \rownumber  &\ce{P(4-CF3-Ph)}&  -- &35  &   1:5\\
        \rownumber  &DavePhos           &   --  &12 &   1:3\\
        \rownumber  &XPhos                  &   --  &12 &   1:1\\
        \rownumber  &dppm                   & 72    & 79    &   1:4\\
        \rownumber  &dppe                   &   85 & 80 &   1:4\\
        \rownumber  &dppp                   &   91  & 79    &   1:4\\
        \rownumber  &dppf                   &   96  & 83    &   1:4\\
        \rownumber  &DPEPhos            &   102 &86\SupS{c}&1:4\\
        \rownumber  &NixantPhos     &   {~}114  &12 &   1:2\\
        \rownumber  &BINAP                  &   92 &48  &   1:4\\
        \rownumber  &AnthPhos           &   --  &36 &   1:4\\
        \bottomrule
    \end{tabular*}
    \SubCap{Sub-caption text}
\end{table}
    \setcounter{magicrownumbers}{0}





\begin{table}[htbp] %Table2

    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}\hspace{\tabcolsep}}ccFc}
        \toprule
        \textbf{Entry\SupS{a}}&\textbf{Pd Source}&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &\ce{Pd2(dba)3.CHCl3} (2.5 mol{\%}) &86\SupS{c} &   1:4         \\
        \rownumber  &\ce{Pd(OAc)2} (5.0 mol\%)              &79                 &   1:4         \\  
        \rownumber  &\ce{Pd(dba)2} (5.0 mol\%)              &85\SupS{c} &   1:4         \\
        \rownumber  &\ce{Pd(Cp)Cinammyl} (5.0 mol\%)&80                 &   1:5         \\
        \rownumber  &\ce{PdCl2(PPh3)2} (5.0 mol\%)      &50                 &   1:4         \\
        \rownumber  &\ce{Pd(allyl)(COD)BF4} (5.0 mol\%)&60                  &   1:4         \\
        \rownumber  &\ce{Pd(OPiv)2} (5.0 mol\%)         &36                 &   1:5         \\
        \bottomrule
    \end{tabular*}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}





\begin{table}[htbp] %Table 3

    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}\hspace{\tabcolsep}}ccFc}
        \toprule
        \textbf{Entry\SupS{a}}&Acetal equiv.&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &               1.5         &86\SupS{c}                 &   1:9         \\
        \rownumber  &               1.1         &78                 &   1:7         \\
        \rownumber  &               2.0         &84                 &   1:8         \\
        \rownumber  &               3.0         &72                 &   1:7         \\
        \bottomrule
    \end{tabular*}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}
\lipsum[1-2]



\begin{table}[htp]  %Table 4

    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}\hspace{\tabcolsep}}ccFc}
        \toprule
        \textbf{Entry\SupS{a}}&tether premix time&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &               60 min          &80\SupS{c}                 &   1:9         \\
        \rownumber  &               10 min          &83                 &   1:9     \\
        \rownumber  &               0 min           &83\SupS{c}                 &   1:9         \\
        \rownumber  &               Direct addition         &84                 &   1:8         \\
        \bottomrule
    \end{tabular*}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}


\begin{table}[htbp]  %Table 5

    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}\hspace{\tabcolsep}}cccc}
        \toprule
        \textbf{Entry\SupS{a}}&Comment&\textbf{Yield(\%)\SupS{b}}&\textbf{E:Z}\\ 
        \midrule
        \rownumber  &               Ligand: XantPhos            &   trace  &    --  \\
        \rownumber  &               Base: \ce{Cs3PO4}           &   69      &   1:6 \\
        \rownumber  &               Addition of CsOTf           &   73          &   1:7         \\
        \bottomrule
    \end{tabular*}
    \SubCap{Sub-caption text}
\end{table}
\setcounter{magicrownumbers}{0}

\lipsum

\end{document}

在此处输入图片描述

相关内容