1

While typesetting an illustrated book, I mostly use SCfigures. But in some cases I want the picture to be "wrapped" in the text, but with a caption on the side, so I use picins (see MWE below).

With SCfigures I can choose the options innercaption and ragged, so the caption will align towards the picture, nonetheless if it is on a left or a right page.

Why won't piccaption do this, or better, what will I have to do in order to have it do this? The justification-option of the caption-package doesn't help it even produces errors in combination with sidecap.

    \documentclass{scrbook} 
    \usepackage{
        graphicx,
        float,
        picins,
        wrapfig,
        lipsum}
    \usepackage[
        format=plain,
        singlelinecheck=false,
        skip=2mm,
        labelformat=simple,
        labelsep=newline,
        aboveskip=15pt
    %   justification=raggedright
        ]{caption} 
    \usepackage[
        innercaption,
        wide,
        ragged
        ]{sidecap}
    \sidecaptionvpos{figure}{t}
    \listfiles

    \begin{document}
    \lipsum[1-2]

    \begin{SCfigure}[3][t]
    \caption{1st\\SCfigure\\picture right, ragged left}
    \rule{10mm}{4mm}
    \end{SCfigure}

    \pagebreak\lipsum[1-2]

    \begin{SCfigure}[3][t]
    \rule{10mm}{4mm}
    \caption{2nd\\SCfigure\\picture left, ragged right}
    \end{SCfigure}

    \pagebreak\lipsum[1-2]

    \piccaptiontopside
    \piccaption{3rd\\Caption of picins\\picture right, why not ragged left?}
    \parpic[r,t]{\rule{10mm}{4mm}}

    \pagebreak\lipsum[1-2]

    \piccaptiontopside
    \piccaption{4th\\Caption of picins\\picture left, ragged right}
    \parpic[l,t]{\rule{10mm}{4mm}}

    \end{document}
michael
  • 197

1 Answers1

1

I think I finally found a way: The Stackexchange-question

\raggedouter to typeset marginal text in twoside book

provides a definition for "raggedouter" captions, I turned it into "raggedinner".

Thank you very, very much!

NB: Be careful to use the right order 1. declare the command, 2. call the caption package, 3. declare the caption justification, and 4. use it in captionsetup:

\usepackage{changepage}
\newcommand{\raggedinner}{%
\checkoddpage%
    \ifoddpage%
    \RaggedLeft%
    \else%
    \RaggedRight%
    \fi%
}
\strictpagecheck
\usepackage{caption} 
\DeclareCaptionJustification{raggedinner}{\raggedinner} 
\captionsetup{justification=raggedinner}
michael
  • 197