[Tex/LaTex] Fit table in page column also some editing

tablestabularxtwo-column

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

Best Answer

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