xltabular 在 documen-pic.pdf 中生成的图像过多

xltabular 在 documen-pic.pdf 中生成的图像过多

这是上一个问题导致ltablex内容从页面中掉落。根据其中一个答案的建议,我将 longtable 包更改为,xltabular这似乎已经解决了该问题,但现在我似乎遇到了一个新问题。编译表格时,所有图像都会按顺序放入 document-pic.pdf 中,但该过程重复三次。这意味着当在表格之后再次调用图片时,它会放入表格中的第一张图片。

我需要使用一个长表,因为表中的行比示例中的要多得多,所以我希望它能够跨页。

\documentclass[a4paper, draft=true,11pt, openany]{scrbook}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault} 
\usepackage[T1]{fontenc}
\usepackage[margin=2.5cm]{geometry}             % Easy page layout
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing

\usepackage[export]{adjustbox}
\fboxsep=5mm%padding thickness
\fboxrule=1.5pt%border thickness

%%%%%%%%%%%% Tables%%%%%%%%%%%%%%
\usepackage{array}
\usepackage{booktabs}               % Better table layouts

\usepackage{xltabular}
\usepackage{threeparttable}
\usepackage{makecell, multirow}
\usepackage[usenames,dvipsnames,table]{xcolor} % note the table option

\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}%
    \arabic{magicrownumbers}}

\usepackage{etoolbox}
\AtEndEnvironment{table}{\setcounter{magicrownumbers}{0}}

\newcolumntype{C}[1]{>{\centering}m{#1}} %manual width column widths
\newcolumntype{Y}{>{\centering\arraybackslash}X} %Autospaced column widths with centre alignment
\newcommand\mcx[1]{\multicolumn{1}{>{\centering\arraybackslash\bfseries}X}{#1}}

\renewcommand{\arraystretch}{1.1} % Spreads table rows 

%%%%%%%%%%%%%%%%Chemical Tracking%%%%%%%%%%%%%%%%%%%%%%
\usepackage{bpchem}
\usepackage[varioref=false,journal=angew,tracking=bpchem]{chemstyle}
\usepackage[version=3]{mhchem}      % Formula subscripts using \ce{}
\usepackage{psfrag}
\usepackage[
runs=2,crop=off,
%off,
]{auto-pst-pdf}

\newcommand{\schemenumber}  {\fontsize{9.2pt}{9.2pt} \selectfont}
\renewcommand*{\schemerefformat}{\schemenumber\textsf}
\renewcommand*\schemerefmarker{X}
\newcommand{\FigureScale}{0.8} %adjust to alter figure sizes
\cstsetup{radhyphen = false,radsuper = true}

\newcommand{\PdTwo}{\ce{Pd2(dba)3}$\cdot$\ce{CHCl3}}

\newcommand{\LABreplace}[2]{\psfrag{#1}[cc][][0.845][0]{#2}}  %PSFrag Lable replace 3rd [0.845] with scale factor for label text
\newcommand{\LABreplacePD}{\psfrag{LAB1}[cc][][0.845][0]{\PdTwo\ (2.5 mol\%)}}

\newcommand{\IntSchemeComp}{
    \begin{psfrags}
        \schemeref[X1]{3SMB}
        \schemeref[X2]{CF3Tether}
        \schemeref[X3]{BrAlkyne}
        \schemeref[X4]{3PB}
        \LABreplacePD
        \LABreplace{LAB2}{XantPhos (7.5\%)}
        \LABreplace{LAB3}{\ce{K3PO4} (1.3 equiv.)}
        \LABreplace{LAB4}{DCE [0.2 M], 60 \celsius}
        \includegraphics[scale=\FigureScale]{Figures/IntTableScheme}
    \end{psfrags}
}

\newcommand{\ScoGraph}[1]{\adjustbox{valign=c}{%    %need adjust box
        \includegraphics[scale=\FigureScale]{Figures/#1}}}

\begin{document}
\CNlabelsubnoref{3SMB}{01}\CNlabelsubnoref{3SMB}{02}\CNlabelsubnoref{3SMB}{03}\CNlabelsubnoref{3SMB}{04}\CNlabelsubnoref{3SMB}{05}
\CNlabelnoref{3SMB}\CNlabelnoref{CF3Tether}\CNlabelnoref{BrAlkyne}\CNlabelnoref{3PB}
\CNlabelsubnoref{3PB}{01}\CNlabelsubnoref{3PB}{02}\CNlabelsubnoref{3PB}{03}\CNlabelsubnoref{3PB}{04}\CNlabelsubnoref{3PB}{05}
\begin{threeparttable}
\setlength\tabcolsep{2.0pt}
\begin{xltabular}{\textwidth}{ccccccc}
    \caption{Scope of reaction with propargylic amines.}\label{tab:IntProdScope}\\
    \multicolumn{7}{Y}{\IntSchemeComp}\\
    \toprule
    \mcx{Entry}&    \mcx{Substrate}&    \phantom{XXX}   &   \mcx{Product}&\phantom{XXX} &   \mcx{Yield (\%)}&   \mcx{E:Z}\\
    \midrule
    \endfirsthead
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
    \caption{(continued\dots) Scope of reaction with propargylic amines.}\\
    \multicolumn{7}{Y}{\IntSchemeComp}\\
    \toprule
    \textbf{Entry}&\textbf{Substrate}&  \phantom{XXX}   &\textbf{Product}&\phantom{XXXX}    &\textbf{Yield (\%)}&\textbf{E:Z}\\
    \midrule
    \endhead
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
    \midrule
    \multicolumn{7}{l}{\raggedright{Reaction conditions}} \\
    \endfoot
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
    \rownumber  &\ScoGraph{3SMB01}  &\CNrefsub{3SMB}{01}    &\ScoGraph{3PB01}   &   \CNrefsub{3PB}{01}  &   64  &   1:10    \\
    \rownumber  &\ScoGraph{3SMB02}  &\CNrefsub{3SMB}{02}    &\ScoGraph{3PB02}   &   \CNrefsub{3PB}{02}  &   64  &   1:10    \\
    \rownumber  &\ScoGraph{3SMB03}  &\CNrefsub{3SMB}{03}    &\ScoGraph{3PB03}   &   \CNrefsub{3PB}{03}  &   64  &   1:10    \\
    \rownumber  &\ScoGraph{3SMB04}  &\CNrefsub{3SMB}{04}    &\ScoGraph{3PB04}   &   \CNrefsub{3PB}{04}  &   64  &   1:10    \\
    \rownumber  &\ScoGraph{3SMB05}  &\CNrefsub{3SMB}{05}    &\ScoGraph{3PB05}   &   \CNrefsub{3PB}{05}  &   64  &   1:10    \\
\end{xltabular}
\end{threeparttable}

\setlength\tabcolsep{6.0pt}
\par

\ScoGraph{3SMB01}\par

\ScoGraph{3SMB01}\par

\ScoGraph{3SMB01}\par

\ScoGraph{3SMB01}\par
\end{document}

在此处输入图片描述

我不确定我是否错误地实现了表格,我没有看到它。但当它编译时,有 64 张图片被放入 document-pics.pdf 中。TeXstudio 向我发出警告,document-pics.pdf' contains 64 pages (pst-pdf) but 16 pages are requested: (pst-pdf) File 'document-pics.pdf' is no more valid! (pst-pdf) Recreate it . 但我需要pst-pdfpsfrag/chemical 编号

我有一个链接到 OneDrive 文件夹所以你最好看到问题并使用 .eps 图像

答案1

xltabular在这种情况下使用是没有意义的。只需使用longtable

\documentclass[a4paper, draft=true,11pt, openany]{scrbook}

\usepackage[margin=2.5cm]{geometry}             % Easy page layout
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing

\usepackage[export]{adjustbox}
\fboxsep=5mm%padding thickness
\fboxrule=1.5pt%border thickness

%%%%%%%%%%%% Tables%%%%%%%%%%%%%%
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}               % Better table layouts
\usepackage[usenames,dvipsnames,table]{xcolor} % note the table option

\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}

\usepackage{etoolbox}
\AtEndEnvironment{table}{\setcounter{magicrownumbers}{0}}

\newcommand\mcx[1]{\multicolumn{1}{>{\bfseries}c}{#1}}

\renewcommand{\arraystretch}{1.1} % Spreads table rows 

%%%%%%%%%%%%%%%%Chemical Tracking%%%%%%%%%%%%%%%%%%%%%%
\usepackage{bpchem}
\usepackage[varioref=false,journal=angew,tracking=bpchem]{chemstyle}
\usepackage[version=3]{mhchem}      % Formula subscripts using \ce{}
\usepackage{psfrag}
\usepackage[crop=off,
%off,
]{auto-pst-pdf}

\newcommand{\schemenumber}{\fontsize{9.2pt}{9.2pt} \selectfont}
\renewcommand*{\schemerefformat}{\schemenumber\textsf}
\renewcommand*\schemerefmarker{X}
\newcommand{\FigureScale}{0.8} %adjust to alter figure sizes
\cstsetup{radhyphen = false,radsuper = true}

\newcommand{\PdTwo}{\ce{Pd2(dba)3}$\cdot$\ce{CHCl3}}

\newcommand{\LABreplace}[2]{\psfrag{#1}[cc][][0.845][0]{#2}}  %PSFrag Lable replace 3rd [0.845] with scale factor for label text
\newcommand{\LABreplacePD}{\psfrag{LAB1}[cc][][0.845][0]{\PdTwo\ (2.5 mol\%)}}

\newcommand{\IntSchemeComp}{%
    \begin{psfrags}
        \schemeref[X1]{3SMB}
        \schemeref[X2]{CF3Tether}
        \schemeref[X3]{BrAlkyne}
        \schemeref[X4]{3PB}
        \LABreplacePD
        \LABreplace{LAB2}{XantPhos (7.5\%)}
        \LABreplace{LAB3}{\ce{K3PO4} (1.3 equiv.)}
        \LABreplace{LAB4}{DCE [0.2 M], 60 \celsius}
        \includegraphics[scale=\FigureScale]{Figures/IntTableScheme}
    \end{psfrags}%
}

\newcommand{\ScoGraph}[1]{\adjustbox{valign=c}{%    %need adjust box
        \includegraphics[scale=\FigureScale]{Figures/#1}}}

\begin{document}
\CNlabelsubnoref{3SMB}{01}\CNlabelsubnoref{3SMB}{02}\CNlabelsubnoref{3SMB}{03}\CNlabelsubnoref{3SMB}{04}\CNlabelsubnoref{3SMB}{05}
\CNlabelnoref{3SMB}\CNlabelnoref{CF3Tether}\CNlabelnoref{BrAlkyne}\CNlabelnoref{3PB}
\CNlabelsubnoref{3PB}{01}\CNlabelsubnoref{3PB}{02}\CNlabelsubnoref{3PB}{03}\CNlabelsubnoref{3PB}{04}\CNlabelsubnoref{3PB}{05}
%\begin{threeparttable}
\setlength\tabcolsep{2.0pt}
\begin{longtable}{ccccccc}
\caption{Scope of reaction with propargylic amines.\label{tab:IntProdScope}}\\
\multicolumn{7}{c}{\IntSchemeComp}\\\toprule
\mcx{Entry}&    \mcx{Substrate}&    \phantom{XXX}   &   \mcx{Product}&\phantom{XXX} &   \mcx{Yield (\%)}&   \mcx{E:Z}\\\midrule
\endfirsthead
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
\multicolumn{7}{@{}l}{(continued\dots) Scope of reaction with propargylic amines.}\\
\multicolumn{7}{c}{\IntSchemeComp}\\\toprule
\textbf{Entry}&\textbf{Substrate}&  \phantom{XXX}   &\textbf{Product}&\phantom{XXXX}    &\textbf{Yield (\%)}&\textbf{E:Z}\\
\midrule
\endhead
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
\midrule
    \multicolumn{7}{l}{\raggedright{Reaction conditions}} \\
    \endfoot
    % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
    \rownumber  &\ScoGraph{3SMB01}  &\CNrefsub{3SMB}{01}    &\ScoGraph{3PB01}   &   \CNrefsub{3PB}{01}  &64 &   1:10    \\
    \rownumber  &\ScoGraph{3SMB02}  &\CNrefsub{3SMB}{02}    &\ScoGraph{3PB02}   &   \CNrefsub{3PB}{02}  &64 &   1:10    \\
    \rownumber  &\ScoGraph{3SMB03}  &\CNrefsub{3SMB}{03}    &\ScoGraph{3PB03}   &   \CNrefsub{3PB}{03}  &64 &   1:10    \\
    \rownumber  &\ScoGraph{3SMB04}  &\CNrefsub{3SMB}{04}    &\ScoGraph{3PB04}   &   \CNrefsub{3PB}{04}  &64 &   1:10    \\
    \rownumber  &\ScoGraph{3SMB05}  &\CNrefsub{3SMB}{05}    &\ScoGraph{3PB05}   &   \CNrefsub{3PB}{05}  &64 &   1:10    \\
\end{longtable}

\setlength\tabcolsep{6.0pt}
\ScoGraph{3SMB01}\par
\ScoGraph{3SMB01}\par
\ScoGraph{3SMB01}\par
\ScoGraph{3SMB01}\par
\end{document}

xltabular多次写入其内容以测量正确的列宽,这对于来说是一个问题psfrag

在此处输入图片描述

相关内容