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}
  • Where is picins.sty? – Ryan Mar 30 '15 at 23:51
  • Line 5 in the code-box. Or did I misunderstand you? – michael Mar 31 '15 at 6:01
  • I mean where can people answering find the .sty file itself? – Ryan Mar 31 '15 at 6:14
  • The package is available at CTAN: ctan.org/pkg/picins – michael Mar 31 '15 at 12:42
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}

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.