1

I would like to create my table as shown in the picture.

I have attached the LaTeX code I have written. How to modify it, to get the same as that in the picture?

enter image description here

\begin{table}[h]
     \begin{center}
        \setlength{\tabcolsep}{0.4cm}
       \renewcommand{\arraystretch}{1}
       \begin{tabular}{|c|ccccccccccc|}\hline
        &-50& -40 &-30&-20&-10&0&10&20&30&40&50 \\ \hline
        50 &0& 0 &0&0&0&0&0&0&0&0&0 \\ 
        40 & 0 & 0 & 0& 0&0 & 0 & 0 & 0 & 0 &0 &0 \\ 
        30 & 0 & 0 & 0& 10 & 13 & 18 & 14 & 7 & 0 &0 &0\\ 
        20 &    0&  0&  14& 19 & 22 &   24  &22&    18& 12& 0  &0\\ 
        10& 0&  8&  20& 24& 27& 27& 24& 21& 12&0&0\\ 
        0&  3 & 12& 22  &25&    27& 30& 27& 24& 18 &4&0\\ 
        -10&    6&  16  &24&    27  &27&    30& 27& 24& 17& 8 &0\\ 
        -20 &0& 10& 18& 22& 27& 27& 23& 21& 12&0 &0\\ 
        -30&    0&  4&  14& 18& 22& 24& 18& 15& 13&0&0\\ 
        -40 &0& 0&  0&  0&  0&  0&  0&  0&  0 &0&0\\ 
         -50 &0& 0 &0&0&0&0&0&0&0&0&0 \\ \hline
    \end{tabular}
\end{center}
\end{table}
2

With some \multicolumn and \multirow commands as well as using arrows of specific size from here, you can achieve the desired result. For the bold column, I hvave used >{\bfseries}c instead of c and for the bold row, I have repeatedly sed \textbf{}. For a more automated version of bold rows in tables, see for example here . Lastly, please note that I have also replaced the center environment by the \centering command as the former adds unwanted vertical white space arount the tabular.

enter image description here

\documentclass{article}
\usepackage{geometry}

\usepackage{array}
\usepackage{multirow}
\usepackage{mathtools}

\begin{document}

\begin{table}[h]
    \centering
    \setlength{\tabcolsep}{0.4cm}
    \renewcommand{\arraystretch}{1}
    \begin{tabular}{c|>{\bfseries}c|ccccccccccc|}
      \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{5}{c}{$\xleftarrow{\makebox[5.25cm]{}}$} & x & \multicolumn{5}{c}{$\xrightarrow{\makebox[4.75cm]{}}$}\\ \cline{2-13}
        & & \textbf{-50} &  \textbf{-40} &  \textbf{-30} & \textbf{-20} & \textbf{-10} &  \textbf{0} &  \textbf{10} &  \textbf{20} &  \textbf{30} &  \textbf{40} &  \textbf{50} \\ \cline{2-13}
        \multirow{5}{*}{\rotatebox{90}{$\xrightarrow{\makebox[1.25cm]{}}$}} & 50 &0& 0 &0&0&0&0&0&0&0&0&0 \\ 
       & 40 & 0 & 0 & 0& 0&0 & 0 & 0 & 0 & 0 &0 &0 \\ 
       & 30 & 0 & 0 & 0& 10 & 13 & 18 & 14 & 7 & 0 &0 &0\\ 
       & 20 &    0&  0&  14& 19 & 22 &   24  &22&    18& 12& 0  &0\\ 
       & 10& 0&  8&  20& 24& 27& 27& 24& 21& 12&0&0\\ 
      y & 0&  3 & 12& 22  &25&    27& 30& 27& 24& 18 &4&0\\ 
      \multirow{5}{*}{\rotatebox{-90}{$\xrightarrow{\makebox[1.25cm]{}}$}}  & -10&    6&  16  &24&    27  &27&    30& 27& 24& 17& 8 &0\\ 
       & -20 &0& 10& 18& 22& 27& 27& 23& 21& 12&0 &0\\ 
       & -30&    0&  4&  14& 18& 22& 24& 18& 15& 13&0&0\\ 
       & -40 &0& 0&  0&  0&  0&  0&  0&  0&  0 &0&0\\ 
       & -50 &0& 0 &0&0&0&0&0&0&0&0&0 \\ \cline{2-13}
    \end{tabular}
\end{table}

\end{document}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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