# argument in \begin{subtable}

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?

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.

• Thanks. But if I would like 3 or 4 subtables on the same line (assume the subtables are not too big), then .5\textwidth seems not good. So I tried .25\textwidth for 4 subtables and .33\textwidth for 3 subtables, but then the 3rd and 4th subtables are moved to the next line. So I am curious how one determines its value... Nov 24, 2011 at 19:01
• @user565739 A minimal example of the code you're trying is necessary, as using the same scheme with the fractions you're telling about works flawlessly. Nov 25, 2011 at 12:08
• @egreg I played around with your solution a little. I noticed the following. If I place table A before table B they are displayed side-by-side. If I reverse the order (i.e. B before A) the tables are displayed as B above A. How does one force them to be side-by-side?
– Jim
Oct 19, 2016 at 16:09
• @Jim I think you forgot the % or left a blank line between the two subtables. Oct 19, 2016 at 16:15
• Please, add the package what you use for subtable here because this thread is the most popular latex subtable thread in Google. So \usepackage{subcaption}. Nov 26, 2016 at 10:04