I'm trying to draw a dotted line from A to B and a straight line from B to C. If I use two draw commands, then there is an obvious break in the line, because I use rounded edges. Just using one draw command I'm stuck.

So is there a command like this:

\draw [rounded corners,dotted] (0,0) -- (1,1) [-]-- (3,1);



\node  at (0,1.2) {A};
\node  at (1,1.2) {B};
\node  at (3,1.2) {C};
\draw [rounded corners,dotted] (0,0) -- (1,1) -- (3,1);
\draw [rounded corners,dotted] (0,-1) -- (1,0);
\draw (1,0) -- (3,0);


  • No there isn't. Smooth cornering while changing the line type won't work.
    – percusse
    Jan 9 '15 at 22:02

This is not very nice, but can help you.

\documentclass[12pt, border=1cm,convert={density=1400}]{standalone}
    \path (0,0) coordinate(A) node[left] {A};
    \path (1,1) coordinate(B) node[above left] {B};
    \path (3,1) coordinate(C) node[above] {C};

    \draw [ rounded corners,dotted,
            postaction={draw,line width=.5pt,solid,shorten <=13mm}]
              (A) -- (B) -- (C);
    \begin{scope}[transform canvas={yshift=-3mm}]
      \draw[rounded corners,dotted]  (A) -- (B) -- (C);
      \draw[shorten <=2mm](B) -- (C);

enter image description here

EDIT: Another idea is to use clipping. You can draw your path twice and for the first draw you clip half of the path, and for the second you clip the other half.

  • I'll try clipping, but so far [shorten <=2mm] is good enough.
    – ingo
    Jan 9 '15 at 23:27
  • Where is the documentation for shorten <? I can't even find where this key is defined after attempting to grep through everything.
    – A.Ellett
    Jan 10 '15 at 0:58
  • @A.Ellett You can find /tikz/shorten > and /tikz/shorte < on p.160 of the manual of v2.10. But strangely it is missing in the manual for 3.0.0.
    – Kpym
    Jan 10 '15 at 5:54

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.