Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to draw an image from a mathematical publication (see the crop at the end of my post). You can find a recent version of the drawing at page 37 of my script (PDF). The complete source is here.

I drew a rhomb with those squares in it and shifted all pieces to the right place:

\begin{tikzpicture}
\draw (0,0) -- (4,1) -- (8,0) -- (4,-1) -- (0,0);
\draw[thick] (6,.5) -- (4,1) -- (4,-1) -- (6,-.5)
  [yshift=4cm]  (6,.5) -- (4,1) -- (4,-1) -- (6,-.5);
\draw[thick,dashed] (6,.5) -- (6,-.5)
  [yshift=4cm]  (6,.5) -- (6,-.5);

I did the same with the squares around those figures. Now I want to label each square (R_0, R_1) and draw arrows from one box to another.

I'm looking for a better way than to write something like \draw[->] (2,2) -- (2,0);. So adding nodes sounds like the right idea, but I found no working solution. What would you recommend for drawing arrows and adding some labels?

crop of a drawing

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can use the shapes tikz-library. I am including an example, but you should read section 48.3 Geometric shapes on page 420 from the tikz manual. Here is the example

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}

\node[draw=lightgray,rectangle,inner sep=0.5cm,outer sep=5pt,label=245:$R_0$] (top) {\tikz{
    \node[draw,trapezium,trapezium angle=75,shape border rotate=270,outer sep=0pt] (top trap)
        {$\sigma(S_0)$};
    \draw[white,postaction={draw=black,dashed}]
        (top trap.bottom left corner) -- (top trap.bottom right corner);    
        }};

\node[draw=lightgray,rectangle,inner sep=0.5cm,below=2cm of top,outer sep=5pt,label=245:$R_0$] (bottom) {\tikz{
    \node[draw,trapezium,trapezium angle=75,shape border rotate=270,outer sep=0pt] (trap)
        {$T_0$};
    \draw[white,postaction={draw=black,dashed}] (trap.top left corner) -- (trap.top right corner);  
        }};


\draw[->] (top) -- (bottom) node[pos=0.5,right] {$\varphi|_{R_0}$};
\end{tikzpicture}

\end{document}

The result is

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.