5

I get a strange 1.7 pt offset when positioning a + sign at (0,0) node with the lmr 13 fontsize. When using the default font and default font size no offset appears, red + shown below. Do you know how to get rid of these undesirable offsets for a non default font and fontsize? enter image description here

\documentclass[border=0.5cm]{standalone}
\usepackage{tikz}
\usepackage{anyfontsize}
\newcommand{\labelf}{\usefont{T1}{lmr}{m}{n}\fontsize{13}{\baselineskip} \selectfont}
\begin{document}
\begin{tikzpicture}
\draw [ help lines,xstep=1.7pt,ystep=1.7pt] (-3.4pt,-3.4pt) grid (3.4pt,3.4pt);
\node [font=\labelf]at (0,0){+};
\node [text=red]at (0,0){+};
\end{tikzpicture}
\end{document}
2
  • 2
    Could it be the space before \selectfont?
    – Symbol 1
    Commented Nov 6, 2021 at 22:24
  • smart answer. Would you please put ur ans below then I accept.
    – Aria
    Commented Nov 6, 2021 at 22:27

1 Answer 1

8

There is an extra space in your definition of labelf:

\fontsize{13}{\baselineskip} \selectfont
                            ^

This space matters because node[font=\f]{\g} is essentially node{\f\g}. This also explains why the shift is in positive-x direction.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .