如何让阴影环境更加紧密?

如何让阴影环境更加紧密?

我使用的是阴影环境而不是块;但是,阴影环境太松散了。我可以尝试手动将其收紧,但随后发生了奇怪的事情;有人知道如何优雅地做到这一点吗? 在此处输入图片描述

\documentclass{beamer}

\usepackage{multicol}
\usepackage{framed, color}
\definecolor{shadecolor}{RGB}{228,230,231}
%Zitate und todos
\usepackage{url}
\usepackage{todonotes}

% Reelle, Natürliche, Ganze, Rationale Zahlen
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand{\N}{\ensuremath{\mathbb{N}}}
\newcommand{\Z}{\ensuremath{\mathbb{Z}}}
\newcommand{\Q}{\ensuremath{\mathbb{Q}}}

% Fraktur für Strukturen
\newcommand{\A}{\ensuremath{\mathfrak A}}
\newcommand{\B}{\ensuremath{\mathfrak B}}
\newcommand{\C}{\ensuremath{\mathfrak C}}
\newcommand{\D}{\ensuremath{\mathfrak D}}
\newcommand{\I}{\ensuremath{\mathfrak I}}

% Makros für logische Operatoren
\newcommand{\xor}{\ensuremath{\oplus}} %exklusives oder
\newcommand{\impl}{\ensuremath{\rightarrow}} %logische Implikation
\newcommand{\Impl}{\ensuremath{\Rightarrow}}

% Meistens ist \varphi schöner als \phi, genauso bei \theta
\renewcommand{\phi}{\varphi}
\renewcommand{\theta}{\vartheta}
\renewcommand{\epsilon}{\varepsilon}
\newcommand{\w}{\omega}
%\newcommand{\a}{\alpha}
%\newcommand{\b}{\beta}
%\newcommand{\c}{\gamma}
%\newcommand{\d}{\delta}

%sonstige Makros
\renewcommand{\*}{\cdot}
%\usepackage{enumitem,cleveref} incompatible with beamer
%\usepackage{enumitem} incompatible with beamer

\usetheme[progressbar=frametitle]{metropolis} %wie weit man ist
\setbeamertemplate{frame numbering}[fraction]
\useoutertheme{metropolis}
\useinnertheme{metropolis}
\usecolortheme{spruce}
\setbeamercolor{background canvas}{bg=white}

\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{microtype}
\usepackage{stmaryrd}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{lmodern}

\definecolor{mygreen}{rgb}{.125,.5,.25}
\usecolortheme[named=mygreen]{structure}


\begin{document}
    \metroset{block=fill}
    \begin{frame}[t]{}
        \begin{block}{}
            $\mathcal{A} = (Q,\Sigma, \delta, q_0, F) $
        \end{block}
        \begin{shaded*}{
        \vspace{-0.4cm}
        $\mathcal{A} = (Q,\Sigma, \delta, q_0, F) $} 
        \vspace{-0.4cm}
        \end{shaded*}
    \end{frame}
\end{document}

答案1

序言中的设置\FrameSep你能接受吗?

\documentclass{beamer}
\usepackage{framed}
\setlength\FrameSep{1ex} % <---

\definecolor{shadecolor}{RGB}{228,230,231}
\definecolor{mygreen}{rgb}{.125,.5,.25}

\usetheme[progressbar=frametitle]{metropolis} %wie weit man ist
\setbeamertemplate{frame numbering}[fraction]
\useoutertheme{metropolis}
\useinnertheme{metropolis}
\usecolortheme{spruce}
\setbeamercolor{background canvas}{bg=white}
\usecolortheme[named=mygreen]{structure}


\begin{document}
    \metroset{block=fill}
\begin{frame}[t]{}
    \begin{block}{}
        $\mathcal{A} = (Q,\Sigma, \delta, q_0, F) $
    \end{block}
    \begin{shaded*}
    {
    $\mathcal{A} = (Q,\Sigma, \delta, q_0, F) $
    }
    \end{shaded*}
\end{frame}
\end{document}

如您所见,我将您的文档示例转换为 MWE/最小工作示例)。

在此处输入图片描述

答案2

使用 tcolorbox 内部主题 v0.5 或更新版本,您可以继续使用 beamer 块环境并关闭空标题区域:

\documentclass{beamer}

\usepackage{todonotes}
\usetheme[progressbar=frametitle]{moloch}% modern fork of the metropolis theme
\usecolortheme{spruce}

\setbeamercolor{block title}{%
  use=normal text,
  fg=normal text.fg,
  bg=normal text.bg!80!fg
}
\setbeamercolor{block body}{
  use={block title, normal text},
  bg=block title.bg!50!normal text.bg
}

\setbeamercolor{background canvas}{bg=white}
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{stmaryrd}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\definecolor{mygreen}{rgb}{.125,.5,.25}
\usecolortheme[named=mygreen]{structure}

\useinnertheme[showtitle=false]{tcolorbox}

\begin{document}
    \begin{frame}[t]{}
        \begin{block}{}
            $\mathcal{A} = (Q,\Sigma, \delta, q_0, F) $
        \end{block}
    \end{frame}
\end{document}

在此处输入图片描述

相关内容