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.

The smartdiagram package appears to have a default convention that an arrow in a circular diagram takes the colour of the destination block. Is there a way to choose instead the colour of the source block as the colour of the arrow. For instance, in this example

\documentclass{article}
\usepackage{tikz}
\usepackage{smartdiagram}
\begin{document}
\smartdiagramset{set color list={red!50,orange!50,green!50}}
\smartdiagram[circular diagram:clockwise]{Red,Orange,Green}
\end{document}

I want the arrow from "Red" to "Orange" to be red instead of orange. In other words, I want to advance all arrow colours one step clockwise.

Is there a single key or other simple option to do this? If there isn't might I suggest it through this forum please?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Code

\documentclass[tikz,convert=false]{standalone}
\usepackage{smartdiagram}
\makeatletter
\smartdiagramset{
  flip arrow colors/.style={
    /tikz/diagram arrow type/.prefix code={%
      \edef\col{\@nameuse{color@\xi}}%
    }
  }
}
\makeatother
\begin{document}
\smartdiagramset{set color list={red!50,orange!50,green!50}}
\smartdiagram[circular diagram:clockwise]{Red,Orange,Green}

\smartdiagramset{flip arrow colors}
\smartdiagram[circular diagram:clockwise]{Red,Orange,Green}
\end{document}

Output

enter image description here enter image description here

share|improve this answer
1  
Nice answer. But some explanations would be nice. –  Thorsten Donig Aug 2 '13 at 14:28
    
@ThorstenDonig I don't have time right now, but the code for the circular diagram stores the value of the current element in \xi and and calculates the next value in \xj and defines \col in dependence of \xj. The diagram arrow type style uses the key \col (i.e. color=\col). We simply overwrite \col with the current color name before (prefix) the color=\col key is used. –  Qrrbrbirlbel Aug 2 '13 at 15:37
add comment

Not really a "simple key" as requested, but no sorcery though because not so complex. There are two things to be done.

  1. A redefinition of the arrow style.

  2. Altering the sequence of the nodes.

The result could then look like this.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{smartdiagram}

\smartdiagramset{arrow style=->}

\begin{document}
  \smartdiagramset{set color list={orange!50,red!50,green!50}}
  \smartdiagram[circular diagram:clockwise]{Orange,Red,Green}
\end{document}

The problem is that now clockwise is a bit irritating. This is due to the unconventional initial definition arrow style=<- for the direction of the arrows.


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.