2

Using the \twopagepicture command like in this example (How to include a picture over two pages, left part on left side, right on right (for books)?), is there any chance to create an entry to the List of Figures which only takes part of a very long figure caption (instead of the "...very very...long caption" itself; similar to the \caption[]{} command), such as

....
\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
}
...,

starting form the above-posted example? I am facing this problem in my thesis for a two-page figure where a long caption is inevitable. A general option, of course, would be to give the details on the figure in the text but (a) this does not meet with my supervisor´s approval, and (b) a statement like "See text for further details" in the figure caption would also enter the List of Figures which, I think, is not adequate for a LoF entry. So this option is actually not an option for me. Maybe the answer is very simple but I have not come across it yet...

Any suggestions are highly appreciated. Thank you very much for your time!

2

2 Answers 2

2

Just to let people know, this is the beautiful code you cite, written by 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

To achieve what you want, replace the two lines:

            \caption{#4}%

with

            \caption#4%

so to have

\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

Now use the command \twopagepicture in this way:

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

when you DON'T want the abbreviated caption (note the double braces in the last argument), and

\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}}

when you DO want the abbreviated caption ([abbreviation] in this case).

1
  • Dear Karl, thank you very much for your rapid answer. It works like a charm! Now that I know it works, I will certainly take the time to work out HOW it works... Thanks once again!
    – Oliver
    Commented Aug 19, 2013 at 15:26
2

If the caption package is used replace

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

with

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

and within the macro definition replace

\caption{#4}%

(twice) with

\caption#4{#5}%

Afterwards

\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
}

should work as expected.

(\caption@withoptargs collects optional arguments and passes them as extra argument, #4 is this case. If no optional argument is given this extra argument is empty.)

2
  • Thank you very much for your answer! Since I am certainly not an expert in LaTeX at all, I wonder what the differences in your solution and the one by karlkoeller (see above) are, e.g., concerning robustness, avoiding conflicts? If your time allows, could you specify what the benefits of using \caption@withoptargs are? Thank you.
    – Oliver
    Commented Aug 20, 2013 at 14:13
  • @Oliver There is no difference regarding robustness or conflicts, the only difference I see is the syntax. While it is \twopagepicture{b}{l}{image}{{Test}} resp. \twopagepicture{b}{l}{image}{[Text for LOF]{Test}} in Karl's solution (extra braces needed), it is \twopagepicture{b}{l}{image}{Test} resp. \twopagepicture{b}{l}{image}[Text for LOF]{Test} in my solution (no extra braces needed).
    – user2574
    Commented Aug 21, 2013 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .