In the below-simplified Latex code, I'm using scale to change the font size of the math mode.
\documentclass[convert={density=300,size=1080x800,outext=.png},tikz]{standalone}
\usepackage{xcolor}
\usepackage{scalerel}
\usetikzlibrary{arrows.meta,backgrounds}
\tikzset{white background/.style={show background rectangle,tight background,background rectangle/.style={fill=white } } }
\begin{document}
\begin{tikzpicture}[white background]
\draw node[draw, fill={{rgb:black,0;white,5}}, minimum size=4cm,line width=0.1cm, label={ [yshift=-6cm] { $\scaleto{1 2 3x_{ 18 } }{ 20pt }$ } } ] at (25, 20) { $\scaleto{ 0 }{ 30pt }$ };
\path (current bounding box.north east) +(15mm,15mm) (current bounding box.south west) +(-15mm,-15mm);
\end{tikzpicture}
\end{document}
When only math elements exist (inside of the box), there is no problem. As we can see, however, if there are text and math to display the scale doesn't work;
- Math mode removes the spaces, as usual
- Math mode doesn't have
\textin Tikz as Latex.
What is the correct way to scale both of them?


