扩大投影机中块的宽度

扩大投影机中块的宽度

相关问题是我想永久扩大投影仪中块的宽度。

效果应该是图片底部的块,而顶部的块是标准尺寸。

在此处输入图片描述


感谢 Gonzalo 的回答,临时解决方案是:

\documentclass[10pt]{beamer}
\usetheme{Warsaw}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\makeatother
\newlength\myblockwd
\setlength\myblockwd{0.95\paperwidth}
\newlength\mylen
\setlength\mylen{\dimexpr\myblockwd-\textwidth\relax}

\makeatletter
\defbeamertemplate{block begin}{myrounded}[1][]
{
  \par\vskip\medskipamount%
  \hspace*{-0.5\mylen}\begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true,width=\myblockwd]%
    {\raggedright\usebeamerfont*{block title}\insertblocktitle}%
    \raggedright%
    \usebeamerfont{block body}%
}
\defbeamertemplate{block end}{myrounded}[1][]
{\end{beamerboxesrounded}\vskip\smallskipamount}

\defbeamertemplate{block alerted begin}{myrounded}[1][]
{
  \par\vskip\medskipamount%
  \hspace*{-0.5\mylen}\begin{beamerboxesrounded}[upper=block title alerted,lower=block body alerted,,width=\myblockwd]%
    {\raggedright\usebeamerfont*{block title alerted}\insertblocktitle}%
    \raggedright%
    \usebeamerfont{block body alerted}%
}%
\defbeamertemplate{block alerted end}{myrounded}[1][]
{\end{beamerboxesrounded}\vskip\smallskipamount}

\defbeamertemplate{block example begin}{myrounded}[1][]
{
  \par\vskip\medskipamount%
  \hspace*{-0.5\mylen}\begin{beamerboxesrounded}[upper=block title example,lower=block body example,width=\myblockwd]
    {\raggedright\usebeamerfont*{block title example}\insertblocktitle}%
    \raggedright%
    \usebeamerfont{block body example}%
}%
\defbeamertemplate{block example end}{myrounded}[1][]
{\end{beamerboxesrounded}\vskip\smallskipamount}

\setbeamertemplate{block begin}[myrounded]
\setbeamertemplate{block alerted begin}[myrounded]
\setbeamertemplate{block example begin}[myrounded]

\makeatother
\title{title}
\author{Name Surname}
\date{date\\ place}
\begin{document}

\begin{frame}
\titlepage
\end{frame}

\section{Section}
\frame{\sectionpage}
\subsection{subsection}
\frame{
\frametitle{title}
\begin{block}{title}
title
\begin{itemize}
\item {title};
\item {title};
\item {title};
\item {title};
\end{itemize}
\end{block}

\begin{block}{title}
title
\begin{itemize}
\item {title};
\item {title};
\item {title};
\item {title};
\end{itemize}
\end{block}
}

\frame{
\frametitle{Title}
\begin{columns}
\begin{column}{1.7in}
\begin{block}<1->{title}
\begin{itemize}
\item title;
\item title;
\item title;
\end{itemize}
\end{block}
\end{column}

\begin{column}{1.7in}
\begin{block}<1->{title}
\begin{itemize}
\item title;
\item title;
\item title;
\end{itemize}
\end{block}
\end{column}
\end{columns}
}

\end{document}

这对于“标准”框架来说非常棒:

在此处输入图片描述

但是当框架被分成两列并且块以某种方式水平“对齐”时,情况就不好了:

在此处输入图片描述

所以,现在的问题是让块在排列成列时能够自动调整大小。

答案1

更新

这里有一个选项,定义wblockwalterblock和 wexampleblock` 环境,它们的行为与原始环境(没有“w”)相同,但具有可控的宽度:

\documentclass{beamer} 
\usetheme{Warsaw}

\newlength\myblockwd
\setlength\myblockwd{0.95\paperwidth}
\newlength\mylen
\setlength\mylen{\dimexpr\myblockwd-\textwidth\relax}

\makeatletter
\defbeamertemplate{block begin}{myrounded}
{
  \par\vskip\medskipamount%
  \hspace*{-0.5\mylen}\begin{beamerboxesrounded}[upper=block title,lower=block body,shadow=true,width=\myblockwd]%
    {\raggedright\usebeamerfont*{block title}\insertblocktitle}%
    \raggedright%
    \usebeamerfont{block body}%
}
\defbeamertemplate{block end}{myrounded}
{\end{beamerboxesrounded}\vskip\smallskipamount}

\defbeamertemplate{block alerted begin}{myrounded}
{
  \par\vskip\medskipamount%
  \hspace*{-0.5\mylen}\begin{beamerboxesrounded}[upper=block title alerted,lower=block body alerted,shadow=true,width=\myblockwd]%
    {\raggedright\usebeamerfont*{block title alerted}\insertblocktitle}%
    \raggedright%
    \usebeamerfont{block body alerted}%
}%
\defbeamertemplate{block alerted end}{myrounded}[1][]
{\end{beamerboxesrounded}\vskip\smallskipamount}

\defbeamertemplate{block example begin}{myrounded}
{
  \par\vskip\medskipamount%
  \hspace*{-0.5\mylen}\begin{beamerboxesrounded}[upper=block title example,lower=block body example,shadow=true,width=\myblockwd]
    {\raggedright\usebeamerfont*{block title example}\insertblocktitle}%
    \raggedright%
    \usebeamerfont{block body example}%
}%
\defbeamertemplate{block example end}{myrounded}[1][]
{\end{beamerboxesrounded}\vskip\smallskipamount}

  \newenvironment<>{wblock}[1]{%
    \begin{actionenv}#2%
      \setbeamertemplate{block begin}[myrounded]%
      \def\insertblocktitle{#1}%
      \par%
      \usebeamertemplate{block begin}}
    {\par%
      \usebeamertemplate{block end}%
    \end{actionenv}}

  \newenvironment<>{walertblock}[1]{%
    \begin{actionenv}#2%
      \setbeamertemplate{block alerted begin}[myrounded]%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%\usebeamerfont{block}%
        \setbeamercolor{local structure}{parent=alerted text}}%
      \usebeamertemplate{block alerted begin}}
    {\par%
      \usebeamertemplate{block alerted end}%
    \end{actionenv}}

  \newenvironment<>{wexampleblock}[1]{%
    \begin{actionenv}#2%
      \setbeamertemplate{block example begin}[myrounded]%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%\usebeamerfont{block}%
        \setbeamercolor{local structure}{parent=example text}}%
      \usebeamertemplate{block example begin}}
    {\par%
      \usebeamertemplate{block example end}%
    \end{actionenv}}
\makeatother

\begin{document}

\begin{frame}
\begin{wblock}{An example block}
\begin{itemize}
\item First.
\item Second.
\end{itemize}
\end{wblock}
\begin{walertblock}{An example alerted block}
\begin{itemize}
\item First.
\item Second.
\end{itemize}
\end{walertblock}
\begin{wexampleblock}{An example example block}
\begin{itemize}
\item First.
\item Second.
\end{itemize}
\end{wexampleblock}
\end{frame}

\begin{frame}
\begin{columns}
\column{0.5\textwidth}
\begin{block}{An example block}
\begin{itemize}
\item First.
\item Second.
\end{itemize}
\end{block}
\begin{alertblock}{An example alerted block}
\begin{itemize}
\item First.
\item Second.
\end{itemize}
\end{alertblock}
\column{0.5\textwidth}
\begin{exampleblock}{An example example block}
\begin{itemize}
\item First.
\item Second.
\end{itemize}
\end{exampleblock}
\end{columns}
\end{frame}

\end{document}

我将其用作0.95\paperwidth块的新宽度,但您可以通过设置长度来获得所需的值\myblockwd

在此处输入图片描述

相关内容