如何在 beamer 中将 Block 环境向左移动?

如何在 beamer 中将 Block 环境向左移动?

我有一个从 beamer 演示文稿中的块环境中出现的图形: 问题

我发现此主题并定义了一个 varblock 环境,我将宽度设置得稍大一些。但生成的块只向右扩展,因此不在框架的中心。我想让这个块居中,或者将它及其内容移到左侧。

瓦布洛克

我尝试使用\hspace\begin{center}\begin{minipage}{blockwidth} <new block environment> \end{minipage}\end{center},但在两种情况下,varblock 环境都会重新缩放(移动?)并且变得比框架更大。

此外,使用 varblock 时,我的图像会因为某种原因向右移动(参见最右侧圆与框架末端的交点)。如果\setbeamertemplate{blocks}[rounded]从代码中删除,这种影响会减弱,但我需要它。

使用块使用 varblock

如何使 varblock 居中并防止其将我的图像移到右侧?或者,如何将 varblock 及其内容移到 letf?

具有通常的 block 和 varblock 的 MWE 如下:

\documentclass{beamer}
\usepackage{tikz} 

\newenvironment<>{varblock}[2][.9\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}
  

\usecolortheme{orchid}
\setbeamertemplate{blocks}[rounded]

\begin{document}

%%%%%%%% Usual Block Environment
\begin{frame}{Title}
 \begin{block}{Proof}
    \begin{minipage}[b]{0.55\linewidth}             
        \begin{itemize}
            \item some text
        \end{itemize}
    \end{minipage}
    \begin{minipage}[b]{0.35\linewidth}
        \begin{figure}
            \centering
            \begin{tikzpicture}                    
                %draw first slide circles
                \only<1>{
                    \draw (95:1.5) circle (1cm);
                    \draw (0:1.5) circle (1cm);
                    \draw (-180:1.5) circle (1cm);
                }
                %draw second slide circles
                \only<2>{
                    \draw[red] (0,0) circle (1cm);
                    \draw (95:2) circle (1cm);
                    \draw (0:2) circle (1cm);
                    \draw (-180:2) circle (1cm);
                }
            \end{tikzpicture}
        \end{figure}
    \end{minipage}
 \end{block}
\end{frame}

%%%%%%%% Adjustable Block Environment
\begin{frame}{Title}
 \begin{varblock}[1.05\linewidth]{Proof}
    \begin{minipage}[b]{0.55\linewidth}             
        \begin{itemize}
            \item some text
        \end{itemize}
    \end{minipage}
    \begin{minipage}[b]{0.35\linewidth}
        \begin{figure}
            \centering
            \begin{tikzpicture}                    
                %draw first slide circles
                \only<1>{
                    \draw (95:1.5) circle (1cm);
                    \draw (0:1.5) circle (1cm);
                    \draw (-180:1.5) circle (1cm);
                }
                %draw second slide circles
                \only<2>{
                    \draw[red] (0,0) circle (1cm);
                    \draw (95:2) circle (1cm);
                    \draw (0:2) circle (1cm);
                    \draw (-180:2) circle (1cm);
                }
            \end{tikzpicture}
        \end{figure}
    \end{minipage}
 \end{varblock}
\end{frame}
\end{document}

提前致谢!

答案1

您可以使用adjustbox包来实现这一点。如果您的超出了的tikzpicture选择,那么它将缩小到。因此,可调块中的圆具有不同的半径。max widthadjustboxmax width

基于您的代码的 MWE

 \documentclass{beamer}
    \usepackage{tikz, adjustbox} 
    
    \newenvironment<>{varblock}[2][.9\textwidth]{%
      \setlength{\textwidth}{#1}
      \begin{actionenv}#3%
        \def\insertblocktitle{#2}%
        \par%
        \usebeamertemplate{block begin}}
      {\par%
        \usebeamertemplate{block end}%
      \end{actionenv}}
      
    
    \usecolortheme{orchid}
    \setbeamertemplate{blocks}[rounded]
    
    \begin{document}
    
    %%%%%%%% Usual Block Environment
    \begin{frame}{Block Environment}
     \begin{block}{Proof}
     \begin{minipage}[b]{0.39\linewidth}             
            \begin{itemize}
                \item some text
            \end{itemize}
        \end{minipage}  
        \hfill
        \begin{adjustbox}{valign=b, max width=0.59\linewidth}
                \begin{tikzpicture}                    
                    %draw first slide circles
                    \only<1>{
                        \draw (95:1.5) circle (1cm);
                        \draw (0:1.5) circle (1cm);
                        \draw (-180:1.5) circle (1cm);
                    }
                    %draw second slide circles
                    \only<2>{
                        \draw[red] (0,0) circle (1cm);
                        \draw (95:2) circle (1cm);
                        \draw (0:2) circle (1cm);
                        \draw (-180:2) circle (1cm);
                    }
                \end{tikzpicture}
        \end{adjustbox}
     \end{block}
    \end{frame}
    
    %%%%%%%% Adjustable Block Environment
    \begin{frame}{Adjustable Block Environment}
     \begin{varblock}[0.85\linewidth]{Proof}
        \begin{minipage}[b]{0.39\linewidth}             
            \begin{itemize}
                \item some text
            \end{itemize}
        \end{minipage}
        \hfill
        \begin{adjustbox}{valign=b, max width=0.59\linewidth}
                \begin{tikzpicture}                    
                    %draw first slide circles
                    \only<1>{
                        \draw (95:1.5) circle (1cm);
                        \draw (0:1.5) circle (1cm);
                        \draw (-180:1.5) circle (1cm);
                    }
                    %draw second slide circles
                    \only<2>{
                        \draw[red] (0,0) circle (1cm);
                        \draw (95:2) circle (1cm);
                        \draw (0:2) circle (1cm);
                        \draw (-180:2) circle (1cm);
                    }
                \end{tikzpicture}
        \end{adjustbox}
     \end{varblock}
    \end{frame}
    
    \end{document}

在此处输入图片描述 在此处输入图片描述

相关内容