
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}