Using the command in Why does parameter double when used in caption?, it works in most cases, but in a few cases (like 1 out of 20) \\
does not start a new line.
For example using
\begin{table}
\centering%
\begin{tabular}{llllll}
\hline
\textbf{Bezeichnung} & \textbf{x} & \textbf{y} & \textbf{z} &
$\mathbf{u'_N}$ & $\mathbf{v'_N}$ \\
\hline
... & ... & ... & ... & ... & ...
%...
\hline
\end{tabular}
\caption[Koordinaten ausgewählter Weißpunkte]%
{\label{\Lt{Weisspunkte}}Koordinaten ausgewählter Weißpunkte%
\FS[Quelle]{\cite[S.~279]{poynton_digital_2012}\index{Illuminant}}}
\end{table}
in a table does not start a new line before Quelle
, like this (see yellow line; rest of page pixelated to emphasize the important parts and to improve image compression):
Or shown in detail:
Note that the same command inserts a line-break before "Bildquelle:" in the figure above the table. I could not find a reference to a similar problem; could it be that LaTeX tried to avoid the line-break if vertical space on the page is tight?
Additions
For those who failed to find the \\
, here it is (answer from the reference):
\newcommand{\FS}[2][Bildquelle]{%
\protect\ifthenelse{\equal{#1}{}}%
{\protect\\{\protect\scriptsize{}#2}}
{\protect\\{\protect\scriptsize{}#1: #2}}}
Forcing table 6.1 on a new page did not change the behavior. Making the caption text a bit longer or shorter also did not change the behavior. However when I changed the caption to
\caption[Koordinaten ausgewählter Weißpunkte]%
{\label{\Lt{Weisspunkte}}Lorem ipsum Koordinaten ausgewählter Weißpunkte%
\FS[Quelle]{\cite[S.~279]{poynton_digital_2012}\index{Illuminant}}}
then the table went to the next page, and the line break was inserted:
MWE
Finally I managed to create a MWE (pdflatex, actually it was easier than expected):
\documentclass[a4paper,twoside]{report}
\usepackage[german]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ifthen}
\usepackage[pdftex,colorlinks,hypertexnames=false]{hyperref}
\usepackage{makeidx}
\usepackage{showidx}
\newcommand{\FS}[2][Bildquelle]{%
\protect\ifthenelse{\equal{#1}{}}{%
\protect\\*{\protect\scriptsize{}#2}}{%
\protect\\*{\protect\scriptsize{}#1: #2}}}
\begin{document}
%
\begin{table}
\centering%
\begin{tabular}{llllll}
\hline
\textbf{Bezeichnung} & \textbf{x} & \textbf{y} & \textbf{z} &
$\mathbf{u'_N}$ & $\mathbf{v'_N}$ \\
\hline
A & B & C & D & E & F \\
A & B & C & D & E & F \\
A & B & C & D & E & F \\
A & B & C & D & E & F \\
\hline
\end{tabular}
\caption[Koordinaten ausgewählter Weißpunkte]%
{\label{Weisspunkte}Koordinaten ausgewählter Weißpunkte%
\FS[Quelle]{[Poy12, S.~279]\index{Illuminant}}}
\end{table}
%
\begin{table}
\centering%
\begin{tabular}{llllll}
\hline
\textbf{Bezeichnung} & \textbf{x} & \textbf{y} & \textbf{z} &
$\mathbf{u'_N}$ & $\mathbf{v'_N}$ \\
\hline
A & B & C & D & E & F \\
\hline
\end{tabular}
\caption[Koordinaten ausgewählter Weißpunkte]%
{\label{Weisspunkte2}Koordinaten ausgewählter Weißpunkte%
\FS[Quelle]{[Poy12, S.~279]\index{Illuminant}}}
\end{table}
\end{document}
Solution (https://tex.stackexchange.com/a/518731/182650)
After adding
\usepackage[font=small,labelfont={sf,bf},position=bottom,singlelinecheck=false]%
{caption}
\Lt
which I could not find. – Jasper Habicht Nov 30 '19 at 22:34\Lt{X}
withX
, it doesn't change the effect (which was expected, because\Lt
stands for "label table", and effectively it just adds a prefix to the label given:\newcommand{\Lt}[1]{tab:#1}
). – U. Windl Nov 30 '19 at 22:57\parbox
to make a box of the correct height. – Teepeemm Nov 30 '19 at 23:30