3

I am having problems with something I think may be easy to solve but I haven't been able to fix it. I am doing a diagram in Latex and I need to connect different rectangles with a circle. The problem is that I do not know how "to tell latex" that both the line and the end of the line should have the same colour. I end up with the figures as I want, but the problem is that the arrowhead is black, not as the line colour I define.

Here is my code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\definecolor{lc_blue}{RGB}{5,110,130}
\definecolor{lc_grey}{RGB}{160,170,160}
\tikzstyle{line} = [draw=lc_blue, -latex', line width=1mm]
\begin{figure}
\centering 
\begin{tikzpicture}
   [place/.style={circle,draw=lc_blue,fill=lc_grey,thick,
inner sep=0pt,minimum size=35mm,text width=1cm},
transition/.style={rectangle, rounded corners, draw=lc_blue,fill=lc_grey,thick,
inner sep=0pt,minimum size=25mm,minimum height=1cm}]
     \node (inc)  at ( 0,-4) [transition] {};
     \node (dial) at ( 0,4)  [transition] {};
     \node (lic)  at ( 0,0)  [place] {};
     \node (conf) at ( 4,0)  [transition] {};
     \node (cred) at (-4,0)  [transition] {};

     \node [black] at (inc)  {\textbf{Inclusión}};
     \node [black] at (dial) {\textbf{Diálogo}};
     \node [black] at (conf) {\textbf{Confianza}};
     \node [black] at (cred) {\textbf{Credibilidad}};
     \node [black] at (lic)  {\textbf{Legitimidad social}}; 
     \path [line] (cred.east) --  (lic.west);
     \path [line] (dial.south) -- (lic.north);
     \path [line] (conf.west) --  (lic.east);
     \path [line] (inc.north) --  (lic.south);
\end{tikzpicture}
\end{figure}
\end{document}
2
  • 1
    Tried your code and the arrows are bluish, as the lines, not black... – JLDiaz Oct 11 '15 at 20:16
  • 1
    I took the liberty to complete the code snippet to a full document. When I run the example with TikZ 3.0, then I get colored arrow heads with the same color as the line. – Heiko Oberdiek Oct 11 '15 at 20:16
4

I guess you are running pgfversion 2.10 right now.

You have 3 options to fix it:

  1. Change the draw=lc_blue to color=lc_blue.

    \tikzstyle{line} = [color=lc_blue,-latex', line width=1mm]
    
  2. Change the draw=lc_blue to draw=lc_blue, fill=lc_blue.

    \tikzstyle{line} = [draw=lc_blue, fill=lc_blue,-latex', line width=1mm]
    
  3. Upgrade your TikZ to 3.0.1

One example with option 3.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\definecolor{lc_blue}{RGB}{255,110,130}
\definecolor{lc_grey}{RGB}{160,255,160}
\tikzstyle{line} = [draw=lc_blue, -latex', line width=1mm]

\begin{tikzpicture}
   [place/.style={circle,draw=lc_blue,fill=lc_grey,thick,
inner sep=0pt,minimum size=35mm,text width=1cm},
transition/.style={rectangle, rounded corners, draw=lc_blue,fill=lc_grey,thick,
inner sep=0pt,minimum size=25mm,minimum height=1cm}]
     \node (inc)  at ( 0,-4) [transition] {};
     \node (dial) at ( 0,4)  [transition] {};
     \node (lic)  at ( 0,0)  [place] {};
     \node (conf) at ( 4,0)  [transition] {};
     \node (cred) at (-4,0)  [transition] {};

     \node [black] at (inc)  {\textbf{Inclusión}};
     \node [black] at (dial) {\textbf{Diálogo}};
     \node [black] at (conf) {\textbf{Confianza}};
     \node [black] at (cred) {\textbf{Credibilidad}};
     \node [black] at (lic)  {\textbf{Legitimidad social}}; 
     \path [line] (cred.east) --  (lic.west);
     \path [line] (dial.south) -- (lic.north);
     \path [line] (conf.west) --  (lic.east);
     \path [line] (inc.north) --  (lic.south);
     \node at (-4,4) {pgfversion:\pgfversion};
\end{tikzpicture}
\end{document}

Output:

enter image description here

1
  • Great! Thank you very much. It works perfectly now. – Fernando Oct 13 '15 at 15:26
3

For equal color of line and arrows you need to define:

\path[line width=1mm, -latex', draw=lc_blue,fill=lc_blue]

or shortly:

\path[line width=1mm, -latex', lc_blue]

I will take opportunity and rewrote code into more short form. For this I add package positioning:

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

    \begin{document}
\definecolor{lc_blue}{RGB}{5,110,130}
\definecolor{lc_grey}{RGB}{160,170,160}
    \begin{figure}
\centering
    \begin{tikzpicture}[
    node distance = 21mm and 13mm,
     place/.style = {circle, draw=lc_blue, fill=lc_grey, thick,
                     inner sep=2mm, text width=24mm, align=center},
transition/.style = {rectangle, rounded corners, draw=lc_blue, thick,
                     fill=lc_grey, inner sep=2mm,
                     minimum size=24mm, minimum height=1cm},
             font = \bfseries]
\node (inc)  [transition]               {Inclusión};
\node (lic)  [place,above=of inc]       {Legitimidad social};
\node (dial) [transition,above=of lic]  {Diálogo};
\node (conf) [transition,right=of lic]  {Confianza};
\node (cred) [transition,left =of lic]  {Credibilidad};
%
\path[line width=1mm, -latex', draw=lc_blue,fill=lc_blue] 
    (cred) edge (lic)   (dial) edge (lic)
    (conf) edge (lic)   (inc)  edge (lic);
    \end{tikzpicture}
\end{figure}
    \end{document}

It gives slightly different image (I reduce size of circle and wrote text in it in two lines, but this you can easy change to your original design):

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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