Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Please add a minimal working example (MWE) that illustrates your current usage. –  Werner Nov 24 '11 at 18:29
1  
The subtable and subfigure environments take exactly the same optional and mandatory arguments as minipage –  cmhughes Nov 25 '11 at 5:59
1  
See ctan.org/pkg/subcaption (or ctan.org/tex-archive/macros/latex/contrib/caption/… ) for documentation of the subtable environment. –  Axel Sommerfeldt Nov 25 '11 at 7:56

1 Answer 1

.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}%
\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.

share|improve this answer
    
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... –  user565739 Nov 24 '11 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. –  egreg Nov 25 '11 at 12:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.