The closest to what you like to obtain with one node:
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) [draw,
text height=1cm, text depth=1ex,
minimum width=4cm, inner sep=-0.2ex] (a) {Lorem Ipsum};
\draw (-2,-2) rectangle (2,-1);
\node at (0,-1.8) {Lorem Ipsum};
\end{tikzpicture}
\end{document}
The node above is slightly taller.
I'm not sure I've understood correctly, but do you want something like this?
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\node (circle) [draw, circle, minimum size = 20mm, label=above:$I$] at (0, 0) {};
\draw (circle.center) [{Rays[]}-|] -- (circle.east) node[below, midway] {$r$};
\draw (circle.east) -- (2, 0) node[below, midway] {$r$};
\draw (2, 0) [|-{Circle[]}] -- (3, 0) node[below, midway] {$r$} node[above] {P};
\end{tikzpicture}
\end{document}
Remember that a node is not the same as a path, so you cannot label it in the same way.
In effect, your original code places two nodes at the origin: first the circular one; then the $I$
. This works because \node
is equivalent to \path node
. So you have \path node ... node ...;
Hence, the second node is placed above the path, which consists of the point (0,0)
.
EDIT
Addressing the clarified question, just put the node above the line's starting point. For example,
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\node (circle) [draw, circle, minimum size = 20mm] at (0, 0) {};
\draw (circle.center) [{Rays[]}-|] node [above] {$I$} -- (circle.east) node[below, midway] {$r$};
\draw (circle.east) -- (2, 0) node[below, midway] {$r$};
\draw (2, 0) [|-{Circle[]}] -- (3, 0) node[below, midway] {$r$} node[above] {P};
\end{tikzpicture}
\end{document}
There are other ways to do this, but this seems as straightforward to me as any.
Best Answer
You can use a
label
to place some text inside the node: