This is a follow up to here.
I am using this in my preamble:
\makeatletter % inserts a "\centering" to every floatbox.
\g@addto@macro\@floatboxreset\centering
\makeatother
I am having two question for the use of this:
- How can I implement the same thing for subfigures, too? It works fine for all floats, but not for minipages or subfigures (from
subcaption, which are minipages as well). - How can I switch of this behavior locally?
Here is some code for playing around:
% arara: pdflatex
% arara: pdflatex
\documentclass{article}
\usepackage[demo]{graphicx}
\makeatletter
\g@addto@macro\@floatboxreset\centering
\makeatother
\begin{document}
\begin{figure}%
\begin{minipage}[b]{.48\linewidth}
\centering
\includegraphics[width=.5\linewidth]{qwertz}
\end{minipage}
\hfill
\begin{minipage}[b]{.48\linewidth}
%\centering
\includegraphics[width=.5\linewidth]{qwerty}
\end{minipage}
\caption{Caption}%
\label{fig:label}
\end{figure}%
\end{document}

\subcaption@minipageotherwise I would have tried to avoid that change. However, I think introducing something like\@subfloatboxresetwhich could be patched more easily would be a good idea!? – Nov 14 '13 at 08:18\subcaption@minipageis no longer used. do\apptocmd\subcaption@iiminipage{\centering}{}{}worked for me in 2020. https://tex.stackexchange.com/q/144853/62285 – Yvon Aug 28 '20 at 23:01