Skip to content

Instantly share code, notes, and snippets.

@avatar-lavventura
Last active February 21, 2018 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avatar-lavventura/10cf7a28565c881f4c8a03b9d0d76d87 to your computer and use it in GitHub Desktop.
Save avatar-lavventura/10cf7a28565c881f4c8a03b9d0d76d87 to your computer and use it in GitHub Desktop.
\begin{figure}[H]
\centering
\begin{tikzpicture}[
MyStyle/.style={draw, minimum width=2em, minimum height=2em, outer sep=0pt, node distance = 0.01cm },
]
\matrix (A) [matrix of math nodes, nodes = {draw,align=center}, nodes={MyStyle, anchor=center, }, column sep=-\pgflinewidth]
{10\\ 10 & 20\\ 20 & 33\\ 15 \\};
\begin{scope}[-{Stealth[length = 5.0pt]}]
\end{scope}
\end{tikzpicture}
\end{figure}
@avatar-lavventura
Copy link
Author

avatar-lavventura commented Feb 21, 2018

@its output:
screen shot 2018-02-21 at 13 35 19

@avatar-lavventura
Copy link
Author

avatar-lavventura commented Feb 21, 2018

I was hoping to get something like:
|10 | 20 | 33|
|10 | 20 | 15 |

@TorbjornT
Copy link

\documentclass[a4paper]{article}    
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[
    MyStyle/.style={draw, minimum width=2em, minimum height=2em, outer sep=0pt, node distance = 0.01cm },
  ]
\matrix (A) [
   matrix of nodes, % removed math
   nodes = {
    draw,
    text width=5mm, % added
    align=center,
    MyStyle,
    anchor=center
  },
  column sep=-\pgflinewidth
]
{ {10\\ 10} & {20\\ 20} & {33\\ 15} \\};
\end{tikzpicture}
\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment