重新定義投影機的區塊

重新定義投影機的區塊

我正在嘗試重新定義投影機的塊以獲得類似這樣的東西(上塊): 在此輸入影像描述

我找到了 3 個網站(帶有程式碼和圖片)可能會有所幫助,但我無法獨自實現這個目標。

這是網站:

謝謝你的幫忙。

答案1

這是一個tcolorbox基於的實作。

\documentclass{beamer}

\usepackage{tikz,tcolorbox}
\usetikzlibrary{shapes,calc}
\tcbuselibrary{skins}
\definecolor{myblue}{rgb}{0.15,0.15,0.53}

\makeatletter

\newtcbox{\titlebox}{
    enhanced,
    overlay={
        \draw[myblue,fill=myblue](frame.south east)--+(0,.2)to[bend right]+(.2,-0)--cycle;},
        colback=myblue,
        top=-1pt,bottom=-2pt,left=2pt,right=2pt,
        boxrule=1pt,
        colframe=myblue,
        sharp corners=south,
        colupper=white,
        fontupper=\bfseries
}

\newtcolorbox{myblock}[1][]{
    enhanced,
    left=2pt,
    right=2pt,
    colframe=myblue,
    boxrule=1pt,
    colback=blue!10,
    overlay={
        \def\myblock@tempa{#1}
        \ifx\myblock@tempa\@empty
        \else
        \draw[myblue,fill=myblue]($(frame.north west)+(.2pt,-.2pt)$)--+(.1,0)to[bend right]+(-0,-.1)--cycle;
        \node [
            anchor=south west,
            inner sep=0pt,
            outer sep=0pt
        ]at(frame.north west){\titlebox{#1}};
    \fi
    },
}
\makeatother
\begin{document}
\begin{frame}
   \begin{myblock}[Corollary]
      \textit{If $_{\chi PP}(M)=2$ a haplotype matrix M we can find an optimal pp-partition in polynomial time}
   \end{myblock}

   \begin{myblock}
      this block has no title
   \end{myblock}
\end{frame}

\end{document}

在此輸入影像描述

花哨的東西(圓角等)是用 TikZ 完成的,如果盒子沒有標題,則有條件地排除。

答案2

您可以使用 tcolorbox 內部主題作為起點,並從那裡開始自訂:

\documentclass{beamer} 


\usecolortheme{orchid}
\useinnertheme[rounded]{tcolorbox}

\makeatletter
\tcbsetforeverylayer{
    boxrule=1pt,
    borderline={1.5pt}{0pt}{beamer@tcb@titlebg},
    sharp corners=northwest,
    attach boxed title to top left={},
    boxed title style={
      bottom=-1mm,
      top=0mm,
      sharp corners=south,
      rounded corners=northwest,
      arc=1.3mm,
      overlay={
        \fill[beamer@tcb@titlebg] (frame.south east) -- ++(0,3mm) arc [start angle=180, end angle=270, radius=3mm] -- cycle; 
        \fill[beamer@tcb@titlebg] (frame.south west) -- ++(1.8mm,-0.5mm) arc [start angle=90, end angle=180, radius=1.3mm] -- cycle; 
      }   
    }, 
}
\makeatother

\begin{document}

\begin{frame}

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

\begin{Corollary}[test]
content...
\end{Corollary}

\begin{exampleblock}{title}
content...
\begin{alertblock}{title}
content...
\end{alertblock}
\end{exampleblock}
\end{frame}

\end{document}

在此輸入影像描述

相關內容