0

I am using the bicaption package with the following style and I encountered a problem with the option format. Does someone know how to get a good way to proceed?

The current format looks like:

Bild 1.1:|--x--|Unterschrift
Fig 1.1: |--x--|caption

The extra distance |--x--| is managed by format= X.Xcm within the bicaption options. It works quite nicely. But when I am using a very long, in fact douple line caption I encountered a case like:

Bild 1.1:|--x--|Unterschrift...
sehr lang
Fig 1.1: |--x--|very long...
caption

I wanted to change this to

Bild 1.1:|--x--|Unterschrift...
                sehr lang
Fig 1.1: |--x--|very long...
                caption

This means a hanging format. But when I change format=hang of course the extra distance is gone an it will look like this:

Bild 1.1: Unterschrift...
          sehr lang
Fig 1.1:  very long...
          caption

Thank for any idea how to combine the two things!

Here is a MWE:

\documentclass[12pt,BCOR0pt,DIV12]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[labelfont=it, skip=-12pt, justification=raggedright,singlelinecheck=false, margin={2mm,0mm},hang]{caption}
\usepackage[labelfont=it, skip=-12pt, justification=raggedright,singlelinecheck=false, margin={2mm,0mm}]{bicaption}
\captionsetup[figure][bi]{labelfont=it, justification=raggedright, singlelinecheck=false, margin={0mm,0mm}}
\addto\captionsngerman{\renewcommand\figurename{Test}}
\captionsetup[figure][bi-first]{name=Test}
\captionsetup[figure][bi-second]{name=Fig.}
\numberwithin{figure}{section}
\DeclareCaptionFormat{4.0cm}{\hbox to 4.0cm{#1#2\hfill}#3\par}
\captionsetup[figure][bi]{format=4.0cm}

\begin{document}

\lipsum[1]

\begin{figure}[h!]
  \includegraphics[draft,width=\textwidth]{Beispiel}
  \captionsetup{skip=0pt}
  \bicaption[indention=0pt]{Dies ist eine sehr lange Unterschrift in zwei Sprachen die über eine Zeile hinaus geht}{This is supposed to be a very long multiline caption in two languages}  
  \label{fig:Beispiel}
\end{figure}

\lipsum[2]

\end{document}
  • \usepackage[format=hang]{caption} – John Kormylo Sep 24 '16 at 13:20
  • 2
    Can you please show us a small MWE how you use bicaption? – user36296 Sep 24 '16 at 15:17
  • How could we help you to modify the definition of the caption format X.Xcm if you don't reveal how it's defined? If you don't want to give us a MWE please tell us at least how X.Xcm is currently defined (with \DeclareCaptionFormat). – Axel Sommerfeldt Sep 30 '16 at 7:06
  • @Kantl are you the same who asked the question? The Stack Exchange staff can merge them together for you. – user36296 Sep 30 '16 at 12:09
2

A \parbox around the caption text might do the trick:

\documentclass[12pt,BCOR0pt,DIV12]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[labelfont=it, skip=-12pt, justification=raggedright,singlelinecheck=false, margin={2mm,0mm},hang]{caption}
\usepackage[labelfont=it, skip=-12pt, justification=raggedright,singlelinecheck=false, margin={2mm,0mm}]{bicaption}
\captionsetup[figure][bi]{labelfont=it, justification=raggedright, singlelinecheck=false, margin={0mm,0mm}}
\addto\captionsngerman{\renewcommand\figurename{Test}}
\captionsetup[figure][bi-first]{name=Test}
\captionsetup[figure][bi-second]{name=Fig.}
\numberwithin{figure}{section}
\DeclareCaptionFormat{4.0cm}{\hbox to 4.0cm{#1#2\hfill}\parbox[t]{\dimexpr\linewidth-4cm\relax}{#3}\par}
\captionsetup[figure][bi]{format=4.0cm}

\begin{document}

\lipsum[1]

\begin{figure}[h!]
  \includegraphics[draft,width=\textwidth]{example-image}
  \captionsetup{skip=0pt}
  \bicaption[indention=0pt]{Dies ist eine sehr lange Unterschrift in zwei Sprachen die über eine Zeile hinaus geht}{This is supposed to be a very long multiline caption in two languages}  
  \label{fig:Beispiel}
\end{figure}

\lipsum[2]

\end{document}

enter image description here

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.