Using \textgoth in math mode is generally fine, as in the first image below, but when I also have \usepackage{anyfontsize}, an issue occurs.
MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
%\usepackage{anyfontsize}
\usepackage{yfonts}
\begin{document}
\textgoth{Re} \textgoth{Im}\
$\textgoth{Re}(z) \textgoth{Im}(z)$
$$\textgoth{Re}(z), \textgoth{Im}(z)$$
$$\textgoth{Im}(z), \textgoth{Re}(z)$$
\textgoth{Re} \textgoth{Im}
\end{document}
yields
but with the \usepackage{anyfontsize} included yields
Note that very strangely, the first $\textgoth{Re}$ works, but every one after that, even the ones in normal text (not math mode) are super small. I am also running in Overleaf, if that is important to know.


\fontsize{3cm}{4cm}\selectfontor whatever size you want so it's not clear what you want the package to do. What was the use case that caused you to add it? – David Carlisle Oct 26 '21 at 18:54fontsizepackage (more up to date and covers almost everything) – Pablo González L Oct 26 '21 at 18:55$$...$$are depreciated: https://tex.stackexchange.com/questions/410863/what-are-the-differences-between-and – Sebastiano Oct 26 '21 at 22:50anyfontsizepackage is expecting to be told a font size (since that is its purpose: it "lets the user select any font size (via e. g. \fontsize{...}{...}\selectfont), even those sizes that are not listed in the .fd file. If such a size is requested, LATEX will search the nearest listed size, and anyfontsize will scale that font to the requested size". Not being told what font size to use caught it by surprise (in the part where it compares things when looking for a best size). – Cicada Oct 27 '21 at 11:22