
當我在使用 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文件並使用文章模式時得到的:
編輯:至於答案@samcarter_is_at_topanswers.xyz,我的目標是在 Beamer 中使用 Persian 字體和 Xepersian,因為我的簡報的語言是波斯語,因此使用 Serif 字體在這裡效果不好。這就是我想在演示中看到的內容:
\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}