The following code is rendered to depict three parallel lines k
, \ell
, and m
, and two traversals s
and t
. The intersections of k
, \ell
, and m
and s
are called A
, B
, and C
, respectively. (The labels for these points are not displayed.) I have labeled the length of the line segment AB
as x + 5
and the length of the line segment BC
at 4x + 5
.
There are two modifications that I would like to have. First, I would like the labels x + 5
and 4x + 5
to be half as far from the line below them as the line above them. (The horizontal lines are "stacked" with k
on top and m
on bottom. So, the points A
, B
, and C
are stacked with A
on top and C
on bottom.) Second, I would like the nodes for x + 5
and 4x + 5
typeset in the same direction as the lines k
, \ell
, and m
. Here is the command that I used to typeset 4x + 5
, for example. I also have a green line drawn to illustrate where I want the node. It illustrates the slight error in placement of the node.
\node[anchor=15, inner sep=0, rotate=15, font=\footnotesize] at ($($(B)!{2/3}!(C)$) +(195:0.3)$){$4x+5$};
\draw[line width=0.2pt, green] ($(B)!{2/3}!(C)$) -- ($($(B)!{2/3}!(C)$) +({195}:2)$);
All four node
commands are at the end of the code.
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections,quotes,decorations.markings,decorations.pathreplacing,}
\begin{document}
\begin{tikzpicture}
%Three parallel lines k, \ell, and m are drawn. Two traversals s and t are to be drawn.
%The ratios of the lengths of the line segments along the traversals between k and \ell
%to the lengths of the line segments along the traversals between \ell and m is to be
%3 to 2.
%
%A, B, and C are points on t; C is a point on line m, B is a point on line ell, and A is
%a point on line k. P, Q, and R are points on s; R is a point on line m, Q is a point
%on line ell, and P is a point on line k. The length of line segment AB is 6, and the
%length of line segment BC is 9. To maintain the same ratio between corresponding points
%on line s, a circle of radius 6 about R is drawn and one of the intersections with line
%ell is labeled Q, and a circle of radius 4 about Q is drawn and one of the intersections
%with line k is labeled P.
\path[name path=line_m] (0,0) -- (15:15);
\coordinate (C) at (15:5);
\coordinate (R) at (15:12);
\coordinate (B) at ($(C) +(50:2.25)$);
\path[name path=line_ell, latex-latex] ($(B) +(195:3)$) -- ($(B) +(15:12)$);
\path[name path=circular_arc_to_locate_Q] (R) circle (1.5);
\coordinate[name intersections={of=line_ell and circular_arc_to_locate_Q}];
\coordinate (Q) at (intersection-2);
\coordinate (A) at ($(B) +(50:1.5)$);
\path[name path=line_k, latex-latex] ($(A) +(195:3)$) -- ($(A) +(15:9)$);
\path[name path=circular_arc_to_locate_P] (Q) circle (1);
\coordinate[name intersections={of=line_k and circular_arc_to_locate_P}];
\coordinate (P) at (intersection-2);
\draw[latex-latex] ($(C) +(195:3)$) -- ($(R) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(R) +(15:2) +(15:0.15)$){$m$};
\draw[latex-latex] ($(B) +(195:3)$) -- ($(Q) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(Q) +(15:2) +(15:0.15)$){$\ell$};
\draw[latex-latex] ($(A) +(195:3)$) -- ($(P) +(15:2)$);
\node[anchor=195, inner sep=0] at ($(P) +(15:2) +(15:0.15)$){$k$};
%Traversals s and t are drawn. Invisible lines parallel to k, \ell, and m
%that pass through the arrowheads of s are used to bound t.
\draw[name path=path_for_traversal_t, latex-latex] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(P) +({\n1-180}:1)$);
\draw let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in node[anchor={\n1-180}, inner sep=0] at ($($(R) +(\n1:1)$) +(\n1:0.15)$){$t$};
\path[name path=path_for_traversal_s] ($(C) +(-130:2)$) -- ($(A) + (50:2)$);
\path[name path=path_for_the_lower_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(R) +(\n1:1)$) -- ($(R) +(\n1:1) +(195:11)$);
\path[name path=path_for_the_upper_arrowhead_of_s] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(P) +({\n1-180}:1)$) -- ($(P) +({\n1-180}:1) +(195:7)$);
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_lower_arrowhead_of_s, by={lower_arrowhead_for_s}}];
\coordinate[name intersections={of=path_for_traversal_s and path_for_the_upper_arrowhead_of_s, by={upper_arrowhead_for_s}}];
\draw[latex-latex] (lower_arrowhead_for_s) -- (upper_arrowhead_for_s);
\draw let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in node[anchor=50, inner sep=0] at ($(lower_arrowhead_for_s) +(-130:0.15)$){$s$};
%The lengths of the line segments on the traversals between the parallel lines are typeset.
\node[anchor=15, inner sep=0, rotate=15, font=\footnotesize] at ($($(A)!0.5!(B)$) +(195:0.3)$){$x+5$};
\draw[line width=0.2pt, green] ($(A)!0.5!(B)$) -- ($($(A)!0.5!(B)$) +({195}:2)$);
\node[anchor=15, inner sep=0, rotate=15, font=\footnotesize] at ($($(B)!0.5!(C)$) +(195:0.3)$){$4x+5$};
\draw[line width=0.2pt, green] ($(B)!0.5!(C)$) -- ($($(B)!0.5!(C)$) +({195}:2)$);
\draw node[anchor=195, inner sep=0, rotate=15, font=\footnotesize] at ($($(P)!0.5!(Q)$) +(15:0.3)$){$4$};
\draw[line width=0.2pt, green] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(P)!0.5!(Q)$) -- ($($(P)!0.5!(Q)$) +(15:2)$);
\draw node[anchor=195, inner sep=0, rotate=15, font=\footnotesize] at ($($(Q)!0.5!(R)$) +(15:0.3)$){$6$};
\draw[line width=0.2pt, green] let \p1=($(P)-(R)$), \n1={atan(\y1/\x1)} in ($(Q)!0.5!(R)$) -- ($($(Q)!0.5!(R)$) +(15:2)$);
\end{tikzpicture}
\end{document}
\node[sloped,...] {...}
.sloped
, you have be be using apath
command, I think.