2

I need to draw in line in intersection with another one like this :

enter image description here

I was thinking about using [near start] and use nodes :

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \node[label=above:A] (A) at (0,1) {$\bullet$};
        \node[label=above:B] (B) at (1,0) {$\bullet$};
        \node[label=above:C] (C) at (1,1) {$\bullet$};
        
        \draw (A) -- (B) node[near start=1cm, below] {D} node[near start=1cm] {$\bullet$}; 
    \end{tikzpicture}
\end{document}

enter image description here

Or with coordinates, which is cleaner :

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \coordinate (A) at (0,1);
        \draw (A) node[above] {A} node {$\bullet$};
        \coordinate (B) at (1,0);
        \draw (B) node[above] {B} node {$\bullet$};
        \coordinate (C) at (1,1);
        \draw (C) node[above] {C} node {$\bullet$};
        
        \draw (A) -- (B) node[near start=1cm, below] {D} node[near start=1cm] {$\bullet$}; 
    \end{tikzpicture}
\end{document}

enter image description here

I have placed the label D, but I can use it anymore to draw the line (DC). Someone has an idea ?

Edit : [near start] is like [pos=0.25], i think it's a better way to place the node

4

enter image description here

Simply place a coordinate at the desired position and add the bullet label separately. Then connect the coordinates for C and D:

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \coordinate (A) at (0,1);
        \draw (A) node[above] {A} node {$\bullet$};
        \coordinate (B) at (1,0);
        \draw (B) node[above] {B} node {$\bullet$};
        \coordinate (C) at (1,1);
        \draw (C) node[above] {C} node {$\bullet$};
        
        \draw (A) -- (B) node[near start=1cm, below] {D} coordinate[near start=1cm] (D); 
        \node at (D) {$\bullet$};
        \draw (D) -- (C);
    \end{tikzpicture}
\end{document}
2

Using calc library, you can control the position of the node D, like,

\coordinate (D) at ($(A)!0.25!(B)$);

Then draw from C to D.

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
    \begin{tikzpicture}
        \coordinate (A) at (0,1);
        \draw (A) node[above] {A} node {$\bullet$};
        \coordinate (B) at (1,0);
        \draw (B) node[above] {B} node {$\bullet$};
        \coordinate (C) at (1,1);
        \draw (C) node[above] {C} node {$\bullet$};
        \coordinate (D) at ($(A)!0.25!(B)$);
        \draw (D) node[below] {D} node {$\bullet$};
        \draw (A) -- (B) ;
        \draw (C) -- (D);
    \end{tikzpicture}
\end{document}

enter image description here

0

Just a more compact syntax

\documentclass[tikz, border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[%
    point/.style={circle, draw, thin, fill=blue, minimum size=2pt, inner sep=0pt},
    text=blue, font=\sffamily\scriptsize, label distance=-2pt]
    \draw[thick] (0,1) node[point, label=A]{} -- node[near start, point, label=D] (d) {} (1,0) node[point, label=B] {};
    \draw[thick] (d) -- (1,1) node[point, label=C]{};
\end{tikzpicture}
\end{document}

enter image description here

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.