绘制包含标题文本的块的框架

绘制包含标题文本的块的框架

使用tcolorbox,在beamerwithbeamerposter包中,我需要创建一个新的boxedblock环境。

\begin{boxedblock}{Motivation & Contributions}
    
\end{boxedblock}

预期结果:

在此处输入图片描述

平均能量损失

\documentclass{beamer}
\usepackage[orientation=portrait,size=a0,scale=1]{beamerposter} 
\usepackage{tcolorbox}
\usepackage{ragged2e} % mandatory for the block definition below

%%%%%%%%%%%%%%%%% Block definition
\setbeamertemplate{block begin} 
{
    \begin{beamercolorbox}[colsep*=0ex,dp=2ex,center]{block title}
        \vskip0pt
        \usebeamerfont{block title}\insertblocktitle
        \vskip-1.25ex
        \begin{beamercolorbox}[colsep=0.025ex]{block separator}\end{beamercolorbox}
    \end{beamercolorbox}
    {\parskip0pt\par}
    \usebeamerfont{block body}
    \vskip-0.5ex
    \begin{beamercolorbox}[colsep*=0ex]{block body}
        \justifying
        \setlength{\parskip}{1ex}
        \vskip-2ex
    }
    \setbeamertemplate{block end}
    {
    \end{beamercolorbox}
    \vskip0pt
    \vspace*{2ex}
}


\begin{document}
    
\begin{frame}[t]
    \begin{block}{title}
        content
    \end{block}
\end{frame}
    
\end{document}

ps:和tcolorbox都是beamerposterMWE 不使用的依赖项,但我确实需要它们。

答案1

\documentclass{beamer}
\usepackage[orientation=portrait,size=a0,scale=1]{beamerposter} 
\usepackage[most]{tcolorbox}
\usepackage{ragged2e} % mandatory for the block definition below

%%%%%%%%%%%%%%%%% Block definition
\setbeamertemplate{block begin} 
{
    \begin{beamercolorbox}[colsep*=0ex,dp=2ex,center]{block title}
        \vskip0pt
        \usebeamerfont{block title}\insertblocktitle
        \vskip-1.25ex
        \begin{beamercolorbox}[colsep=0.025ex]{block separator}\end{beamercolorbox}
    \end{beamercolorbox}
    {\parskip0pt\par}
    \usebeamerfont{block body}
    \vskip-0.5ex
    \begin{beamercolorbox}[colsep*=0ex]{block body}
        \justifying
        \setlength{\parskip}{1ex}
        \vskip-2ex
    }
    \setbeamertemplate{block end}
    {
    \end{beamercolorbox}
    \vskip0pt
    \vspace*{2ex}
}

\newtcolorbox{boxedblock}[1]{
title=#1,
colframe=blue,
colback=white,
enhanced,
attach boxed title to top center={yshift=-\tcboxedtitleheight/2},
boxed title style={size=small,colback=white,colframe=white},
coltitle=blue
}


\begin{document}
    
\begin{frame}[t]

\begin{boxedblock}{Motivation \& Contributions}
some test in here
\end{boxedblock}

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

相关内容