在組合浮動(圖和表)中使用標題包引用表格

在組合浮動(圖和表)中使用標題包引用表格

我正在嘗試創建一個包含三個figuresassubfigures和一個 的浮點數threeparttable。最後,我想根據caption套件文件中給出的範例建立一個聯合標題。但是,我不希望標題位於表格上方(因為這違背了聯合標題的目的)。然而,不使用環境captionof內部table使得(顯然)不可能單獨引用該表。那麼,如何在不建立額外標題的情況下引用該表格呢?

微量元素:

\documentclass{scrartcl}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\DeclareCaptionLabelFormat{andtable}{#1~#2 \& \tablename~\thetable} % combined Figure and Table
\begin{document}
    \section{some section}
    \begin{figure}[ht]
            \begin{subfigure}[t]{.45\linewidth}
                \includegraphics[width=.1\linewidth]{example}
            \caption{Figure 1 of a couple more\label{fig:subfigure}}
        \end{subfigure}
        \begin{minipage}[b]{.54\textwidth}
            \centering
            \begin{threeparttable}[b]
                \captionof{table}{\label{tab:table}}
                \begin{tabular}{@{}p{0.8\linewidth}@{}}
                    \begin{tabular}{cc}
                    A\tnote{1} & B \\
                    C & D\\
                    \end{tabular}
                \end{tabular}
                \begin{tablenotes}
                    \item [1]  Some footnote.
                \end{tablenotes}
            \end{threeparttable}
        \end{minipage}
        \captionlistentry[table]{This is a table.}\addtocounter{figure}{-1}
        \captionsetup{labelformat=andtable}
        \caption{Joint caption for the figure and the table.\label{fig:figure}}
    \end{figure}

    This is some text for referencing Figure~\ref{fig:figure} and Subfigure~\ref{fig:subfigure}.
    More text referencing Table~\ref{tab:table}.
\end{document}

答案1

\captionlistentry似乎也創建了一個引用,因此您可以\label在其後面添加一個右側:

\documentclass{scrartcl}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\DeclareCaptionLabelFormat{andtable}{#1~#2 \& \tablename~\thetable} % combined Figure and Table
\begin{document}
    \section{some section}
    \begin{figure}[ht]
        \begin{subfigure}[t]{.45\linewidth}
            \includegraphics[width=.1\linewidth]{example}
            \caption{Figure 1 of a couple more\label{fig:subfigure}}
        \end{subfigure}
        \begin{minipage}[b]{.54\textwidth}
            \centering
            \begin{threeparttable}[b]
%%%             \captionof{table}{\label{tab:table}}
                \begin{tabular}{@{}p{0.8\linewidth}@{}}
                    \begin{tabular}{cc}
                    A\tnote{1} & B \\
                    C & D\\
                    \end{tabular}
                \end{tabular}
                \begin{tablenotes}
                    \item [1]  Some footnote.
                \end{tablenotes}
            \end{threeparttable}
        \end{minipage}
        \captionlistentry[table]{This is a table.}\label{tab:table}
        \addtocounter{figure}{-1}
        \captionsetup{labelformat=andtable}
        \caption{Joint caption for the figure and the table.\label{fig:figure}}
    \end{figure}

    This is some text for referencing Figure~\ref{fig:figure} and Subfigure~\ref{fig:subfigure}.
    More text referencing Table~\ref{tab:table}.
\end{document}

相關內容