5

I'm quite struggling. I'd like to centralize pretty much everything except Table X, Three long words and the left panel (Bla of... + abcde). Thanks for your suggestions.

So far I came up with this:

\begin{table}

\caption{name}

\centering 

\begin{tabular}{llllllll}

\hline

~ & \multicolumn{5}{c}{Three long words}   \\ 

Blue of bla of ble  & 1 & 2 & 3 & 4 & 5  \\ \hline

A       &  10.2  & 10.2  &  10.2  &  10.2  &  10.2    \\

B       &   111.2 & 111.2 & 111.2 & 111.2 & 111.2 \\ \hline

\end{tabular}

\end{table}

But it doesn't work well. What I want to create:

What I want to create

3
  • Welcome to TeX.SX! Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem.
    – jub0bs
    Nov 21 '13 at 20:44
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – jub0bs
    Dec 6 '14 at 20:09
  • Generally, you want numbers to align on their decimal point. In this case, that would be right aligned, as they already are. That way, a quick glance tells you the magnitudes involved.
    – Teepeemm
    May 30 '17 at 16:46
4

Here is one possible solution. See my input and corresponding output below.

I made a couple of improvements, including the use of the booktabs package (for nicer-looking rules), and the siunitx package (for decimal alignment), as suggested by cmhughes.

enter image description here

\documentclass{article}

\usepackage[showframe]{geometry}    % only to show the position
                                    % of the tabular on the page
\usepackage{booktabs}   % this package promotes good tabular style
\usepackage{caption}    % for customising caption style
\usepackage{siunitx}    % for decimal alignment

\begin{document}

\begin{table}
    \captionsetup%
    {%
        singlelinecheck = off,  % for correct just. of single-line captions
        justification   = raggedright,
        labelfont       = bf,
    }
    \centering%
    \bfseries
    \begin{minipage}[b]{.7\textwidth}       % A minipage is convenient here;
                                            % its width may have to be adjusted.
        \caption{name}%
        \begin{tabular}{@{}l SSSSS }        % @{} removes the extra horizontal space
            \toprule
                                & \multicolumn{5}{l}{Three long words}  \\
            \cmidrule{2-6}

            Blue of bla of ble  & 1     & 2     & 3     & 4     & 5     \\
            \midrule
            A                   & 10.2  & 10.2  &  10.2 & 10.2  &  10.2 \\
            B                   & 111.2 & 111.2 & 111.2 & 111.2 & 111.2 \\
            \bottomrule
        \end{tabular}
    \end{minipage}
\end{table}

\end{document}
1

It seems that you expectet somethin like this (the changes marked):

\documentclass{article}

\begin{document}

\begin{table}

\caption{name}

\centering 

%\begin{tabular}{llllllll}
\begin{tabular}{l*5{c}}
\hline

%~ & \multicolumn{5}{c}{Three long words}   \\ 
~ & \multicolumn{5}{l}{ Three long words}   \\ 
\cline{2-6} % PS
Blue of bla of ble  & 1 & 2 & 3 & 4 & 5  \\ \hline

A       &  10.2  & 10.2  &  10.2  &  10.2  &  10.2    \\

B       &   111.2 & 111.2 & 111.2 & 111.2 & 111.2 \\ \hline

\end{tabular}

\end{table}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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