投影机中非圆形块的阴影

投影机中非圆形块的阴影

我的问题很简单:是否可以在投影机中为非圆形块添加阴影?

我一直在尝试:

\setbeamertemplate{blocks}[rounded=false][shadow=true]

但没有成功。我使用的是马尔堡主题。这是序言代码:

\documentclass[serif]{beamer}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[spanish]{babel}
\usepackage{mathpazo}
\linespread{1.05} 

\author{Lorem ipsum}
\title{LOrem ipsum}
\setbeamertemplate{navigation symbols}{}

 \usetheme[hideallsubsections,left,width=2cm]{Marburg}

\usecolortheme{rose}
 \setbeamercolor{titlelike}{bg=structure,fg=white}

\logo{\includegraphics[height=1.5cm]{../Fotos/Logo.png}}

  \setbeamertemplate{sidebar left}{
      \begin{minipage}{2cm}
          \centering      
    \vspace{\baselineskip}
    \insertlogo

      \vspace{\baselineskip}
      \color{white}{\insertshorttitle[width={2cm},center,respectlinebreaks]}

\insertshortauthor[width={2cm},center,respectlinebreaks] \vspace{\baselineskip}

\insertverticalnavigation{2cm}

\vspace{10\baselineskip}

\insertframenumber / \inserttotalframenumber
\end{minipage}
  }

\begin{document}
...

提前致谢,

查理

答案1

不幸的是,这在本机上并不容易beamer(但有一种使用外部工具的简单方法可以实现它),因为阴影只应用于圆角框(使用构建beamerboxesrounded),而不应用于非圆角框(使用单独构建beamercolorbox)。

作为替代方案,我在这里为您提供一种可能性,使用tcolorbox包中定义了模拟beamer类所定义的块,但添加了阴影。在下面的例子中,我展示了如何轻松地定义适当的样式并为和构建阴影exampleblock克隆alertblock

\documentclass[]{beamer}
\usepackage{mathpazo}
\usepackage[many]{tcolorbox}
\linespread{1.05} 

\usetheme[hideallsubsections,left,width=2cm]{Marburg}
\usefonttheme{serif}
\usecolortheme{rose}

\setbeamercolor{titlelike}{bg=structure,fg=white}

\setbeamertemplate{sidebar left}{%
\begin{minipage}{2cm}
  \centering      
  \vspace{\baselineskip}
  \insertlogo%
  \vspace{\baselineskip}
  \color{white}{\insertshorttitle[width={2cm},center,respectlinebreaks]}%
  \insertshortauthor[width={2cm},center,respectlinebreaks] \vspace{\baselineskip}
  \insertverticalnavigation{2cm}
  \vspace{10\baselineskip}
  \insertframenumber / \inserttotalframenumber
  \end{minipage}%
}

\makeatletter
\tikzset{beamer@color/.style={top color=\kvtcb@colback,bottom color=\kvtcb@colback}}
\makeatother

\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}<1->{Test exampleblock}
This is a block provided by the \texttt{beamer} class.
\end{exampleblock}

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

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

\begin{tcalertblock}<4-6>{Test tcalertblock}
This is a block provided by the \texttt{tcolorbox} package.
\end{tcalertblock}

\end{frame}

\end{document}

结果展示了新的覆盖感知环境的实际运行:

在此处输入图片描述

请注意,serif 类选项已过时,因此

\documentclass[serif]{beamer}

你应该使用

\usefonttheme{serif}

答案2

您可以使用新的 tcolorbox 内部主题(https://www.ctan.org/pkg/beamertheme-tcolorbox)。此主题有一个选项可以打开独立于圆角/尖角的阴影:\useinnertheme[shadow]{tcolorbox}

完整示例:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[spanish]{babel}
\usepackage{mathpazo}
\linespread{1.05} 

\author{Lorem ipsum}
\title{LOrem ipsum}
\setbeamertemplate{navigation symbols}{}

 \usetheme[hideallsubsections,left,width=2cm]{Marburg}

\usecolortheme{rose}
 \setbeamercolor{titlelike}{bg=structure,fg=white}

\logo{\includegraphics[height=1.5cm]{example-image-duck}}

  \setbeamertemplate{sidebar left}{
      \begin{minipage}{2cm}
          \centering      
    \vspace{\baselineskip}
    \insertlogo

      \vspace{\baselineskip}
      \color{white}{\insertshorttitle[width={2cm},center,respectlinebreaks]}

\insertshortauthor[width={2cm},center,respectlinebreaks] \vspace{\baselineskip}

\insertverticalnavigation{2cm}

\vspace{10\baselineskip}

\insertframenumber / \inserttotalframenumber
\end{minipage}
  }
  
\useinnertheme[shadow]{tcolorbox}

\begin{document}

\begin{frame}
\begin{block}{title}
content...
\end{block}
\end{frame}

\end{document}

在此处输入图片描述

相关内容