3

How can I do math directly in LaTeX? I don't want to calculate it first and input the value to it.

font=\fontsize{10/0.88348}{12}\selectfont
2
  • 1
    In what context would you use that?
    – egreg
    Commented Mar 4, 2023 at 13:59
  • @egreg I'm using it for my TikZ drawing. \draw (A) node[above, font=\fontsize{10/0.88348}{12}\selectfont] {$V_X$}. I want to do this to account for scale factor in the article.
    – hana
    Commented Mar 4, 2023 at 14:02

1 Answer 1

4

You can use \fpeval

\RequirePackage{fix-cm} % or define a scalable font in the preamble
\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node (A) at (0,0) {};
\node (B) at (1,0) {};
\draw (A) node[above, font=\fontsize{\fpeval{10/0.88348}}{0}\selectfont] {$V_X$};
\draw (B) node[above, font=\fontsize{\fpeval{10*1.35}}{0}\selectfont] {$V_X$};
\end{tikzpicture}

\end{document}

enter image description here

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