[Tex/LaTex] argument in \begin{subtable}

marginsspacingsubcaptiontables

I use \begin{subtable}{.5\textwidth}...\end{subtable} to produce two (or more) subtables side by side (from the subcaption package). But I don't understand what {.5\textwidth} means. I tried different values, it looks like it is related to the position of the subtables or the spacing between them. I tried to find the documentation for it on Google, but no luck. Where I can find it or can anyone please explain it a little for me?

Best Answer

We're dealing with the subcaption package.

.5\textwidth means "half of the current text width".

A proper usage of subtable should be

\begin{table}
\centering
\begin{subtable}{.5\textwidth}
\centering

<table material>

\caption{<subcaption>}
\end{subtable}% <---- don't forget this %
\begin{subtable}{.5\textwidth}
\centering

<table material>

\caption{<subcaption>}
\end{subtable}

\caption{<main caption>}
\end{table}

Notice the % after the first \end{subtable} that masks the end of line (which would give a space that will put the second subtable below the first one, as the line would be overfull).

Put caption above tables, if this accords to the style you're using or to your personal preferences.