5

I'm drawing a diagram for a project, but with the n vector going through the angle label it isn't very clear, I'd like to add a white background to the alpha label so it's easier to see. Thanks, see MWE below.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,angles,quotes,arrows}

\begin{document}
\begin{figure}
        \begin{center}
        \begin{tikzpicture}
            %Define coordinates
            \coordinate (origin) at (0,0);
            \coordinate (bhat) at (0,5);
            \coordinate (zetahat) at (5,0);
            \coordinate (vector) at (3,4);
            \coordinate (normal) at (1.581,4.743);

            %Draw axes
            \draw[thick, <->] (bhat) node[above]{$\hat{b}$} -- (origin) -- (zetahat) node[right]{$\hat{\zeta}$};

            %Draw vector
            \draw[thick, ->, blue] (origin) -- (vector) node[above]{$\vec{v_r}$};

            %N vector
            \draw[thick, dotted, ->] (origin) -- (normal) node[above]{$\hat{n}$};

            %Draw angle
            \pic [draw, "$\alpha$", angle eccentricity = 1.2, angle radius = 1.5cm, thick] {angle = vector--origin--bhat};

        \end{tikzpicture}
        \caption{Pitch angle $\alpha$ is equal to $2\theta_{bn}$, showing specular reflection}
        \label{fig:Pitch Angle}
        \end{center}
    \end{figure}
\end{document}
  • 1
    fill=white but I think this will also fill other parts that you don't want to fill. If that is the case you'd have to create the label separately or someone else has a smarter idea about that – Raven Dec 13 '18 at 13:31
6

Use "$\alpha$"{fill=white} instead of "$\alpha$" in \pic

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,angles,quotes,arrows}

\begin{document}
\begin{figure}
        \begin{center}
        \begin{tikzpicture}
            %Define coordinates
            \coordinate (origin) at (0,0);
            \coordinate (bhat) at (0,5);
            \coordinate (zetahat) at (5,0);
            \coordinate (vector) at (3,4);
            \coordinate (normal) at (1.581,4.743);

            %Draw axes
            \draw[thick, <->] (bhat) node[above]{$\hat{b}$} -- (origin) -- (zetahat) node[right]{$\hat{\zeta}$};

            %Draw vector
            \draw[thick, ->, blue] (origin) -- (vector) node[above]{$\vec{v_r}$};

            %N vector
            \draw[thick, dotted, ->] (origin) -- (normal) node[above]{$\hat{n}$};

            %Draw angle
            \pic [draw,  "$\alpha$"{fill=white}, angle eccentricity = 1.2, angle radius = 1.5cm, thick] {angle = vector--origin--bhat};

        \end{tikzpicture}
        \caption{Pitch angle $\alpha$ is equal to $2\theta_{bn}$, showing specular reflection}
        \label{fig:Pitch Angle}
        \end{center}
    \end{figure}
\end{document}
  • Perfect! I knew there would be a simple answer! – Jasper Salisbury Dec 13 '18 at 13:38
2

A PSTricks solution only for comparison purposes. A single * does the job (making the label background solid).

\documentclass[pstricks,12pt]{standalone}
\begin{document}
\pspicture(-1,-1)(6,6)
    \psline{<->}(0,5)(0,0)(5,0)
    \psline{->}(5;60)
    \psline[linestyle=dotted,dotsep=1pt]{->}(5;75)
    \uput[90](0,5){$\hat{b}$}
    \uput[0](5,0){$\hat{\zeta}$}
    \uput[60](5;60){$\vec{v}_r$}
    \uput[75](5;75){$\hat{n}$}
    \uput*{2.5}[75](0,0){$\alpha$}
    \psarc(0,0){2}{60}{90}
\endpspicture
\end{document}

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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