When I put a formula inside a node in tikzpicture while using beamer, it doesn't show it as it does when I don't use beamer. Consider the code here:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{equation}
x^2
\end{equation}
\begin{tikzpicture}
\node at(0,0) (Example:) {
\begin{minipage}{2cm}
$x^2$
\end{minipage}
};
\end{tikzpicture}
\end{frame}
\end{document}
I have tried compiling it with both XeLatex and PdfLatex, still no luck!
How can I get a more beautiful $x^2$ when using beamer and tikzpicture simultaneously?
This $x^2$ is what I get when I don't use beamer document and use article mode:
Edit: As for the answer of @samcarter_is_at_topanswers.xyz, I aim to use Persian fonts and Xepersian in beamer because the language of my presentation is Persian and hence using Serif font is of no good here. This is what I want to have in my presentation:
This is the code for the image above:
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{xepersian}
\settextfont{Yas}
\setdigitfont{Yas}
\begin{document}
\begin{equation}
x^2
\end{equation}
\begin{tikzpicture}
\node at(0,0) (Example:) {
\begin{minipage}{2cm}
$x^2$
\end{minipage}
};
\end{tikzpicture}
\end{document}




\usefonttheme[onlymath]{serif}? – samcarter_is_at_topanswers.xyz Mar 03 '23 at 08:57article. I've said, the code should show the problem. So if it depends onbeamerand a Persian font, the code should usebeamerand a Persian font. The MWE is not just for fun. We just should be able to reproduce the issue without any changes to the code. Otherwise the code is not a MWE. – cabohah Mar 03 '23 at 09:49