# Ignoring the tail of the letter “Q” in the node of a TikZ diagram

In the following TikZ diagram, $\triangle{ABC}$ is an acute triangle, and $\triangle{PQR}$ is inscribed in it. L is the point on the line through P and Q that is closest to A.

I would like to typeset the label for Q at the intersection of the green lines along AC and LP as if I were typesetting the letter "O." The tail of the letter "Q" is pushing it too far from the point it represents.

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}

\begin{tikzpicture}

%A triangle and its orthic triangle are drawn.
\path (-1.75,0) coordinate (A) (2.75,0) coordinate (B) (0,3.25) coordinate (C);
\draw (A) -- (B) -- (C) -- cycle;
%
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(A) +(0,-0.15)$){$A$};
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(B) +(0,-0.15)$){$B$};
\path node[anchor=south, inner sep=0, font=\footnotesize] at ($(C) +(0,0.15)$){$C$};
%
\path ($(B)!(A)!(C)$) coordinate (P) ($(A)!(B)!(C)$) coordinate (Q) (0,0) coordinate (R);
\draw (P) -- (Q) -- (R) -- cycle;
%
%
%The foot of the altitude from A onto the line through P and Q is labeled L.
\coordinate (L) at ($(P)!(A)!(Q)$);
\draw[dashed] (L) -- (Q);
\draw let \p1=($(L)-(P)$), \n1={atan(\y1/\x1)} in node[anchor=\n1, inner sep=0, font=\footnotesize] at ($(L) +({\n1+180}:0.15)$){$L$};

\draw let \p1=($(A)-(P)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0, font=\footnotesize] at ($(P) +(\n1:0.15)$){$P$};
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(R) +(0,-0.15)$){\textit{R}};

\draw[name path=path_1, green] ($(A)!0.15cm!90:(C)$) -- ($(C)!0.15cm!-90:(A)$);
\draw[name path=path_2, green] ($(P)!0.15cm!-90:(L)$) -- ($(L)!0.15cm!90:(P)$);
\coordinate[name intersections={of=path_1 and path_2, by=label_Q}];
\path node[anchor=south east, inner sep=0, font=\footnotesize] at (label_Q){$Q$};

\end{tikzpicture}

\end{document}


Here is a proposal.

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}

\begin{tikzpicture}

%A triangle and its orthic triangle are drawn.
\path (-1.75,0) coordinate (A) (2.75,0) coordinate (B) (0,3.25) coordinate (C);
\draw (A) -- (B) -- (C) -- cycle;
%
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(A) +(0,-0.15)$){$A$};
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(B) +(0,-0.15)$){$B$};
\path node[anchor=south, inner sep=0, font=\footnotesize] at ($(C) +(0,0.15)$){$C$};
%
\path ($(B)!(A)!(C)$) coordinate (P) ($(A)!(B)!(C)$) coordinate (Q) (0,0) coordinate (R);
\draw (P) -- (Q) -- (R) -- cycle;
%
%
%The foot of the altitude from A onto the line through P and Q is labeled L.
\coordinate (L) at ($(P)!(A)!(Q)$);
\draw[dashed] (L) -- (Q);
\draw let \p1=($(L)-(P)$), \n1={atan(\y1/\x1)} in node[anchor=\n1, inner sep=0, font=\footnotesize] at ($(L) +({\n1+180}:0.15)$){$L$};

\draw let \p1=($(A)-(P)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0, font=\footnotesize] at ($(P) +(\n1:0.15)$){$P$};
\path node[anchor=north, inner sep=0, font=\footnotesize] at ($(R) +(0,-0.15)$){\textit{R}};

\draw[name path=path_1, green] ($(A)!0.15cm!90:(C)$) -- ($(C)!0.15cm!-90:(A)$);
\draw[name path=path_2, green] ($(P)!0.15cm!-90:(L)$) -- ($(L)!0.15cm!90:(P)$);
\coordinate[name intersections={of=path_1 and path_2, by=label_Q}];
\path node[anchor=south east, inner sep=0, font=\footnotesize,text=blue]
(aux) at (label_Q) {$O$};
\path node[anchor=north west, inner sep=0, font=\footnotesize] at (aux.north west)
{$Q$};
\end{tikzpicture}
\end{document}


Of course, you may replace text=blue by opacity=0 in the aux node, I just keep it to prove that the Q is precisely where the O is in the sense that the little wiggle that distinguishes these glyphs is not respected.

• What is (aux.north west)? I see that (aux) is the label for the coordinate for the label 'O' if the letter 'O' were to be typeset at the intersection of the two green lines. – Adelyn Oct 21 '18 at 21:46
• @Adelyn it is the north east corner of the aux node. All I do is to make sure that the north east corner of the Q node is at the same position as the north east corner of the O node. That way I make sure that the Q sits at the same position as the O, and the wiggle gets ignored. And O is set (in the present version), even in blue, but you can't see it because the Q sits precisely on top. BTW, if you add Bernards proposal instead of mine, you will see that his Q does not sit precisely on top of the O (but his proposal looks nice, too, IMHO). – user121799 Oct 21 '18 at 21:47

You can simply replace the last line of code for the tikzpicture with

\path node[anchor=south east, inner sep=0, font=\footnotesize] at (label_Q){$\smash{Q}$};


• The tail of the "Q" is pushing the letter away from the intersection of the two green lines. – Adelyn Oct 21 '18 at 21:41
• I don't think so since Q is ‘smashed’, which amounts to make it have 0 height and depth. Change it for a letter without descenders like N, and you'll see it's placed the same way: the base line is about 1 pt from the green line. – Bernard Oct 21 '18 at 21:50
• Dear Bernard If you replace the last node in my code by your proposal, you will see that @Adelyn is right. – user121799 Oct 21 '18 at 21:51
• I agree - it "should" be a command that gives me the letter Q typeset where I want it. It does not, though. Compare your diagram with marmot's diagram. – Adelyn Oct 21 '18 at 21:53
• My code was just a work-around as simple as possible. Marmot knowsTiKZ much better than I do – indeed I know pstricks better than TiKZ, and could place the letter Q anywhere you want, with orientation you want. – Bernard Oct 21 '18 at 22:05