# How to make the table in the figure in LaTeX?

\begin{center}
\begin{tabular}{ c c c c c}
$0$ & $c_2$ & $c_3$ & \ldots & $c_M$ \\
$e_2$ & $c_2+e_2$ & $c_3+e_2$ & \ldots& $c_M+e_2$ \\
$e_3$ & $c_2+e_3$ & $c_3+e_3$ & \ldots& $c_M+e_3$ \\
$e_4$ & $c_2+e_4$ & $c_3+e_4$ & \ldots& $c_M+e_4$ \\
\vdots & \vdots & \vdots &  $\ddots$ &\vdots \\
$e_N$ & $c_2+e_N$ & $c_3+e_N$ & \ldots& $c_M+e_N$ \\
\end{tabular}

\end{center}


I have tried this code. But I how I can add those lines in the table?

• welcome to tex.se! should table be rotated (as is shown in image in qeustion)? – Zarko May 10 at 13:49
• why would any one have a table at an angle like this? It makes it hard to read, no? – Nasser May 13 at 4:08

\documentclass{article}
\begin{document}
\begin{center}
\begin{tabular}{|c|c c c c|}
\hline
$0$ & $c_2$ & $c_3$ & \ldots & $c_M$ \\ \hline
$e_2$ & $c_2+e_2$ & $c_3+e_2$ & \ldots& $c_M+e_2$ \\
$e_3$ & $c_2+e_3$ & $c_3+e_3$ & \ldots& $c_M+e_3$ \\
$e_4$ & $c_2+e_4$ & $c_3+e_4$ & \ldots& $c_M+e_4$ \\
\vdots & \vdots & \vdots &  $\ddots$ &\vdots \\
$e_N$ & $c_2+e_N$ & $c_3+e_N$ & \ldots& $c_M+e_N$ \\ \hline
\end{tabular}
\end{center}
\end{document}


This is the rotated solution: just use the amazing yslant in a TikZ node :) M. Al Jumaily's solution is excellent, but there is absolutely no need of such a complicated code.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node[yslant=-.1] {%
\begin{tabular}{|c|c c c c|}
\hline
$0$ & $c_2$ & $c_3$ & \ldots & $c_M$ \\ \hline
$e_2$ & $c_2+e_2$ & $c_3+e_2$ & \ldots& $c_M+e_2$ \\
$e_3$ & $c_2+e_3$ & $c_3+e_3$ & \ldots& $c_M+e_3$ \\
$e_4$ & $c_2+e_4$ & $c_3+e_4$ & \ldots& $c_M+e_4$ \\
\vdots & \vdots & \vdots &  $\ddots$ &\vdots \\
$e_N$ & $c_2+e_N$ & $c_3+e_N$ & \ldots& $c_M+e_N$ \\ \hline
\end{tabular}};
\end{tikzpicture}
\end{document}


Perfect parallelogram: even the baselines are now slanted :)

I am sure this is a perfect parallelogram. This is a proof, which is funny for extraordinary users :)

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node[yslant=-1] {%
\begin{tabular}{|c|c c c c|}
\hline
$0$ & $c_2$ & $c_3$ & \ldots & $c_M$ \\ \hline
$e_2$ & $c_2+e_2$ & $c_3+e_2$ & \ldots& $c_M+e_2$ \\
$e_3$ & $c_2+e_3$ & $c_3+e_3$ & \ldots& $c_M+e_3$ \\
$e_4$ & $c_2+e_4$ & $c_3+e_4$ & \ldots& $c_M+e_4$ \\
\vdots & \vdots & \vdots &  $\ddots$ &\vdots \\
$e_N$ & $c_2+e_N$ & $c_3+e_N$ & \ldots& $c_M+e_N$ \\ \hline
\end{tabular}};
\end{tikzpicture}
\end{document}


The plus signs almost become some slanted X's.

• Maybe you could use the array environment to get rid of all of the $s. – leandriis May 10 at 14:12 • @leandriis I just add some letters to the code given by the OP. Using array or tabular is his choice; maybe he has some intentions? – user156344 May 10 at 14:14 • @L.F. :(( I edited my answer. Hope I am not downvoted anymore :)) – user156344 May 12 at 17:25 • Wow! I didn't know about the yslant option. Well done :) – M. Al Jumaily May 12 at 19:05 • @M.AlJumaily Thanks! Actually I also just accidentally learned it when I examined the "TikZ" and "PGF" nodes in the cover page of the manual :)) The "parallelogram-ness" of the table reminded me of those nodes. – user156344 May 13 at 1:56 from image in your question can be concluded, that you like to have rotated table ... :-) \documentclass{article} \usepackage{graphicx} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{center} \rotatebox[origin=c]{-15}{$
\begin{array}{|c|c c c c|}
\hline
0       & c_2       & c_3       & \ldots & c_M      \\
\hline
e_2     & c_2+e_2   & c_3+e_2   & \ldots & c_M+e_2  \\
e_3     & c_2+e_3   & c_3+e_3   & \ldots & c_M+e_3  \\
e_4     & c_2+e_4   & c_3+e_4   & \ldots & c_M+e_4  \\
\vdots  & \vdots    & \vdots    & \ddots & \vdots   \\
e_N     & c_2+e_N   & c_3+e_N   & \ldots & c_M+e_N  \\
\hline
\end{array}
$} \end{center} \lipsum[2] \end{document}  ... just for joy ... • The op's table is a parallelogram. :-) – Money Oriented Programmer May 10 at 17:45 • @ArtificialOdorlessArmpit, you might be right. i draw only simple aproximation for it. write as parallelogram is clallenge, which can be solved with some drawing program ... – Zarko May 10 at 18:11 Here's a solution which employs an array environment instead of a tabular environment. Note the absence of 42 [!] $ symbols.

\documentclass{article}
\begin{document}
$\begin{array}{ |c|c c c c|} \hline 0 & c_2 & c_3 & \ldots & c_M \\ \hline e_2 & c_2+e_2 & c_3+e_2 & \ldots & c_M+e_2 \\ e_3 & c_2+e_3 & c_3+e_3 & \ldots & c_M+e_3 \\ e_4 & c_2+e_4 & c_3+e_4 & \ldots & c_M+e_4 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ e_N & c_2+e_N & c_3+e_N & \ldots & c_M+e_N \\ \hline \end{array}$
\end{document}


Here is a Tikz solution:

\documentclass[margin=1cm, tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%NOTE! Everyting is zero-based
\def\ourInfo{{
{0,"$c_2$","$c_3$", "$\cdots$", "$c_M$"},                     % Row 0
{"$e_2$", "$c_2+e_2$", "$c_3+e_2$", "$\cdots$", "$c_M+e_2$"},   % Row 1
{"$e_3$", "$c_2+e_3$", "$c_3+e_3$", "$\cdots$", "$c_M+e_3$"},   % Row 2
{"$e_4$", "$c_2+e_4$", "$c_3+e_4$", "$\cdots$", "$c_M+e_4$"},   % Row 3
{"$\cdot$", "$\cdot$", "$\cdot$", "$\cdots$", "$\cdot$"},       % Row 4
{"$\cdot$", "$\cdot$", "$\cdot$", "$\cdots$", "$\cdot$"},       % Row 5
{"$\cdot$", "$\cdot$", "$\cdot$", "$\cdots$", "$\cdot$"},       % Row 6
{"$e_N$", "$c_2+e_N$", "$c_3+e_N$", "$\cdots$", "$c_M+e_N$"},   % Row 7
}}
\pgfmathsetmacro{\length}{7}% Zero based.
% Loop through the 2D array, get a row, iterate through its cells,
% print them and go to the next row.
\foreach \i in {0, ..., \length}{% Rows
\foreach \j in {0, ..., 4}{% Columns