# Simple Draw in Latex

• Please show some attempt you've made in achieving this and specify what you're struggling with. The point of this Q&A site is to solve specific, but abstract problems, not to have other people do your work. – doncherry Apr 3 '13 at 3:52
• @doncherry this is my first time to use figures, so I've chose this simple one as an example to do more complicated ones, I appreciate your help. – Tak Apr 3 '13 at 3:57
• First steps can be done rather easily investing an hour or two in playing around with the samples in the tikz manual! – vaettchen Apr 3 '13 at 10:12

Here's one possibility, using TikZ and chains:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,chains}

\begin{document}

\begin{tikzpicture}[
simple/.style={draw,text width=1.5cm,align=center,minimum size=2.5em},
start chain,
node distance=12mm
]
\node[on chain] (xn) {$x[n]$};
\node[on chain,simple] (dft) {DFT};
\node[on chain,simple] (log) {log};
\node[on chain,simple] (idf) {IDFT};
\node[on chain] (cn) {$c[n]$};
\node[draw,dashed, fit= (dft) (idf),inner sep=12pt] {};
\draw[->] (xn) -- (dft);
\draw[->] (dft) -- node[auto] {$X[k]$} (log);
\draw[->] (log) -- node[auto] {$\hat{X}[k]$} (idf);
\draw[->] (idf) -- (cn);
\end{tikzpicture}

\end{document}


The idea is to define a style for the "inner" nodes; place the nodes in a chain, draw the arrows with some labels and draw the outer rectangle using the fit library.

The same diagram could have been produced in many other ways; for example, using this time the positioning library:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}[
simple/.style={draw,text width=1.5cm,align=center,minimum size=2.5em},
node distance=12mm
]
\node (xn) {$x[n]$};
\node[simple,right = of xn] (dft) {DFT};
\node[simple,right = of dft] (log) {log};
\node[simple,right = of log] (idf) {IDFT};
\node[,right = of idf] (cn) {$c[n]$};
\draw[dashed] ([xshift=-12pt,yshift=12pt]dft.north west) rectangle ([xshift=12pt,yshift=-12pt]idf.south east) ;
\draw[->] (xn) -- (dft);
\draw[->] (dft) -- node[auto] {$X[k]$} (log);
\draw[->] (log) -- node[auto] {$\hat{X}[k]$} (idf);
\draw[->] (idf) -- (cn);
\end{tikzpicture}

\end{document}

• Thank you very much! how to make its width fit the width of a column in a 2 column page? – Tak Apr 3 '13 at 4:20
• @user1460166 one possibility would be to load the adjustwidth package and then enclose the tikzpicture in an adjustbox with width equal to \columnwidth; schematically: \begin{adjustbox}{width=\columnwidth}\begin{tikzpicture}...\end{tikzpicture}\end{adjustbox} – Gonzalo Medina Apr 3 '13 at 4:27