Beamer を使用すると、Tikzpicture のインライン数式モードでは、Beamer を使用していないときのように $x$ が表示されません。

Beamer を使用すると、Tikzpicture のインライン数式モードでは、Beamer を使用していないときのように $x$ が表示されません。

Beamer を使用しているときに tikzpicture のノード内に数式を入力すると、Beamer を使用しないときのようには表示されません。次のコードを検討してください。

\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}

出力は次のとおりです。ここに画像の説明を入力してください

XeLatex と PdfLatex の両方でコンパイルしてみましたが、まだうまくいきません。

beamer と tikzpicture を同時に使用する場合、より美しい $x^2$ を得るにはどうすればよいですか?

この $x^2$ は、beamer ドキュメントを使用せず、記事モードを使用した場合に得られるものです。

ここに画像の説明を入力してください

編集:翻訳者私のプレゼンテーションの言語はペルシャ語なので、ここでは Serif フォントを使用しても意味がないので、Beamer ではペルシャ語フォントと Xepersian を使用するつもりです。プレゼンテーションで使用したいのは次のようなものです。

ここに画像の説明を入力してください 上の画像のコードは次のとおりです。

\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}

答え1

Beamer はデフォルトでサンセリフ フォントを使用します。数式にセリフ フォントを使用する場合は、以下を使用できます\usefonttheme[onlymath]{serif}

\documentclass{beamer}
\usepackage{tikz}
\usefonttheme[onlymath]{serif}
\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}

ここに画像の説明を入力してください


カスタムフォントを使用する場合は、次のprofessionalfontsテーマを使用します。

% !TeX TS-program = xelatex
\documentclass{beamer}
\usepackage{tikz}
\usefonttheme{professionalfonts}
\usepackage{xepersian}
\settextfont{Yas}
\setdigitfont{Yas}
\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}

ここに画像の説明を入力してください

関連情報