Beamer:環境的自訂樣式

Beamer:環境的自訂樣式

投影儀,有一些預先定義的(顏色)樣式,例如清楚的,定理,定義評論。我的第一個問題是我可以在哪裡找到這些樣式的清單?第二個是我怎樣才能創造自己的風格?例如我想申請橘子備註顏色。

答案1

以下是您如何輕鬆定義新的自訂類似定理的區塊;我們的想法是使用自訂設定定義新樣式,然後將這個新樣式用於您的結構:

\documentclass{beamer}
\usetheme{Warsaw}

\makeatletter
\def\th@mystyle{%
    \normalfont % body font
    \setbeamercolor{block title example}{bg=orange,fg=white}
    \setbeamercolor{block body example}{bg=orange!20,fg=black}
    \def\inserttheoremblockenv{exampleblock}
  }
\makeatother
\theoremstyle{mystyle}
\newtheorem*{remark}{Remark}

\begin{document}

\begin{frame}
\begin{theorem}[An important theorem]
    Some text
\end{theorem}

\begin{remark}[Some important remark]
    Some text
\end{remark}
\end{frame}

\end{document}

在此輸入影像描述

類別定理結構定義的相關設定:

在文件中beamerbasetheorems.sty您會發現:

\def\th@example{\th@remark}

\ifbeamer@countsect
  \newtheorem{theorem}{\translate{Theorem}}[section]
\else
  \newtheorem{theorem}{\translate{Theorem}}
\fi
\newtheorem{corollary}[theorem]{\translate{Corollary}}
\newtheorem{fact}[theorem]{\translate{Fact}}
\newtheorem{lemma}[theorem]{\translate{Lemma}}
\newtheorem{problem}[theorem]{\translate{Problem}}
\newtheorem{solution}[theorem]{\translate{Solution}}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{\translate{Definition}}
\newtheorem{definitions}[theorem]{\translate{Definitions}}

\theoremstyle{example}
\newtheorem{example}[theorem]{\translate{Example}}
\newtheorem{examples}[theorem]{\translate{Examples}}

表示example樣式與備註樣式相同;此plain風格用於定理、推論、引理、問題、解。該definition樣式適用於定義,該example樣式適用於範例。

同樣相關的可能是以下幾行

\def\inserttheoremheadfont{\the\thm@headfont}
  \def\inserttheoremblockenv{block}

  \def\th@example{%
    \normalfont % body font
    \def\inserttheoremblockenv{exampleblock}
  }

這基本上表明,對於範例樣式,exampleblock使用了,但對於所有其他類似定理的結構,都block使用了。

beamerbaseauxtemplates.sty一項發現中:

\defbeamertemplate{theorem begin}{ams style}
{%
  \begin{\inserttheoremblockenv}
    {%
      \inserttheoremheadfont
      \inserttheoremname
      \inserttheoremnumber
      \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
      \inserttheorempunctuation
    }%
}

\defbeamertemplate{theorem end}{ams style}
{\end{\inserttheoremblockenv}}


\defbeamertemplate{theorem begin}{numbered}
{%
  \begin{\inserttheoremblockenv}
    {%
      \inserttheoremname
      \inserttheoremnumber
      \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
    }%
}

\defbeamertemplate{theorem end}{numbered}
{\end{\inserttheoremblockenv}}


\defbeamertemplate{theorem begin}{normal font}
{
  \normalfont
  \begin{\inserttheoremblockenv}
  {%
    \inserttheoremname
    \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
  }%
}

\defbeamertemplate{theorem end}{normal font}
{\end{\inserttheoremblockenv}}

相關內容