1

I have an angle on a nonuniform background (here simplified as a blue background) making it difficult to read the text of the angle. I would like to give the text of the angle a half transparent white background to improve readability.

(I'm afraid filling the angle itself is not an option in my application.)

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

\begin{document}
\begin{tikzpicture}
\coordinate (P) at (0,0);
\coordinate (A) at (90+45:1);
\coordinate (P') at ([yshift=1cm] P);

\fill[blue] (-1,-1) rectangle (1,2);

\draw (P) -- (P') (P) -- (A);

\pic[draw, pic text=$\beta$, angle eccentricity = 1.4] {angle = P'--P--A};
\end{tikzpicture}
\end{document}

If it was a normal label I could achieve it like that:

label={[fill=white, fill opacity=.5, text opacity=1] $\beta$}

but unfortunately that syntax does not seem to work with pic text.

  • 1
    Try pic text options={fill=white,fill opacity=.5,inner sep=1pt} – esdd Jun 18 '18 at 8:45
  • @esdd yes, that is what I was looking for. thanks a lot. If you post that as an answer I will accept it. – jakun Jun 18 '18 at 9:08
2

You can use pic text options:

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

\begin{document}
\begin{tikzpicture}
\coordinate (P) at (0,0);
\coordinate (A) at (90+45:1);
\coordinate (P') at ([yshift=1cm] P);

\fill[blue] (-1,-1) rectangle (1,2);

\draw (P) -- (P') (P) -- (A);

\pic[draw,
  pic text=$\beta$,
  pic text options={fill=white,fill opacity=.5,text opacity=1,inner sep=1pt},% <- added
  angle eccentricity = 1.4] {angle = P'--P--A};
\end{tikzpicture}
\end{document}

Result: enter image description here

  • I would recommend to set text opacity=1 because by default it will use the value of fill opacity which is not what I would want here. – jakun Jun 18 '18 at 9:23

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.