如何使用 \twopagepicture 创建简短的标题(作为 \listoffigures 条目)?

如何使用 \twopagepicture 创建简短的标题(作为 \listoffigures 条目)?

使用\twopagepicture类似本例中的命令(如何在两页上添加图片,左侧部分在左侧,右侧部分在右侧(用于书籍)?),是否有机会在图形列表中创建一个条目,该条目仅包含非常长的图形标题的一部分(而不是“...非常...长的标题”本身;类似于命令\caption[]{}),例如

....
\twopagepicture{t}{p}{image}*[short caption]*{Other test with 
very very very very very very very very very very very
very very very very very very very very very very very
very very very very very very very very very very very
long caption
}
...,

从上面发布的例子开始?我在论文中遇到了这个问题,因为有一张两页的图表,长标题是不可避免的。当然,一个一般的选择是在文本中给出图表的细节,但 (a) 这不符合我导师的批准,(b) 图表标题中的“有关更多详细信息,请参阅文本”之类的声明也会进入图表列表,我认为这不足以作为 LoF 条目。所以这个选项实际上不适合我。也许答案很简单,但我还没有遇到过......

非常感谢您的任何建议。非常感谢您抽出时间!

答案1

只是为了让人们知道,这是您引用的漂亮的代码,由 Martin Scharrer 编写:

\makeatletter
\newcommand*{\twopagepicture}[4]{%
    \checkoddpage
    \ifoddpage
        \expandafter\@firstofone
    \else
        \expandafter\afterpage
    \fi
    {\afterpage{%
    \if #1t%
        \if #2p%
            \thispagestyle{empty}%
            \afterpage{\thispagestyle{empty}}%
        \fi
    \fi
    \begin{figure}[#1]
        \if #2p%
            \if #1t%
                \vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
            \fi
        \fi
        \if #1b%
            \caption{#4}%
        \fi
        \makebox[\textwidth][l]{%
        \if #2p\relax
            \let\mywidth\paperwidth
            \hskip-\dimexpr1in+\hoffset+\evensidemargin\relax
        \else
            \let\mywidth\linewidth
        \fi
        \adjustbox{trim=0 0 {.5\width} 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
        \if #1b\else
            \caption{#4}%
        \fi
        \if #2p%
            \if #1b%
                \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
            \fi
        \fi
    \end{figure}%
    \begin{figure}[#1]
        \if #2p%
            \if #1t%
                \vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
            \fi
        \fi
        \makebox[\textwidth][l]{%
        \if #2p%
            \let\mywidth\paperwidth
            \hskip-\dimexpr1in+\hoffset+\oddsidemargin\relax
        \else
            \let\mywidth\linewidth
        \fi
        \adjustbox{trim={.5\width} 0 0 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
        \if #2p%
            \if #1b%
                \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
            \fi
        \fi
    \end{figure}%
    }}%
}
\makeatother

为了实现您想要的效果,请替换以下两行:

            \caption{#4}%

            \caption#4%

所以

\makeatletter
\newcommand*{\twopagepicture}[4]{%
    \checkoddpage
    \ifoddpage
        \expandafter\@firstofone
    \else
        \expandafter\afterpage
    \fi
    {\afterpage{%
    \if #1t%
        \if #2p%
            \thispagestyle{empty}%
            \afterpage{\thispagestyle{empty}}%
        \fi
    \fi
    \begin{figure}[#1]
        \if #2p%
            \if #1t%
                \vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
            \fi
        \fi
        \if #1b%
            \caption#4%
        \fi
        \makebox[\textwidth][l]{%
        \if #2p\relax
            \let\mywidth\paperwidth
            \hskip-\dimexpr1in+\hoffset+\evensidemargin\relax
        \else
            \let\mywidth\linewidth
        \fi
        \adjustbox{trim=0 0 {.5\width} 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
        \if #1b\else
            \caption#4%
        \fi
        \if #2p%
            \if #1b%
                \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
            \fi
        \fi
    \end{figure}%
    \begin{figure}[#1]
        \if #2p%
            \if #1t%
                \vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
            \fi
        \fi
        \makebox[\textwidth][l]{%
        \if #2p%
            \let\mywidth\paperwidth
            \hskip-\dimexpr1in+\hoffset+\oddsidemargin\relax
        \else
            \let\mywidth\linewidth
        \fi
        \adjustbox{trim={.5\width} 0 0 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
        \if #2p%
            \if #1b%
                \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
            \fi
        \fi
    \end{figure}%
    }}%
}
\makeatother

\twopagepicture现在按如下方式使用该命令:

\twopagepicture{b}{l}{image}{{Test}}

当你不需要缩写标题时(请注意最后一个参数中的双括号),并且

\twopagepicture{t}{p}{image}{[abbreviation]{Other test with
very very very very very very very very very very very
very very very very very very very very very very very
very very very very very very very very very very very
long caption}}

当您确实想要缩写标题时([abbreviation]在本例中)。

答案2

如果caption使用包替换

\newcommand*{\twopagepicture}[4]{%

\newcommand*{\twopagepicture}[3]{%
  \caption@withoptargs{\@twopagepicture{#1}{#2}{#3}}}
\newcommand*{\@twopagepicture}[5]{%

并在宏定义中替换

\caption{#4}%

(两次)

\caption#4{#5}%

然后

\twopagepicture{t}{p}{image}[short caption]{Other test with 
very very very very very very very very very very very
very very very very very very very very very very very
very very very very very very very very very very very
long caption
}

应该可以按预期工作。

\caption@withoptargs收集可选参数并将它们作为额外参数传递,#4就是这种情况。如果没有给出可选参数,则这个额外参数为空。)

相关内容