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
hana
  • 759
  • 2
  • 9
  • 1
    In what context would you use that? – egreg Mar 04 '23 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 Mar 04 '23 at 14:02

1 Answers1

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

egreg
  • 1,121,712