编辑 beamerbaseboxes.sty 以创建方角

编辑 beamerbaseboxes.sty 以创建方角

我碰到答案,其中显示了在使用“圆角”框 innertheme 时如何编辑文件beamerbaseboxes.sty以增加框角的“圆度”。在这个答案中,作者更改了诸如\pgfpathqcurveto\pgflineto和 之类的数值\pgfpoint

我想知道要使用什么数值才能获得完全方角(无圆角)。我想这样做没有使用“矩形”内主题,这样我就可以保留圆形主题提供的阴影。

答案1

基于https://tex.stackexchange.com/a/176356/36296

您可以轻松地将评论中链接的答案与Boadilla主题一起使用:

\documentclass{beamer}
\usepackage[many]{tcolorbox}

\usetheme{Boadilla}

\tikzset{beamer@color/.style={fill=none,top color=tcbcol@back,bottom color=tcbcol@back}}

\tcbset{beamer/.style={skin=beamer,boxrule=0mm,titlerule=1mm,toptitle=0.5mm,arc=2mm,fonttitle=\bfseries,drop fuzzy shadow=black}}

\tcbset{
tcbeamer/.style={
  beamer,
  width=\textwidth+3pt,
  enlarge left by=-3pt,
  bottom=0pt,
  top=0pt,
  left=1pt,
  right=1pt,
  arc=0pt,
  outer arc=0pt,
  toptitle=0pt,
  bottomtitle=-1pt,
  }
}

\newenvironment<>{tcexampleblock}[1]
  {\begin{actionenv}#2\begin{tcolorbox}[
    adjusted title=#1,
    tcbeamer,
    colback=block body example.bg,
    colframe=block title example.bg,
    fonttitle=\large\color{block title example.fg}
    ]
  }
  {\end{tcolorbox}\end{actionenv}}

\newenvironment<>{tcalertblock}[1]
  {\begin{actionenv}#2\begin{tcolorbox}[
    adjusted title=#1,
    tcbeamer,
    colback=block body alerted.bg,
    colframe=block title alerted.bg,
    fonttitle=\large\color{block title alerted.fg},
    adjusted title=#1,
    ]
  }
  {\end{tcolorbox}\end{actionenv}}

\begin{document}

\begin{frame}

\begin{exampleblock}{Test exampleblock}
This is a block provided by the \texttt{beamer} class.
\end{exampleblock}

\begin{tcexampleblock}{Test tcexampleblock}
This is a block provided by the \texttt{tcolorbox} package.
\end{tcexampleblock}

\begin{alertblock}{Test alertblock}
This is a block provided by the \texttt{beamer} class.
\end{alertblock}

\begin{tcalertblock}{Test tcalertblock}
This is a block provided by the \texttt{tcolorbox} package.
\end{tcalertblock}

\end{frame}

\end{document}

在此处输入图片描述

使用新的 tcolorbox 内部主题可以进一步简化代码 (https://www.ctan.org/pkg/beamertheme-tcolorbox

此主题允许您拥有带阴影的方框:

\documentclass{beamer}
\usepackage[many]{tcolorbox}

\usetheme{Boadilla}

\useinnertheme[rounded=false]{tcolorbox}

\begin{document}

\begin{frame}

\begin{exampleblock}{Test exampleblock}
This is a block provided by the \texttt{beamer} class.
\end{exampleblock}

\begin{alertblock}{Test alertblock}
This is a block provided by the \texttt{beamer} class.
\end{alertblock}

\end{frame}

\end{document}

在此处输入图片描述

或者如果您还想保持标题和正文之间的颜色渐变,您可以像这样更改角半径:

\documentclass{beamer}
\usepackage[many]{tcolorbox}

\usetheme{Boadilla}

\useinnertheme{tcolorbox}

\tcbset{
  arc=0mm
}

\begin{document}

\begin{frame}

\begin{exampleblock}{Test exampleblock}
This is a block provided by the \texttt{beamer} class.
\end{exampleblock}

\begin{alertblock}{Test alertblock}
This is a block provided by the \texttt{beamer} class.
\end{alertblock}

\end{frame}

\end{document}

在此处输入图片描述

相关内容