I try to create a PDF which is 156 pt x 85 pt large, with text at sizes 9 pt and 11 pt, using the following .tex file:
%!TEX TS-program = xelatex
\documentclass[border=0pt]{standalone}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[no-math]{fontspec}
\usepackage{tikz}
\newcommand{\FigureWidthPt}{156}
\newcommand{\FigureHeightPt}{85}
\newcommand{\fontSizeNine}{9}
\newcommand{\fontSizeEleven}{11}
\begin{document}
\begin{tikzpicture}[]
\draw[red, line width=0.0pt, fill=none, opacity=1.0]
(-\FigureWidthPt/2 pt, -\FigureHeightPt/2 pt)
rectangle
+(\FigureWidthPt pt, \FigureHeightPt pt);
\draw[inner sep=0, outer sep=0, anchor=north west]
(-\FigureWidthPt/2 pt, \FigureHeightPt/2 pt) node[color=black]
{\fontsize{\fontSizeNine pt}{\fontSizeNine pt + 2 pt}\selectfont
test nine
};
\draw[inner sep=0, outer sep=0, anchor=north west]
(-\FigureWidthPt/2 pt, \FigureHeightPt/2 pt - 20 pt) node[color=black]
{\fontsize{\fontSizeEleven pt}{\fontSizeEleven pt + 2 pt}\selectfont
test 11
};
\end{tikzpicture}
\end{document}
However, when opening up the PDF with Adobe Acrobat or Illustrator, the artboard is 155.62 pt x 84.88 pt large (155 pt x 84 pt with size read with "Get Info"), and the fonts are read as 8.97 pt and 10.96 pt, respectively.
Is it possible to get these point-perfect e.g. by change of default units in tikz, or by some other means?
I tried opening tikzpicture with \begin{tikzpicture}[x=1pt, y=1pt] without change.
\newcommand{\FigureWidthPt}{156.39},\newcommand{\FigureHeightPt}{85.12},\newcommand{\fontSizeNine}{9.0336},\newcommand{\fontSizeEleven}{11.0411}lead to the desired result (still not sure why we need 156.39 and not 156.44). That is, after creating the figure with the initial, desired dimensions and font sizes, we recreate it with compensated dimensions after measuring the imprecision. – fermionic Nov 26 '22 at 10:43ptin LaTeX andptoutside it? In LaTeX, 1 inch = 72.27 pts and outside it 1 inch = 72 pts. Your problem might come from this difference. – Daniel N Nov 26 '22 at 13:24