6

I have a very specific problem that repeats several times. On picture I have a line and above line I have an arrow with a node. Because of the line, node is not visible enough (picture left). What I want to do is to make line more transparent. I tried fill opacity, which is good in a way it makes line grey, but it also makes grey text as well as arrow (picture right).

Is there a way to make only line grey?

enter image description here

MWE

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[>=stealth]
\draw (0,0) -- (0,2);
\draw[ultra thick,->] (2,2) -- (0.1,1) node[below left=-3pt,inner sep=0.5pt] {$\Phi_{x+\Delta x}$};
\end{tikzpicture}

\begin{tikzpicture}[>=stealth]
\draw (0,0) -- (0,2);
\draw[ultra thick,->] (2,2) -- (0.1,1) node[rectangle,rounded corners=3pt,fill=white,fill opacity=0.5,below left=-3pt,inner sep=0.5pt] {$\Phi_{x+\Delta x}$};
\end{tikzpicture}

\end{document}

EDIT: In recently deleted response, I've learned that text opacity=1 solves the problem in a way it makes text black, but I still don't know how to prevent arrow to become grey.

8

You could use the idea of layers, as demonstrated in Draw edges and paths in the background of nodes in TikZ, for example, combined with the text opacity key.

screenshot

The idea is to draw your vertical line and node in the back ground, and then the arrow on top.

% arara: pdflatex
\documentclass{standalone}
\usepackage{tikz}
\pgfdeclarelayer{bg}    % declare background layer
\pgfsetlayers{bg,main}  % set the order of the layers (main is the standard layer)

\begin{document}

\begin{tikzpicture}[>=stealth]
    \draw (0,0) -- (0,2);
    \draw[ultra thick,->] (2,2) -- (0.1,1) node[below left=-3pt,inner sep=0.5pt] {$\Phi_{x+\Delta x}$};
\end{tikzpicture}

\begin{tikzpicture}[>=stealth]
    \begin{pgfonlayer}{bg}    % select the background layer
        \draw (0,0) -- (0,2);
        \node[rectangle,rounded corners=3pt,fill=white,text opacity=1,fill opacity=0.5,below left=-3pt,inner sep=0.5pt] at (0.1,1)  {$\Phi_{x+\Delta x}$};
    \end{pgfonlayer}
    \draw[ultra thick,->] (2,2) -- (0.1,1);
\end{tikzpicture}

\end{document}
  • There is still problem with the fact I don't want arrow to get grey – Pygmalion Feb 1 '15 at 17:37

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.