3
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\usepackage{amsmath}

\begin{document}

\begin{tikzpicture}[scale=0.5]
\draw[<->] (0,12) node[above]{$w$} |- (12,0) node[right]{$q_L$};

\draw[dotted, name path = ACL] (0,0) plot [domain=0.7:9] (\x,0.75*\x + 0.8) node[label=right:{AC$_L$ = S$_L$}](A1){};
\coordinate (H) at ($({5.6/0.75},5.6) - ({0.8/0.75},0)$);
\draw[thick, blue, name path = ACLt] let \p1 = (H) in (0,\y1) node[left, red]{$w_u$} -- (\x1,\y1) --(A1);
\end{tikzpicture}   

\end{document}

My problem is as follows:

  • I have attempted to define a coordinate (A1) at the end of the first line (name path ACL).
  • I then use this coordinate (A1) as the last coordinate in the second line (name path ACLt).

It seems that the coordinate is not truly at the end of the line, since the dotted line is extending slightly beyond the thick blue line:

enter image description here

Why is this occurring?

  • 1
    Node's have finite size and you can simply say \draw[thick, blue, name path = ACLt] (0,0|-H)-- (H) --(A1); which will work fine when A1 is a coordinate. – user121799 Mar 26 at 20:32
5

Well, Zarko has turned my comment into "his" answer, but here it is again: use coordinate instead of node because the latter has a finite size (by default). And my answer and comment come with an arguably simpler construction of the path.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\usepackage{amsmath}

\begin{document}

\begin{tikzpicture}[scale=0.5]
\draw[<->] (0,12) node[above]{$w$} |- (12,0) node[right]{$q_L$};

\draw[dotted, name path = ACL] (0,0) plot [domain=0.7:9] (\x,0.75*\x + 0.8) 
coordinate[label=right:{AC$_L$ = S$_L$}] (A1);
\coordinate (H) at ($({5.6/0.75},5.6) - ({0.8/0.75},0)$);
\draw[thick, blue, name path = ACLt] (0,0|-H) node[left, red]{$w_u$} -- (H) --(A1);
\end{tikzpicture}   

\end{document}

enter image description here

  • 1
    Upvoted both answers; accepted yours because your comment was sufficient for me to solve my problem before I saw either answer (I hadn't realised that nodes had a finite size even when I left the label empty). Thanks! – Thevesh Theva Mar 26 at 20:48
  • 3
    I think that Zarko do not need your comment to see the difference between node and coordinate. TeX.SX is not a competition site "who will answer first" and we are not here to claim paternity of "greate" ideas, but just to help, IMHO. – Kpym Mar 26 at 22:03
  • @Kpym This is IMHO not the question. The question is whether or not one should acknowledge an earlier post saying the same thing. If you acknowledge this, it does not mean you didn't know that. It is just fair play. – user121799 Mar 26 at 22:41
8

calculation of coordinate is sufficient accurate, problem is that for it you use node, replace node with coordinate and result will become as you wish:

enter image description here

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\usepackage{amsmath}

\begin{document}

\begin{tikzpicture}[scale=0.5]
\draw[<->] (0,12) node[above]{$w$} |- (12,0) node[right]{$q_L$};

\draw[dotted, name path = ACL]
    plot [domain=0.7:9] (\x,0.75*\x + 0.8) coordinate[label=right:{AC$_L$ = S$_L$}] (A1);
\coordinate (H) at ($({5.6/0.75},5.6) - ({0.8/0.75},0)$);
\draw[thick, blue, name path = ACLt] let \p1 = (H) in (0,\y1) node[left, red]{$w_u$} -- (\x1,\y1) --(A1);
\end{tikzpicture}

\end{document}

difference between node and coordinate arise since node has some width regardless if it is empty. it is determined by default value of inner sep. if you set it to zero: inner sep=0pt the result will be the same.

off-topic: in your diagram you not use intersections library, so you can remove line names from code (as i do in aboveo mwe)

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.