0

I'm trying to generate a table inside which numbers are to be inserted as shown in the figure.

enter image description here

3
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) grid[step=2cm] (6,8);
\foreach \X [count=\x] in {0,...,3} 
{\foreach \Y [count=\y] in {0,...,4}
 {
 \ifnum\Y=0
  \node[anchor=north west] (X-\X-\Y) at (2*\X,2*\Y) {\y,\x};
 \else
  \ifnum\X=0
   \node[anchor=south east] (X-\X-\Y) at (2*\X,2*\Y) {\y,\x};
  \else
   \node[anchor=south west] (X-\X-\Y) at (2*\X,2*\Y) {\y,\x};
  \fi
 \fi
 }
}
\path (X-3-2.east) -- (X-3-3.east) node[midway,right=2pt]{$m_y=5$};
\path (X-1-0.south) -- (X-2-0.south) node[midway,below=2pt]{$m_x=4$};
\end{tikzpicture}
\end{document}

enter image description here

  • How to add m_x on the x-axis, m_y on the y-axis? Thank you. – Sai Kiran Reddy Maryada Jul 20 '18 at 22:37
  • 1
    @SaiKiranReddyMaryada I added these things. BTW, you have gotten an answer to one of your previous question, and you might want to consider accepting and perhaps upvoting it. – user121799 Jul 21 '18 at 5:54

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.