Posts tagged ‘LaTeX’

Just recently I convinced a friend of mine to use LaTeX for her papers. A huge step for her and a small one for me as I just had to copy my templates and show her a few hints about LaTeX. Well, that’s what I thought. It was actually even the very same day when she asked me for help: she needed an image in there. That was of course easy but when I saw it I felt like I needed to replace it (it was seriously awfull). So, drawing…

She needed three rectangles connected with arrows. Easy thing with pstricks one might think but then pstricks is a PITA when you need a pdf document. So I tried tikz (of course, Debian delivers it right away). And see how “easy” that looks like:

\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}
    [<->, auto,
    block/.style = {rectangle, draw=blue, thick, fill=blue!20,
                    text width=3.5cm, text centered, rounded corners,
                    minimum height=2cm, font=\sffamily},
    line/.style  = {draw, thick}]
    \matrix [column sep=5mm, row sep=2cm]
    {
        % row 1
        & \node [block] (top) {Rectangle A}; \\
        % row 2
        \node [block] (left) {Rectangle B}; &
        & \node [block] (right) {Rectangle C}; & \\
    };
    \begin{scope}[every path/.style=line]
        \path   (left) -- node [midway,font=\sffamily\footnotesize] {Arrow desc 1} (top);
        \path   (left) -- node [midway,font=\sffamily\footnotesize] {Arrow desc 2} (right);
        \path   (top)  -- node [midway,font=\sffamily\footnotesize] {Arrow desc 3} (right);
    \end{scope}
    \end{tikzpicture}
 
    \caption{My fancy image}
    \label{fancyimage}
\end{figure}

Don’t you like it that way?