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 want to make the table fit into one column in a two column page.

Also, I need it to look like this:

enter image description here

Here’s my code

\documentclass[twocolumn]{article}
\usepackage{adjustbox}
\begin{document}
\begin{table}[t]
\centering
\adjustbox{max height=\dimexpr\textheight-3cm\relax,
           max width=0.4\textwidth}{
\begin{tabular}{|rr|rrrrrrrr|}
\hline
           &            &            &            &            &     Wrist  &            &            &            &            \\

           &            &    {\bf 1} &     {\bf } &    {\bf 2} &     {\bf } &    {\bf 3} &     {\bf } &    {\bf 4} &     {\bf } \\
\hline
\multicolumn{ 1}{|c|}{Upper Arm} & \multicolumn{ 1}{|c|}{Lower Arm} & \multicolumn{ 2}{|c}{Wrist Twist} & \multicolumn{ 2}{|c}{Wrist Twist} & \multicolumn{ 2}{|c}{Wrist Twist} & \multicolumn{ 2}{|c|}{Wrist Twist} \\

\multicolumn{ 1}{|c|}{} & \multicolumn{ 1}{|c|}{} &          1 &          2 &          1 &          2 &          1 &          2 &          1 &          2 \\
\hline
           &          1 &          1 &          2 &          2 &          2 &          2 &          3 &          3 &          3 \\

         1 &          2 &          2 &          2 &          2 &          2 &          3 &          3 &          3 &          3 \\

           &          3 &          2 &          3 &          3 &          3 &          3 &          3 &          4 &          4 \\
\hline
           &          1 &          2 &          3 &          3 &          3 &          3 &          4 &          4 &          4 \\

         2 &          2 &          3 &          3 &          3 &          3 &          3 &          4 &          4 &          4 \\

           &          3 &          3 &          4 &          4 &          4 &          4 &          4 &          5 &          5 \\
\hline
           &          1 &          3 &          3 &          4 &          4 &          4 &          4 &          5 &          5 \\

         3 &          2 &          3 &          4 &          4 &          4 &          4 &          4 &          5 &          5 \\

           &          3 &          4 &          4 &          4 &          4 &          4 &          5 &          5 &          5 \\
\hline
           &          1 &          4 &          4 &          4 &          4 &          4 &          5 &          5 &          5 \\

         4 &          2 &          4 &          4 &          4 &          4 &          4 &          5 &          5 &          5 \\

           &          3 &          4 &          4 &          4 &          5 &          5 &          5 &          6 &          6 \\
\hline
           &          1 &          5 &          5 &          5 &          5 &          5 &          6 &          6 &          7 \\

         5 &          2 &          5 &          6 &          6 &          6 &          6 &          6 &          7 &          7 \\

           &          3 &          6 &          6 &          6 &          7 &          7 &          7 &          7 &          8 \\
\hline
           &          1 &          7 &          7 &          7 &          7 &          7 &          8 &          8 &          9 \\

         6 &          2 &          8 &          8 &          8 &          8 &          8 &          9 &          9 &          9 \\

           &          3 &          9 &          9 &          9 &          9 &          9 &          9 &          9 &          9 \\
\hline
\end{tabular}}
\caption{Wrist and arms scores table}
\end{table}
\end{document}

which results in

enter image description here

Can you please make me this 2 tables 1st table 2nd tablealso as I need them urgently? Many Thanks for your kind consideration and assistance, I really appreciate it

12%20at%207.26.10%20PM.png

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The tabularx package is good to fit a tabular to a specified width. Here it’s the current \linewidth (→ Difference between \textwidth, \linewidth and \hsize).

I guessed that the two most left columns should be twice as wide as the other ones. According to this I have set \hsize. (The sum of all \hsize still have to be the number of X columns.)

I have also reduced the horizontal space between columns:

\setlength{\tabcolsep}{.3\tabcolsep}

With the \cline{2-10} you can specify a \hline that only goes from the second to the tenth column.

Code

\documentclass[twocolumn]{article}
\usepackage{tabularx}
\newcolumntype{F}{>{\bfseries}c}
\begin{document}
\begin{table}[t]
\centering\setlength{\tabcolsep}{.3\tabcolsep}
\begin{tabularx}{\linewidth}{|*2{>{\centering\hsize=1.6666\hsize}X|}*8{>{\centering\arraybackslash\hsize=.83333\hsize}X|}}
    \hline
    \multicolumn{2}{|c|}{} & \multicolumn{8}{F|}{Wrist}                                                                                        \\
    \multicolumn{2}{|c|}{} & \multicolumn{2}{F}{1}      & \multicolumn{2}{F}{2}      & \multicolumn{2}{F}{3}      & \multicolumn{2}{F|}{4}     \\ \hline
    Upper & Lower        & \multicolumn{2}{c|}{Twist} & \multicolumn{2}{c|}{Twist} & \multicolumn{2}{c|}{Twist} & \multicolumn{2}{c|}{Twist} \\
    Arm   & Arm          & 1 & 2                      & 1 & 2                      & 1 & 2                      & 1 & 2                      \\ \hline
          & 1            & 1 & 2                      & 2 & 2                      & 2 & 3                      & 3 & 3                      \\ \cline{2-10}
    1     & 2            & 2 & 2                      & 2 & 2                      & 3 & 3                      & 3 & 3                      \\ \cline{2-10}
          & 3            & 2 & 3                      & 3 & 3                      & 3 & 3                      & 4 & 4                      \\ \hline
          & 1            & 2 & 3                      & 3 & 3                      & 3 & 4                      & 4 & 4                      \\
    2     & 2            & 3 & 3                      & 3 & 3                      & 3 & 4                      & 4 & 4                      \\
          & 3            & 3 & 4                      & 4 & 4                      & 4 & 4                      & 5 & 5                      \\ \hline
          & 1            & 3 & 3                      & 4 & 4                      & 4 & 4                      & 5 & 5                      \\
    3     & 2            & 3 & 4                      & 4 & 4                      & 4 & 4                      & 5 & 5                      \\
          & 3            & 4 & 4                      & 4 & 4                      & 4 & 5                      & 5 & 5                      \\ \hline
          & 1            & 4 & 4                      & 4 & 4                      & 4 & 5                      & 5 & 5                      \\
    4     & 2            & 4 & 4                      & 4 & 4                      & 4 & 5                      & 5 & 5                      \\
          & 3            & 4 & 4                      & 4 & 5                      & 5 & 5                      & 6 & 6                      \\ \hline
          & 1            & 5 & 5                      & 5 & 5                      & 5 & 6                      & 6 & 7                      \\
    5     & 2            & 5 & 6                      & 6 & 6                      & 6 & 6                      & 7 & 7                      \\
          & 3            & 6 & 6                      & 6 & 7                      & 7 & 7                      & 7 & 8                      \\ \hline
          & 1            & 7 & 7                      & 7 & 7                      & 7 & 8                      & 8 & 9                      \\
    6     & 2            & 8 & 8                      & 8 & 8                      & 8 & 9                      & 9 & 9                      \\
          & 3            & 9 & 9                      & 9 & 9                      & 9 & 9                      & 9 & 9                      \\ \hline
\end{tabularx}
\caption{Wrist and arms scores table}
\end{table}
\end{document}

Output

enter image description here

share|improve this answer
    
The tabularx documentation states: “Do not use \multicolumn entries which cross any X column.” Huh … –  Qrrbrbirlbel Mar 12 '13 at 7:15
    
can this be done? As I need it urgently please? dropbox.com/s/you1jfe9qmj01wa/RULAv04%20Revised.xls ??? –  user1460166 Mar 13 '13 at 3:48
    
@Qrrbrbirlbel Following the rules ensures nothing bad happens and tabularx always converges to a more or less reasonable width, if you break the rules then usually you are OK, but documenting exactly when things might go wrong is too hard. –  David Carlisle Apr 8 '13 at 16:01
    
@DavidCarlisle Thanks for your late comment. I guess, I am going to cross my fingers when working with tables … –  Qrrbrbirlbel Apr 8 '13 at 21:54

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.