0

I have drawn a state diagram, the text inside states are drawn in black color but all connecting arrows and their label text are in grey color by default. How can I change it to black?. Here is my code:

\begin{tikzpicture}[shorten >=1pt,on grid,auto, state/.style={circle, draw=black, fill=white!20, minimum size=4em, scale=0.7,text=black}, inner sep=3pt]
    \tikzset{
        font={\fontsize{10pt}{2}\selectfont}}
    \tikzstyle{every state}=[fill={rgb:black},text=black]
    \node[state, ] (t0) {$0$};
    \node[state, right=1.5cm of t0,] (t1) {$1$};
    \node[state, right=1.5cm of t1,] (t2) {$2$};
    \node        (q_dots) [right=1.0cm of t2] {$\cdots$}; 
    
    \node[state, right=3.5cm of t2,] (tmin) {$t_{min}$};
    \node        (q_dots2) [right=1.0cm of tmin] {$\cdots$}; 
    \node[state, right=3.0cm of tmin,] (tmax2) {$t_{max-1}$};
    \node[state, right=2.3cm of tmax2,] (tmax) {$t_{max}$};
    
    \path[->]
    (q_dots) edge       node {1} (t2)
    (tmin) edge         node {1} (q_dots)
    
    (t2)    edge        node {1} (t1)
    (t1)    edge        node {1} (t0)
    (tmax)  edge    node{1} (tmax2)
    (tmax2) edge    node{1} (q_dots2)
    (q_dots2) edge       node {1} (tmin)
    
    (t0)   edge [bend left]     [pos=0.9, below]node{\small $\frac{1}{D}$}(tmax)
    (t0)   edge [bend left]     [pos=0.9,  below]node{\small $\frac{1}{D}$} (tmax2)
    (t0)   edge [bend left]     [pos=0.8, below, ]node{\small $\frac{1}{D}$} (tmin);
\end{tikzpicture}
2
  • 1
    If the arrows are gray, the color is coming from some part of your code not shown here. Always provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    Sep 21 at 14:18
  • I believe rgb:black is "true" black (to your eyes on the screen) while the black for draw and text might be CMYK black, i.e. not really black. As @SandyG states without a MWE we can't tell you for sure but I suspect somewhere xcolor is loaded with option cmyk. You can try doing \path[->, color={rgb:black}] …; but that's just my crystal ball talking. Sep 21 at 15:55

1 Answer 1

0

They are black, but if you do not believe/do not see the colour, you can force the colour in the description of the path.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary {positioning}

\begin{document}

\begin{tikzpicture}[shorten >=1pt,on grid,auto, state/.style={circle, draw=black, fill=white!20, minimum size=4em, scale=0.7,text=black}, inner sep=3pt]
    \tikzset{
        font={\fontsize{10pt}{2}\selectfont}}
    \tikzstyle{every state}=[fill={rgb:black},text=black]
    \node[state, ] (t0) {$0$};
    \node[state, right=1.5cm of t0,] (t1) {$1$};
    \node[state, right=1.5cm of t1,] (t2) {$2$};
    \node        (q_dots) [right=1.0cm of t2] {$\cdots$}; 
    
    \node[state, right=3.5cm of t2,] (tmin) {$t_{min}$};
    \node        (q_dots2) [right=1.0cm of tmin] {$\cdots$}; 
    \node[state, right=3.0cm of tmin,] (tmax2) {$t_{max-1}$};
    \node[state, right=2.3cm of tmax2,] (tmax) {$t_{max}$};
    
    \path[->,black] % here
    (q_dots) edge       node {1} (t2)
    (tmin) edge         node {1} (q_dots)
    
    (t2)    edge        node {1} (t1)
    (t1)    edge        node {1} (t0)
    (tmax)  edge    node{1} (tmax2)
    (tmax2) edge    node{1} (q_dots2)
    (q_dots2) edge       node {1} (tmin)
    
    (t0)   edge [bend left]     [pos=0.9, below]node{\small $\frac{1}{D}$}(tmax)
    (t0)   edge [bend left]     [pos=0.9,  below]node{\small $\frac{1}{D}$} (tmax2)
    (t0)   edge [bend left]     [pos=0.8, below, ]node{\small $\frac{1}{D}$} (tmin);
\end{tikzpicture}
  
  \end{document}

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.