[dk-tug] Forbedring af tikz kode

Lars Madsen <[email protected]> Thu, 29 Jan 2015 15:47:01 +0000
Newsgroups gmane.comp.tex.danish
Message-ID <[email protected]>
Hej liste

I et preprint har jeg rettet lidt på en tikz nybegynders tegning. Jeg ville gerne have buede pile i stedet for lige.
Men det må da være en bedre måde en det jeg hackede mig frem til nedenfor.

Og ja jeg ved godt jeg burde bruge styles i stedet for at anvende scope til at give fælles variable.

Nogen der har et godt forslag til hvordan de pile kan laves bedre?

\documentclass[a4paper]{memoir}
\usepackage{tikz}
\begin{document}
\centering
    \begin{tikzpicture}
      \begin{scope}[shape=rectangle,
        minimum width=0.9cm,minimum height=0.9cm,thick]
        \node[draw,fill=red!30!] (A) at (0,0) {0};
        \node[draw,fill=green!30!] (Bm) at (2.5,1.5) {$1a$};
        \node[draw,fill=green!30!] (Bp) at (2.5,-1.5) {$1b$};
        \node[draw,fill=green!10!] (C) at (5,0) {2};
      \end{scope}
    \begin{scope}[thick,->,shorten <=3pt,shorten >=3pt]
      \draw ([yshift=1mm]Bp.east) 
      to [out=0,in=-90] node [above,pos=0.4] {$\lambda_a$}
      ([xshift=-1mm]C.south)
      ;
      \draw[<-] ([yshift=-1mm]Bp.east) 
      to [out=0,in=-90] node [below] {$\beta_a$}
      ([xshift=1mm]C.south)
      ;
      %%
      \draw ([xshift=1mm]A.south) 
      to [out=-90,in=180] node [above,pos=0.6] {$\lambda_b$}
      ([yshift=1mm]Bp.west)
      ;
      \draw[<-] ([xshift=-1mm]A.south) 
      to [out=-90,in=180] node [below] {$\beta_b$}
      ([yshift=-1mm]Bp.west)
      ;
      %%
      \draw ([xshift=-1mm]A.north) 
      to [out=90,in=180] node [above=2pt] {$\lambda_a$}
      ([yshift=1mm]Bm.west)
      ;
      \draw[<-] ([xshift=1mm]A.north) 
      to [out=90,in=180] node [below,pos=0.6] {$\beta_a$}
      ([yshift=-1mm]Bm.west)
      ;
      %%
      \draw ([yshift=1mm]Bm.east) 
      to [out=0,in=90] node [above] {$\lambda_b$}
      ([xshift=1mm]C.north)
      ;
      \draw[<-] ([yshift=-1mm]Bm.east) 
      to [out=0,in=90] node [below,pos=0.4] {$\beta_b$}
      ([xshift=-1mm]C.north)
      ;
    \end{scope}
    \end{tikzpicture}
\end{document}





/Lars Madsen
Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University
Mere info: http://au.dk/daleif@imf / More information: http://au.dk/en/daleif@imf