![$ ^{\prime} $ 的快捷方式在 beamer 中不起作用](https://linux22.com/image/419829/%24%20%5E%7B%5Cprime%7D%20%24%20%E7%9A%84%E5%BF%AB%E6%8D%B7%E6%96%B9%E5%BC%8F%E5%9C%A8%20beamer%20%E4%B8%AD%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我正在 documentclass 中准备一些讲义beamer
。在我添加了大量自定义设置后,我发现 的快捷方式'
不起作用$ ^{\prime} $
。我该如何恢复正常行为?以下是 MWE。请帮忙。
\documentclass[aspectratio=169,10pt, notheorems]{beamer}
\setbeamerfont{headline}{size=\fontsize{8}{0}\selectfont}
\setbeamerfont{footline}{size=\fontsize{6}{0}\selectfont}
\usetheme{CambridgeUS}
\usefonttheme{serif}
\usepackage{xcolor}
\definecolor{sapphire}{rgb}{0.01, 0.01, 1}
\setbeamertemplate{enumerate subitem}{(\alph{enumii})}
\setbeamertemplate{enumerate item}{\arabic{enumi}.}
\setbeamertemplate{bibliography item}{\insertbiblabel}
%\setbeamertemplate{theorems}[numbered]
\usepackage{hanging}% http://ctan.org/pkg/hanging
\setbeamertemplate{footnote}{%
\hangpara{2em}{1}%
\makebox[2em][l]{\insertfootnotemark}\footnotesize\insertfootnotetext\par%
}
\usepackage{ifthen}
\usepackage{wrapfig}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{structure}{fg=magenta}
\setbeamercolor{structure}{bg=black}
%\usepackage{enumitem}
\usepackage{mathtools, amssymb, amsfonts, amsthm, amsmath}
\usepackage{stmaryrd}
\usepackage{nccmath}
\usepackage{graphicx}
\usepackage{ragged2e}
%\usepackage{latex2e}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{hobby}
\usetikzlibrary{decorations.pathreplacing, calligraphy}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usepackage{etoolbox}
\usepackage[mathscr]{eucal}
\usepackage{upgreek}
\newtagform{dots}{$ \cdots $(}{)}
\usetagform{dots}
\usepackage{caption}
\usepackage[labelformat=simple, labelsep=colon]{subcaption}
\setbeamertemplate{caption}[numbered]
\renewcommand{\thesubfigure}{\thefigure.(\alph{subfigure})}
\makeatletter
\renewcommand\p@subfigure{}
\makeatother
\makeatletter
\let\save@mathaccent\mathaccent
\newcommand*\if@single[3]{%
\setbox0\hbox{${\mathaccent"0362{#1}}^H$}%
\setbox2\hbox{${\mathaccent"0362{\kern0pt#1}}^H$}%
\ifdim\ht0=\ht2 #3\else #2\fi
}
%The bar will be moved to the right by a half of \macc@kerna, which is computed by amsmath:
\newcommand*\rel@kern[1]{\kern#1\dimexpr\macc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
\newcommand*\widebar[1]{\@ifnextchar^{{\wide@bar{#1}{0}}}{\wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
\newcommand*\wide@bar[2]{\if@single{#1}{\wide@bar@{#1}{#2}{1}}{\wide@bar@{#1}{#2}{2}}}
\newcommand*\wide@bar@[3]{%
\begingroup
\def\mathaccent##1##2{%
%Enable nesting of accents:
\let\mathaccent\save@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
\if#32 \let\macc@nucleus\first@char \fi
%Determine the italic correction:
\setbox\z@\hbox{$\macc@style{\macc@nucleus}_{}$}%
\setbox\tw@\hbox{$\macc@style{\macc@nucleus}{}_{}$}%
\dimen@\wd\tw@
\advance\dimen@-\wd\z@
%Now \dimen@ is the italic correction of the symbol.
\divide\dimen@ 3
\@tempdima\wd\tw@
\advance\@tempdima-\scriptspace
%Now \@tempdima is the width of the symbol.
\divide\@tempdima 10
\advance\dimen@-\@tempdima
%Now \dimen@ = (italic correction / 3) - (Breite / 10)
\ifdim\dimen@>\z@ \dimen@0pt\fi
%The bar will be shortened in the case \dimen@<0 !
\rel@kern{0.6}\kern-\dimen@
\if#31
\overline{\rel@kern{-0.6}\kern\dimen@\macc@nucleus\rel@kern{0.4}\kern\dimen@}%
\advance\[email protected]\dimexpr\macc@kerna
%Place the combined final kern (-\dimen@) if it is >0 or if a superscript follows:
\let\final@kern#2%
\ifdim\dimen@<\z@ \let\final@kern1\fi
\if\final@kern1 \kern-\dimen@\fi
\else
\overline{\rel@kern{-0.6}\kern\dimen@#1}%
\fi
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
%The following initialises \macc@kerna and calls \mathaccent:
\if#31
\macc@nested@a\relax111{#1}%
\else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
\def\gobble@till@marker##1\endmarker{}%
\futurelet\first@char\gobble@till@marker#1\endmarker
\ifcat\noexpand\first@char A\else
\def\first@char{}%
\fi
\macc@nested@a\relax111{\first@char}%
\fi
\endgroup
}
\makeatother
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\C}{\mathbb{C}}
\renewcommand{\l}{\lambda}
\renewcommand{\L}{\Lambda}
\newcommand{\G}{\mathscr{G}}
\newcommand{\B}{\mathscr{B}}
\renewcommand{\d}{\delta}
\newcommand{\e}{\epsilon}
\renewcommand{\a}{\alpha}
\renewcommand{\b}{\beta}
\renewcommand{\r}{\mathrm{r}}
\newcommand{\n}{\mathrm{N}}
\newcommand{\g}{\gamma}
\renewcommand{\th}{\uptheta}
\let\emptyset\varnothing
\renewcommand{\qedsymbol}{$\blacksquare$}
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\newcommand{\ts}{\textstyle}
\newcommand{\func}[3]{#1\mathpunct{:}#2\to#3}
\newcommand{\mat}[1]{\left\llbracket #1 \right\rrbracket}
\newcommand{\scr}[1]{\mathscr{#1}}
\DeclareMathOperator{\image}{Im}
\newcommand{\comb}[2]{\begin{psmallmatrix}#1 \\ #2\end{psmallmatrix}}
\renewcommand{\limsup}{\widebar{\lim}\,}
\renewcommand{\liminf}{\underline{\lim}\,}
%\usepackage[symbol]{footmisc}
%\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\setbeamercolor{block title}{use=structure}
\setbeamercolor{block body}{parent=normal text,use=block title,fg=yellow,bg=black}
\makeatletter
\newenvironment<>{proofs}[1][\proofname]{\par\def\insertproofname{\scshape #1\@addpunct{:}}\usebeamertemplate{proof begin}#2} {\usebeamertemplate{proof end}}
\newenvironment<>{proofc}{\setbeamertemplate{proof begin}{\begin{block}{}}\par\usebeamertemplate{proof begin}} {\usebeamertemplate{proof end}}
\newenvironment<>{proofe}{\par\pushQED{\qed}\setbeamertemplate{proof begin}{\begin{block}{}}\usebeamertemplate{proof begin}} {\popQED\usebeamertemplate{proof end}}
\makeatother
\makeatletter
\renewenvironment<>{proof}[1][\proofname]
{
\par
\def\insertproofname{\scshape #1\@addpunct{:}}%
\usebeamertemplate{proof begin}#2
\parskip 1ex
\pushQED{\qed}
}
{
\popQED\usebeamertemplate{proof end}
}
\makeatother
\setbeamertemplate{blocks}[rounded][shadow=false]
%\setbeamercolor{block title proofs}{use=structure}
%\setbeamercolor{block body proofs}{parent=normal text,use=block title proof,fg=yellow,bg=black}
%
%\setbeamercolor{block title proofc}{use=structure}
%\setbeamercolor{block body proofc}{parent=normal text,use=block title proof,fg=yellow,bg=black}
%
%\setbeamercolor{block title proofe}{use=structure}
%\setbeamercolor{block body proofe}{parent=normal text,use=block title proof,fg=yellow,bg=black}
\BeforeBeginEnvironment{theorem}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=pink!50!white}
\setbeamercolor{block body}{fg=black, bg=pink!25!white}
}
\AfterEndEnvironment{theorem}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}
\BeforeBeginEnvironment{proposition}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=pink!40!white}
\setbeamercolor{block body}{fg=black, bg=pink!15!white}
}
\AfterEndEnvironment{proposition}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}
\BeforeBeginEnvironment{corollary}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=pink!30!white}
\setbeamercolor{block body}{fg=black, bg=pink!5!white}
}
\AfterEndEnvironment{corollary}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}
\BeforeBeginEnvironment{lemma}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=pink!30!white}
\setbeamercolor{block body}{fg=black, bg=pink!5!white}
}
\AfterEndEnvironment{lemma}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}
\BeforeBeginEnvironment{definition}{%
\setbeamercolor{block title}{fg=red!75!black,bg=olive!40!white}
\setbeamercolor{block body}{fg=black, bg=olive!20!white}
}
\AfterEndEnvironment{definition}{
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}
%%\setbeamercolor{background canvas}{bg=black}
%\setbeamercolor{proofs}{fg=black}
%\setbeamercolor{proofc}{fg=black}
%\setbeamercolor{proofe}{fg=black}
%\setbeamerfont{framesubtitle}{size=\large,font=\scshape}
%\setbeamertemplate{theorem}[ams style]
%\setbeamertemplate{figures}[numbered]
\setbeamertemplate{theorem}[ams style]
\setbeamertemplate{theorems}[numbered]
\makeatletter
\ifbeamer@countsect
\newtheorem{theorem}{\translate{Theorem}}[section]
\else
\newtheorem{theorem}{\translate{Theorem}}[section]
\fi
\newtheorem{corollary}{\translate{Corollary}}[theorem]
\newtheorem{lemma}[theorem]{\translate{Lemma}}
\newtheorem{proposition}[theorem]{\translate{Proposition}}
\newtheorem{problem}{\translate{Problem}}
\newtheorem{solution}{\translate{Solution}}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{\translate{Definition}}
\newtheorem{definitions}[theorem]{\translate{Definitions}}
\newtheorem*{exc}{\translate{Exercise}}
\newtheorem*{excs}{\translate{Exercises}}
\newenvironment{lem}{\begin{lemma}}{\end{lemma}}
\newenvironment{thm}{\begin{theorem}}{\end{theorem}}
\newenvironment{cor}{\begin{corollary}}{\end{corollary}}
\newenvironment{defn}{\begin{definition}}{\end{definition}}
\newenvironment{prop}{\begin{proposition}}{\end{proposition}}
\makeatother
\makeatletter
\def\th@myexmpstyle{%
\small % body font
\setbeamercolor{block title}{use=structure,fg=magenta,bg=black}
\setbeamercolor{block body}{fg=lime,bg=black}
\def\inserttheoremblockenv{block}
}
\makeatother
\theoremstyle{myexmpstyle}
\newtheorem*{example}{\translate{Example:}}
\newtheorem*{examples}{\translate{Examples:}}
\makeatletter
\def\th@mystyle{%
\normalfont % body font
\setbeamercolor{block title}{use=structure}
\setbeamercolor{block body}{bg=black, fg=cyan!40!white}
\def\inserttheoremblockenv{block}
}
\makeatother
\theoremstyle{mystyle}
\newtheorem*{Rem}{Remark:}
\newtheorem*{rems}{Remarks:}
\newenvironment*{Exmps}
{
\begin{examples}\parskip 1ex
\vspace{-1ex}\footnotesize
\begin{enumerate}%[label=\arabic*.]
}
{
\end{enumerate}\normalsize
\end{examples}
}
\newenvironment*{exercises}
{
\footnotesize
\begin{excs}\
\vspace{-1ex}
\begin{enumerate}%[label=\arabic*.]
}
{
\end{enumerate}
\end{excs}
\normalsize
}
\newenvironment*{exmp}{\begin{example}\parskip 1ex \footnotesize}{\end{example}\normalsize}
\newenvironment*{exercise}{\begin{exc}\footnotesize}{\end{exc}\normalsize}
\newenvironment{rem}{\begin{Rem}\parskip 1ex \vspace{-2ex}\footnotesize}{\end{Rem}\normalsize}
\newenvironment{Rems}
{
\begin{rems}
\vspace{-1ex}\footnotesize
\begin{enumerate}%[label=(\alph*)]
}
{
\end{enumerate}\normalsize
\end{rems}
}
%\usepackage{varioref}
\usepackage{hyperref}
\hypersetup
{
colorlinks=true, %set true if you want colored links
% linktoc=all, %set to all if you want both sections and subsections linked
linkcolor=black, %choose some color if you want links to stand out
citecolor=teal,
}
\usepackage{cleveref}
\crefname{prop}{proposition}{propositions}
\crefname{proposition}{proposition}{propositions}
\crefname{lemma}{lemma}{lemmas}
\crefname{lem}{lemma}{lemmas}
\crefname{figure}{figure}{figures}
%\newcommand{\myref}[1]{\beamergotobutton{\cref{#1}}}
\newcommand{\link}[2]{\hyperlink{#1}{\beamerbutton{#2}}}
% \newcommand{\Label}[1]{\hypertarget<.>{label#1}{}}
\bibliographystyle{amsalpha}
\apptocmd{\frame}{}{\justifying}{}
\parskip 1ex
%
%
%
\begin{document}
\makeatletter
\def\stringpleasehidethistitle{{please hide this title\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}
\defbeamertemplate*{frametitle}{only sub}[1][left]
{
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\@tempdima=\textwidth%
\advance\@tempdima by\beamer@leftmargin%
\advance\@tempdima by\beamer@rightmargin%
\begin{beamercolorbox}[sep=0.3cm,#1,wd=\the\@tempdima]{frametitle}
\usebeamerfont{frametitle}%
\vbox{}\vskip-1ex%
\if@tempswa\else\csname beamer@fte#1\endcsname\fi%
\ifx\insertframetitle\stringpleasehidethistitle% check if magic word presents
\else% check if magic word presents
\strut\insertframetitle\strut\par% check if magic word presents
\fi% check if magic word presents
{%
\ifx\insertframesubtitle\@empty%
\else%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
\fi
}%
\vskip-1ex%
\if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
\end{beamercolorbox}%
}
\begin{frame}
$ a^{\prime} $\\ % WORKS!
$ a' $ % DOES NOT WORK!
\end{frame}
\end{document}
答案1
问题出在hanging
包装上。请参阅悬挂式包装因撇号而堵塞寻求解决方案。
我通过记录运行文档时发生的错误找到了答案:
! TeX capacity exceeded, sorry [input stack size=5000].
'->\futurelet
\next \h@ngrqtest
l.422 \end{frame}
注意到这\h@ngrqtest
是问题所在,我用谷歌搜索了这个问题(最初只是想看看有问题的包是什么)并发现了你遇到的错误。