TransWikia.com

Shortcut for $ ^{prime} $ is not working in beamer

TeX - LaTeX Asked by Subhajit Paul on December 2, 2020

I am preparing some lecture notes in beamer documentclass. After I added quite a much of customisations, I realised that the shortcut ' for $ ^{prime} $ is not working. How do I restore the usual behaviour? Following is an MWE. Please help.

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}footnotesizeinsertfootnotetextpar%
}

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
renewcommandp@subfigure{}
makeatother


makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
    setbox0hbox{${mathaccent"0362{#1}}^H$}%
    setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
    ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@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
    defmathaccent##1##2{%
        %Enable nesting of accents:
        letmathaccentsave@mathaccent
        %If there's more than a single symbol, use the first character instead (see below):
        if#32 letmacc@nucleusfirst@char fi
        %Determine the italic correction:
        setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
        setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
        dimen@wdtw@
        advancedimen@-wdz@
        %Now dimen@ is the italic correction of the symbol.
        dividedimen@ 3
        @tempdimawdtw@
        advance@tempdima-scriptspace
        %Now @tempdima is the width of the symbol.
        divide@tempdima 10
        advancedimen@-@tempdima
        %Now dimen@ = (italic correction / 3) - (Breite / 10)
        ifdimdimen@>z@ dimen@0ptfi
        %The bar will be shortened in the case dimen@<0 !
        rel@kern{0.6}kern-dimen@
        if#31
        overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
        [email protected]@kerna
        %Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
        letfinal@kern#2%
        ifdimdimen@<z@ letfinal@kern1fi
        iffinal@kern1 kern-dimen@fi
        else
        overline{rel@kern{-0.6}kerndimen@#1}%
        fi
    }%
    macc@depth@ne
    letmath@bgroup@empty letmath@egroupmacc@set@skewchar
    mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
    macc@set@skewcharrelax
    letmathaccentVmacc@nested@a
    %The following initialises macc@kerna and calls mathaccent:
    if#31
    macc@nested@arelax111{#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:
    defgobble@till@marker##1endmarker{}%
    futureletfirst@chargobble@till@marker#1endmarker
    ifcatnoexpandfirst@char Aelse
    deffirst@char{}%
    fi
    macc@nested@arelax111{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}
letemptysetvarnothing
renewcommand{qedsymbol}{$blacksquare$}
newcommand{abs}[1]{leftlvert #1 rightrvert}
newcommand{ts}{textstyle}
newcommand{func}[3]{#1mathpunct{:}#2to#3}
newcommand{mat}[1]{leftllbracket #1 rightrrbracket}
newcommand{scr}[1]{mathscr{#1}}
DeclareMathOperator{image}{Im}
newcommand{comb}[2]{begin{psmallmatrix}#1  #2end{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]{pardefinsertproofname{scshape #1@addpunct{:}}usebeamertemplate{proof begin}#2} {usebeamertemplate{proof end}}

newenvironment<>{proofc}{setbeamertemplate{proof begin}{begin{block}{}}parusebeamertemplate{proof begin}}  {usebeamertemplate{proof end}}

newenvironment<>{proofe}{parpushQED{qed}setbeamertemplate{proof begin}{begin{block}{}}usebeamertemplate{proof begin}}        {popQEDusebeamertemplate{proof end}}
makeatother
        
makeatletter
renewenvironment<>{proof}[1][proofname]
{
    par
    definsertproofname{scshape #1@addpunct{:}}%
    usebeamertemplate{proof begin}#2
    parskip 1ex
    pushQED{qed}
}
{
    popQEDusebeamertemplate{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
defth@myexmpstyle{%
    small % body font
    setbeamercolor{block title}{use=structure,fg=magenta,bg=black}
    setbeamercolor{block body}{fg=lime,bg=black}
    definserttheoremblockenv{block}
}
makeatother
theoremstyle{myexmpstyle}
newtheorem*{example}{translate{Example:}}
newtheorem*{examples}{translate{Examples:}}



makeatletter
defth@mystyle{%
    normalfont % body font
    setbeamercolor{block title}{use=structure}
    setbeamercolor{block body}{bg=black, fg=cyan!40!white}
    definserttheoremblockenv{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
    defstringpleasehidethistitle{{please hide this titleifnumbeamer@autobreakcount>0relax{}spaceusebeamertemplate*{frametitle continuation}fi}}
    defbeamertemplate*{frametitle}{only sub}[1][left]
    {
        ifbeamercolorempty[bg]{frametitle}{}{nointerlineskip}%
        @tempdima=textwidth%
        advance@tempdima bybeamer@leftmargin%
        advance@tempdima bybeamer@rightmargin%
        begin{beamercolorbox}[sep=0.3cm,#1,wd=the@tempdima]{frametitle}
            usebeamerfont{frametitle}%
            vbox{}vskip-1ex%
            if@tempswaelsecsname beamer@fte#1endcsnamefi%
            ifxinsertframetitlestringpleasehidethistitle%   check if magic word presents
            else%                                             check if magic word presents
            strutinsertframetitlestrutpar%               check if magic word presents
            fi%                                               check if magic word presents
            {%
                ifxinsertframesubtitle@empty%
                else%
                {usebeamerfont{framesubtitle}usebeamercolor[fg]{framesubtitle}insertframesubtitlestrutpar}%
                fi
            }%
            vskip-1ex%
            [email protected]% set inside beamercolorbox... evil here...
        end{beamercolorbox}%
    }
    
    begin{frame}
        $ a^{prime} $ % WORKS!
        $ a' $ % DOES NOT WORK!
    end{frame}
end{document}

One Answer

The problem is the hanging package. See hanging package chokes on apostrophes for a solution.

I figured this out by noting the error that was occurring when running your document:

! TeX capacity exceeded, sorry [input stack size=5000].
'->futurelet 
              next h@ngrqtest 
l.422     end{frame}

Noting that h@ngrqtest was the problem, I googled that (originally just to see what the offending package was) and turned up the error that you encountered.

Correct answer by Don Hosek on December 2, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP