Center subfigure using floatrow

I'm working with caption and subcaption to style my (sub)figure captions and especially with floatrow to center my figures. However, this does not work for subfigures, as the following nMWE (nearly minimal) example illustrates:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage{floatrow}
\usepackage{tikz,floatrow,hyperref}
\usepackage[hypcap=true]{caption}
\usepackage[hypcap=true]{subcaption}
\usepackage[all]{hypcap} %link to top of figure

% caption format
\captionsetup{format=hang,labelsep=space,indention=-2cm,labelfont=bf,width=.9\textwidth,skip=.5\baselineskip}
\captionsetup[sub]{labelfont=bf,labelsep=period,subrefformat=simple,labelformat=simple}

%center both ?
\floatsetup[figure]{objectset=centering}
\floatsetup[subfigure]{objectset=centering} %does not center subfigures

\begin{document}
\begin{figure}
\begin{tikzpicture}
\draw[fill=blue] (0,0) rectangle (4,4);
\end{tikzpicture}
\caption{First}
\end{figure}
\begin{figure}
\begin{subfigure}{.49\textwidth}%\centering is not centered without centering
\begin{tikzpicture}
\draw[fill=blue] (0,0) rectangle (4,4);
\end{tikzpicture}
\caption{First}
\end{subfigure}
\begin{subfigure}{.49\textwidth}\centering
\begin{tikzpicture}
\draw[fill=blue] (0,0) rectangle (5,5);
\end{tikzpicture}
\caption{Second}
\end{subfigure}
\caption{Describing both subfigures}
\end{figure}
\end{document}


Clearly, the first figure gets centered and everything is fine. Though, comparing the second figures subfigures, I have to use \centering (illustraed in the second subfigure) to center, which does not work, by using \floatsetup[subfigure].

I would like to center subfigures without using \centering, but using a global package command. Any ideas how to obtain such layout using floatrow? Any other approach is of course nice too, it's just, that i'm already using floatrow to center figures (globally).

PS: I'm using XeLaTeX, but I hope that does not change much in these observations.

-

First: you have included floatrow twice.

You can use ffigbox inside a figure environment:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage{tikz,floatrow,hyperref}
\usepackage[hypcap=true]{caption}
\usepackage[hypcap=true]{subcaption}
\usepackage[all]{hypcap} %link to top of figure

% caption format
\captionsetup{format=hang,labelsep=space,indention=-2cm,labelfont=bf,width=.9\textwidth,skip=.5\baselineskip}
\captionsetup[sub]{labelfont=bf,labelsep=period,subrefformat=simple,labelformat=simple}

%center both ?
\floatsetup[figure]{objectset=centering}
\floatsetup[subfigure]{objectset=centering}

\begin{document}
\begin{figure}
\begin{tikzpicture}
\draw[fill=blue] (0,0) rectangle (4,4);
\end{tikzpicture}
\caption{First}
\end{figure}
\ffigbox[\FBwidth]{%
\begin{subfloatrow}
\ffigbox[0.5\textwidth]{%
\begin{tikzpicture}
\draw[fill=blue] (0,0) rectangle (4,4);
\end{tikzpicture}}{\caption{First}}
\ffigbox[0.5\textwidth]{%
\begin{tikzpicture}
\draw[fill=blue] (0,0) rectangle (5,5);
\end{tikzpicture}}{\caption{Second}}%
\end{subfloatrow}%
}{\caption{Describing both subfigures}}
\end{document}


Allergy notice: some parts of the above code might be nuts (or needless)

To answer your questions in comments (from the floatrow package manual):

Another command which creates figures - \ffigbox - puts caption below contents. The default width of caption equals to the width of text. [...] a float box, created by the \ffigbox command looks similar to the plain figure environment. But if you set, for example, the option [\FBwidth] [...] you’ll get a caption width equal to the width of picture [...]

There are similar boxes where the caption is placed elsewhere (eg: \fcapside places it beside the figure). As far as I know \floatsetup[subfigure]{objectset=centering} doesn't effect the subfigure environment of the subcaption package but these boxes.

If you hate this stack you can hope that is only my overcomplicated solution and there are better ones. Or you may want to try xpatch (or etoolbox) to do the "global" subcaption centering stuff (instead of using floatrow for that) as a "hail mary"...

\usepackage{xpatch}
\makeatletter
% \subcaption@minipage is the last macro call in \subfigure (and \begin{subfigure})
\xapptocmd{\subcaption@minipage}{\centering}{}{}
\makeatother

-
I like your note. I'l check that code this evening. I solved the above thingy by manually centering the stuff in the document I worked on at at that time. Thanks for coming back to that topic, because I think this general centering contributes to the idea of dividing content and layout. – Ronny Dec 4 '13 at 7:18
Could you extend your answer and explain, what ffigbox does compared to subfigure (because just semantically subfigure does sound better. And could you explain, what the \FBwithdoes? I think in total (\ffigbox subfloatrow \ffigbox... the code is a little cluttered. – Ronny Dec 4 '13 at 7:22
I've just added some details and an alternative way and removed the figure environment because it wasn't needed. A little less cluttered now. \ffigbox stands for figure and subfigure too, you have an extra floatrow but the other things are the same as any use of the subfigure (from subcaption) – masu Dec 5 '13 at 8:29
I like that last solution, thanks for that, though its using subcaption (which I am also loading); I like that due to the global nature. – Ronny Dec 5 '13 at 20:19
That's exactly why I even suggested that. ;) I you want to cancel the effect for one or two figures, you can use the \let macro to save the original \subcaption@minipage and put it back when you want that. – masu Dec 6 '13 at 0:13