It seems that math in captions gets stretched out as illustrated in Figures 2, 3 and 4:
The problem shows up with pdflatex on the second run.
The solution given in Lock spacing in math mode of adding an additional curly brace ${y = mx + b}$ works but wondering if there is a better solution for captions.
A bit of stretch in order to justify text would be ok, but in this case that does not seem to be the issue and the stretching seems quite large.
References:
Code:
\documentclass{article}
\usepackage{showframe}
\usepackage{graphicx}
\usepackage{caption}
\DeclareCaptionStyle{mystyle}
{format=plain,%
font=footnotesize,
textformat=period,
justification=RaggedRight,
singlelinecheck=true,
}% all captions are left aligned
\DeclareCaptionStyle{singlelinecentered}
[justification=Centering]% centered if single line and no singlelinecheck=false
{style=mystyle}% other captions are left aligned
\DeclareCaptionStyle{singlelineraggedleft}
[justification=RaggedLeft]% right aligned if single line and no singlelinecheck=false
{style=mystyle}% other captions are left aligned
\captionsetup{style=singlelineraggedleft}
\begin{document}
\noindent
\begin{minipage}{0.5\linewidth}
\centering
\includegraphics[width=0.95\linewidth, height=2cm]{example-image}%
\captionsetup{width=0.95\linewidth}%
\captionsetup{singlelinecheck=false}%
\captionof{figure}{$y=mx+b$ on Left}%
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\centering
\includegraphics[width=0.95\linewidth, height=2cm]{example-image}%
\captionsetup{width=0.95\linewidth}%
\captionof{figure}{$y=mx+b$ on Right}%
\end{minipage}%
\medskip\noindent
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=0.95\linewidth, height=2cm]{example-image}%
\captionsetup{width=0.95\linewidth,style=singlelinecentered}%
\captionof{figure}{$y=mx+b$}%
\end{minipage}%
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=0.95\linewidth, height=2cm]{example-image}%
\captionsetup{width=0.95\linewidth}%
\captionof{figure}{$y=mx+b$}%
\end{minipage}%
\end{document}


pdflatexI don't get any stretching. Bothxelatexandlualatexresult in the stretching you showed. – Skillmon Apr 10 '18 at 06:56pdflatextwice. It seems to be ok on the first run, but not the second. BTW, .I am using pdflatex with TeXLive 2017. – Peter Grill Apr 10 '18 at 07:16