1

I'd like to have the first line of the node centered vertically with the object (here: a line) on the left of it. How can I do that?

Of course I could split the elements into several parts and then fine-tune the little bits, but I would really like to use a solution that does not include manual shifting.

Picture

enter image description here

MWE

\documentclass{standalone}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{
tikz,
}

\usetikzlibrary{
intersections,
calc
}

\begin{document}
\begin{tikzpicture}[font=\small]
\draw
(0,0) coordinate (A)
(1,0) coordinate (B)
;
\draw[thick] (A) -- (B) node[right, text width=5cm] {Words Words Words Words Words Words };
\end{tikzpicture}
\end{document}
henry
  • 6,594
  • Related: http://tex.stackexchange.com/questions/35701/tikz-positioning-of-multiline-nodes – henry Sep 16 '14 at 15:58
  • Essentially a duplicate, although the related thread is of a more general nature. Jake's solution (anchor=mid west) solved the problem in an instant. – henry Sep 16 '14 at 16:08

2 Answers2

1

very similarly, with use of positioning package ...

\documentclass[12pt,tikz,border=3mm]{standalone}
    \usetikzlibrary{positioning}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}  
    \begin{document}
        \begin{tikzpicture}[font=\small]
    \draw
    (0,0) coordinate (A)
    (1,0) coordinate (B);
    \draw[thick] (A) -- (B) node[below right=-0.5\baselineskip and 0ex, text width=4cm] 
                                {Words abc. Words abc. Words abc. Words abc. Words abc. Words abc.};
        \end{tikzpicture}
    \end{document}
Zarko
  • 296,517
0
\documentclass{standalone}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{
tikz,
}

\usetikzlibrary{
intersections,
calc
}

\begin{document}
\begin{tikzpicture}[font=\small]
\draw
(0,0) coordinate (A)
(1,0) coordinate (B)
;
\draw[thick] (A) -- (B) node[anchor=mid west, text width=4cm] {Words abc. Words abc. Words abc. Words abc. Words abc. Words abc. };
\end{tikzpicture}
\end{document}

Would gladly read of another approach(es)!

henry
  • 6,594