2

I need the \alpha_1 to be a bit close to the corner, it should be placed "nicely".

I tried the following code (with various numbers in label distance/angle):

\documentclass{article}

\usepackage{tikz}

\begin{document}
\pagenumbering{gobble} % Remove the page numbering

\begin{tikzpicture}

\coordinate (orig) at (0,0);
%node[label={[label distance=0.05cm]90:$i_a$}]
\draw[->] (orig) -- (90:1) node[above] (ia) {$i_a$};
\draw[->] (orig) -- (10:1) node[right] (ib) {$i_b$};
\draw[->] (orig) -- (-45:1) node[right] (ic) {$i_c$};

\draw[blue] (10:0.2) arc (10:90:0.2) node[label={[label distance=-0.01cm]3:$\alpha_1$}] (asd) {};

\end{tikzpicture}

\end{document}

while yields the less attractive result:
enter image description here

But I want something like:
enter image description here

For some reason the code seems to behave in a manner that it's dodging from that corner... Many numbers which I tried simply avoided anywhere near that corner.

  • how about inner sep=0? – Symbol 1 Mar 18 '17 at 0:35
  • @Symbol1 Do you mean node[inner sep=0, ?? It doesn't seem to improve much.. – Dor Mar 18 '17 at 0:51
  • Have you considered using the angles library? – cfr Mar 18 '17 at 2:07
2

The angles and quotes libraries together make this much easier.

\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}
  \coordinate (orig) at (0,0);
  \draw[->] (orig) -- (90:1) node[above] (ia) {$i_a$};
  \draw[->] (orig) -- (10:1) node[right] (ib) {$i_b$};
  \draw[->] (orig) -- (-45:1) node[right] (ic) {$i_c$};
  \pic [draw, blue, angle radius=2mm, "$\alpha_1$", angle eccentricity=2] {angle=ib--orig--ia};
\end{tikzpicture}
\end{document}

marking an angle

  • Thanks! I tried using angles before submitting the current question - but it was giving me an error. Now - everything works fine. It seems that the code \documentclass[border=10pt,multi,tikz]{standalone} is necessary - why? (Still I'd rather be familiar with additional method that allows adjusting the position manually) – Dor Mar 18 '17 at 10:27
  • @Dor You can use a different class as long as you load tikz afterwards. – cfr Mar 18 '17 at 18:25
1

It is easier to put the text inside node and move the node itself using postioning library:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\pagenumbering{gobble} % Remove the page numbering

\begin{tikzpicture}

\coordinate (orig) at (0,0);
%node[label={[label distance=0.05cm]90:$i_a$}]
\draw[->] (orig) -- (90:1) node[above] (ia) {$i_a$};
\draw[->] (orig) -- (10:1) node[right] (ib) {$i_b$};
\draw[->] (orig) -- (-45:1) node[right] (ic) {$i_c$};

\draw[blue] (10:0.2) node[above right=0.1ex and -1ex] 
(asd) {\color{blue}$\alpha_1$} arc (10:90:0.2) ;

\end{tikzpicture}

\end{document}

enter image description here

  • You don't need the positioning library for that because you are using the deprecated syntax. – cfr Mar 18 '17 at 2:16
  • 1
    :)) TikZ changes so fast... – Boris Mar 18 '17 at 2:24
  • 1
    Indeed. It does. Are you going to update? – cfr Mar 18 '17 at 2:29
  • 1
    Which syntax is now used? – Boris Mar 18 '17 at 5:13
  • Thanks - where do I read about its syntax? (since that positioning is deprecated) – Dor Mar 18 '17 at 10:33

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.