5

I want to have text of a certain width less than the page width, which goes across several pages. Normally you’d put text into a (\par)box to set its width but these boxes cannot be broken across pages so I can’t use it here.

I tried looking at the internal definition of \parbox (more precisely \@iiiparbox) but I cannot make heads nor tails of it – it doesn’t look like it can be adapted to allow page breaks, though.

Background:

The reason I want to do this is that I have a figure caption (which is centered and of a given text width) and is too long for the page and thus cut off. There are numerous questions about how to solve this (e.g. Break figure description over two pages) but none offers an actual solution to the problem.

For now I’ve simply opted out of using a float and use the following instead:

\begin{center}
    \includegraphics
    \captionof{figure}{looooong caption}
\end{center}

… but that always puts the figure caption on the next page in its entirety, rather than breaking it. (Locally) redefining \@iiiparbox makes it possible to break the figure caption across pages smoothly but then the figure caption takes up the complete page width which is undesired.

3

The default definition of \caption in article and the other standard classes is not boxed if the caption is more than a line. To change the effective line width you should use quote (or an environment with similar definition) which is

\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}

Which just accepts the default increase of \leftmargin and makes \rightmargin the same. You can set the two margins explicitly to any appropriate value in the definition of a custom environment to wrap the caption

\begin{center}
\includegraphics

\nopagebreak
\begin{quote}
\captionof{figure}{looooong caption}
\end{quote}
\end{center}
  • Oh, I was unaware of that. The document uses the caption package with some options, which redefines \caption to be inside a parbox. Thanks, I’ll try this. – Konrad Rudolph Jun 19 '13 at 17:41
  • @KonradRudolph If the actual version of the caption package is used, the \parbox can be switched off by option parbox=none. But be aware that from now on not all features of the caption package are working as expected anymore, for example the indention parameter. – Axel Sommerfeldt Jun 19 '13 at 19:13
  • Unfortunately this solution doesn’t work – it may be due to the fact that I’m using a double-sided layout. If I change \oddsidemargin and \evensidemargin then I get an effect but that effect isn’t restricted to the figure caption, it also indents the figure itself (and even the whole page before that). Furthermore, I don’t succeed in applying an actual margin and making the text less wide – instead, it just shifts the whole page to the right by increasing the outer margin (even though I explicitly decreased the \textwidth as well). – Konrad Rudolph Jun 20 '13 at 9:42
  • @KonradRudolph I'm not sure what you meant didn't work, but changing \oddsidemargin or \evensidemargin or especially \textwidth is almost certainly going to make things go wrong. Changing those within a document is just not really supported. The way to change the margins locally is to use a list environment like quote as I showed. – David Carlisle Jun 20 '13 at 9:54
  • @David Yes, I realised that in the meantime. Regarding your quote code: from everything I read this should work – alas, it doesn’t. It also doesn’t work when I use them enumitem package and change the margins via the option leftmargin=3cm. I’m suspecting that the (rather complex and badly written) custom document class interferes in nontrivial ways. – Konrad Rudolph Jun 20 '13 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.