So, I'm looking for the easiest way of drawing something like this. It's a simple diagram.
Is the picture environment the most appropiate one?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communitySo, I'm looking for the easiest way of drawing something like this. It's a simple diagram.
Is the picture environment the most appropiate one?
One possibility using TikZ
and multipart rectangles:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart,shapes.arrows}
\tikzset{
mystack/.style={
draw,
rectangle split,
rectangle split parts=#1,
text width=2cm,
align=center,
anchor=north east,
font=\ttfamily}
}
\begin{document}
\begin{tikzpicture}
% The stack to the left
\node[mystack=2] at (0,0) (sta1)
{stack\nodepart{two}\rule{0pt}{2cm}};
\draw[white,line width=3pt] (sta1.south west) -- (sta1.south east);
\node[fill=red!50,single arrow,rotate=-90,text width=10pt] at (sta1) {};
% The stack to the right
\node[mystack=3] at (5,0) (sta2)
{0$\times$AAA\nodepart{two}0$\times\cdots$\nodepart{three}\rule{0pt}{1.5cm}};
\draw[white,line width=3pt] (sta2.south west) -- (sta2.south east);
% The red and black arrows
\draw[line width=2pt,red,->]
([xshift=1cm]sta1.east) -- ++(20pt,0);
\draw[line width=1pt,<-]
([xshift=5pt]sta2.two split east) -- ++(10pt,0) node[right] {ESP};
\end{tikzpicture}
\end{document}
\draw[white ...
at lower border and \rule{0pt}...
to fix stack height. Could you explain how do you know each stack line height is 5mm?
sta1
you use \rule{0pt}{2cm}
while in \sta2
rule heigth is only 1.5cm, and both stacks show same height. How did you decide this 5mm difference?
I think that a good choice is the pstricks
package, or any other design/draw software.
Use graphics
package to include .jpg
, .eps
, .png
... files in the .tex
file.
Here you can see some examples:
http://tug.org/PSTricks/main.cgi/
http://www.tn-home.de/Tobias/Soft/TeX/TUG040611/presentation.pdf
If you want to write me, you can do it in spanish at [email protected]
. I'm starting learning PSTricks. If you are using it, remember to compile with xelatex or use other options like the ones you can find here: