我该如何定义幻影块?

我该如何定义幻影块?

我想定义一种块类型,当给它输入一些文本时,我不会打印任何内容,但它将占用与普通块完全相同的空间。

我使用的是白色背景,所以我尝试将所有内容都变成白色,但我无法将阴影变成白色。

编辑:最小的例子如下:

\documentclass[handout]{beamer}
\usetheme{Boadilla}
\newenvironment<>{phantomblock}[1][]{%
  \setbeamercolor{block title example}{fg=white,bg=white}%
  \setbeamercolor{block body example}{fg=white,bg=white}%
  \begin{example}#2[#1]}{\end{example}}
\begin{document}
\begin{frame}{title}
\begin{phantomblock}{test}
test
\end{phantomblock}
\end{frame}
\end{document}

其结果为: 在此处输入图片描述

答案1

投影仪规范<all:0>可能是你的朋友。

代码

\documentclass{beamer}

\usetheme{Boadilla}


\begin{document}

\begin{frame}{Some Title}
  The text before an invisible block:
  \medskip
  
  {\itshape
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Aenean commodo ligula eget dolor.}
  %
  % Invisible block; see the specification <all:0>.
  % ---------------------------------------
  \begin{block}{Title of this block}<all:0>
    Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
    Nulla consequat massa quis enim. Donec pede justo, fringilla vel,
    aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a,
    venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.
    Integer tincidunt. Cras dapibus.
  \end{block}
  % ---------------------------------------
  Some text after an invisible block.
  \medskip
  
  {\itshape
    Cum sociis natoque penatibus et magnis
    dis parturient montes, nascetur ridiculus mus.}
\end{frame}

\end{document}

输出

在此处输入图片描述

结论

现在,定义这种类型的块很容易。但我认为这是在浪费时间,因为只需将上述规范添加到环境中block(或任何其他接受此类规范的环境)即可。

但如果你真的想要它,你可以编写类似以下代码。

\newenvironment{secret}[1][]%
    {\begin{block}<all:0>
        #1}
    {\end{block}}

现在,您可以按照通常的方式调用您的不可见\begin{secret}环境\end{secret}

相关内容