10

Is there an easy way to change the fill opacity of the sector without changing the opacity of the angle label?

I tried to use fill opacity=0.5 but the label ("$\alpha$") changes too.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}

\begin{document}

\begin{tikzpicture}
    \draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
    \draw coordinate (a) at (3,-1);
    \draw coordinate (b) at (0,0);
    \draw coordinate (c) at (1,1);
    \draw (a) -- (b) -- (c) pic ["$\alpha$",draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}

\end{document}

enter image description here

2 Answers 2

16

Tikz distinguishes between fill opacity and text opacity. If not both are set, defining fill opacity overrides the setting for text opacity. If you set text opacity=1 you'll get:

enter image description here

Code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}

\begin{document}

\begin{tikzpicture}
    \draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
    \draw coordinate (a) at (3,-1);
    \draw coordinate (b) at (0,0);
    \draw coordinate (c) at (1,1);
    \draw (a) -- (b) -- (c) pic ["$\alpha$",draw=orange,fill=orange!50,fill opacity=0.5, text opacity=1,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}

\end{document}
5

You can add options for the label itself using the syntax

"some text" {<options for the label>}, <other options>

hence pic ["$\alpha$" opacity=1,draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c} gives you the desired effect. Note no comma after " ... ". The braces aren't needed in this specific case because there is only one option, opacity.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}

\begin{document}

\begin{tikzpicture}
    \draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
    \draw coordinate (a) at (3,-1);
    \draw coordinate (b) at (0,0);
    \draw coordinate (c) at (1,1);
    \draw (a) -- (b) -- (c) pic ["$\alpha$" opacity=1,draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .