在组合浮点数(图形和表格)中使用标题包引用表格

在组合浮点数(图形和表格)中使用标题包引用表格

我正在尝试创建一个包含三个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}

相关内容