欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

LaTeX的Beamer元素控制

程序员文章站 2022-03-09 09:37:15
...

beameruserguide.pdf中给出了Beamer完全的说明。研究相应的文件,如beamerthemeMadrid.sty,也可以在sty中修改

去除Beamer中的头部、导航条、脚部

headline

\setbeamertemplate{headline}{} %清空头部

%%减少正文与头部的距离
\addtobeamertemplate{frametitle}{}{\vspace*{-0.8cm}}

navigator bar

\beamertemplatenavigationsymbolsempty %Remove the Navigation Bar
or
\setbeamertemplate{navigation symbols}{}

footline

\setbeamertemplate{footline}[page number]{}

正文部分

定理、定义等环境的编号

\setbeamertemplate{theorems}[numbered]

or
\setbeamertemplate{theorems}[ams style]

or use the envcountsect class option
\documentclass[envcountsect]{beamer}

theorems, definitions, and so on to be numbered locally to each section (by default they are numbered consecutively throughout the presentation).

不同的block使用不同的颜色,比如定理、定义、证明等环境的标题和正文有不同的颜色(via1,简单情况可参看via2)

\documentclass{beamer}

\useinnertheme[shadow=true]{rounded}

\usepackage{etoolbox}

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

\setbeamercolor{block title example}{use=example text,fg=example text.fg,bg=example text.fg!20!bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!50!bg}

\addtobeamertemplate{proof begin}{%
    \setbeamercolor{block title}{fg=black,bg=red!50!white}
    \setbeamercolor{block body}{fg=red, bg=red!30!white}
}{}

\BeforeBeginEnvironment{theorem}{
    \setbeamercolor{block title}{fg=black,bg=orange!50!white}
    \setbeamercolor{block body}{fg=orange, bg=orange!30!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{definition}{%
    \setbeamercolor{block title}{fg=black,bg=pink!50!white}
    \setbeamercolor{block body}{fg=pink, bg=pink!30!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}
}

\begin{document}
\begin{frame}
    \begin{block}{My block}
        A block.
    \end{block}

    \begin{definition}[My definition]
        A definition.
    \end{definition}

    \begin{theorem}[My theorem]
        A theorem.
    \end{theorem}
    \begin{proof}[My proof]
        A proof.
    \end{proof}
    \begin{example}[My example]
        An example.
    \end{example}

    \begin{block}{My block}
        A block.
    \end{block}    

\end{frame}
\end{document}

 

相关标签: LaTeX