下图中,有一个使用mdframed
包定义的自定义框架。很明显,枚举超出了框架的范围。
当使用普通类排版类似内容时,标签会进入mdframed
环境内部。
除了标签定制之外,我希望获得相同的输出,但标签缩进与以“what”开头的上方文本对齐。
平均能量损失
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{rose}
\useoutertheme[]{split}
\useinnertheme{inmargin}
% BEGIN_FOLD
\setbeamersize{text margin left=2mm, text margin right=2mm}
\newlength{\sidebarWidth}
\setlength{\sidebarWidth}{0.1\paperwidth}
\setbeamersize{sidebar width left=\sidebarWidth, sidebar width right=0cm}
% END_FOLD
\usefonttheme{structurebold}
% ==========================================================================
% BEGIN_FOLD
% ========== Package editing packages ==========
\usepackage{etoolbox}
% BEGIN_FOLD
\AtBeginEnvironment{enumerate}{\centering}
\BeforeBeginEnvironment{multicols}{\centering}
% END_FOLD
\usepackage{xpatch}
% ========== Figures and tables locations packages ==========
\usepackage{adjustbox}
% ========== Page, margins and paragraph layout packages packages ==========
\usepackage{ragged2e}
% ========== Graphics packages ==========
\usepackage{graphicx}
% ========== Font encoding packages ==========
\usepackage[T1]{fontenc}
\usepackage{fontspec}
% ========== Equations and math packages ==========
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\usepackage{mathtools}
% ========== Framing packages ==========
\usepackage{mdframed}
% BEGIN_FOLD
% ===== Begin skipbelow patch =====
\makeatletter
\xpatchcmd{\endmdframed}
{\aftergroup\endmdf@trivlist\color@endgroup}
{\endmdf@trivlist\color@endgroup\@doendpe}
{}{}
\makeatother
% ===== End skipbelow patch =====
% ===== Frames templates =====
\newcommand{\frameMultipleChoiceQuiz}{Example Frame}
\global \mdfdefinestyle{\frameMultipleChoiceQuiz}{
% Line
linecolor=DodgerBlue1, linewidth=0.5mm,
topline=false, bottomline=false, rightline=false,
skipabove=0.2\baselineskip, skipbelow=0.1\baselineskip,
innertopmargin=0.5\baselineskip, innerbottommargin=0.5\baselineskip, innerleftmargin=2mm, innerrightmargin=0.01\textwidth,
%
% Frame
frametitlerule=false, frametitlerulewidth=0.2mm
frametitlefont=\normalsize\bfseries, frametitlealignment=\justifying,
frametitleaboveskip=1.76mm, frametitlebelowskip=0mm,
nobreak=false, needspace=3\baselineskip
}
% END_FOLD
\usepackage{multicol}
% END_FOLD
\begin{document}
\begin{frame}{Showing Contents Gradually}
\begin{columns}
\column[c]{0.4\textwidth}
\begin{mdframed}[style=\frameMultipleChoiceQuiz]
What is $\sqrt{x^{2}}$?
\begin{enumerate}
\item $X$
\item $-X$
\item $\left| X \right|$ \onslide<2->{\textbf{correct answer}}
\item Undefined
\end{enumerate}
\end{mdframed}
\column[c]{0.5\textwidth}
\onslide<3>{
\includegraphics[width=\textwidth]{example-image-a}
}
\onslide<3>{Comment on the image}
\end{columns}
\end{frame}
\end{document}
答案1
主题的想法inmargin
是将枚举项等元素放在侧边栏,因此主题会修改\leftmargini
等。这可以部分撤消,如下面的代码所示。
其他几点:
如果你的 beamer 版本比较新,你不需要
\usepackage{etoolbox}
,beamer 现在已经加载了这个你不需要
\usepackage{graphicx}
使用 beamer与 beamer 一起使用
multicol
没有什么意义,beamer 有自己的列机制
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{rose}
\useoutertheme{split}
\useinnertheme{inmargin}
\setlength\leftmargini{5ex}
\setlength\leftmarginii{7.5ex}
\setlength\leftmarginiii{7.5ex}
% BEGIN_FOLD
\setbeamersize{text margin left=2mm, text margin right=2mm}
\newlength{\sidebarWidth}
\setlength{\sidebarWidth}{0.1\paperwidth}
\setbeamersize{sidebar width left=\sidebarWidth, sidebar width right=0cm}
% END_FOLD
\usefonttheme{structurebold}
% ==========================================================================
% BEGIN_FOLD
% ========== Package editing packages ==========
%\usepackage{etoolbox}
% BEGIN_FOLD
\AtBeginEnvironment{enumerate}{\centering}
% \BeforeBeginEnvironment{multicols}{\centering}
% END_FOLD
\usepackage{xpatch}
% ========== Figures and tables locations packages ==========
\usepackage{adjustbox}
% ========== Page, margins and paragraph layout packages packages ==========
\usepackage{ragged2e}
% ========== Graphics packages ==========
%\usepackage{graphicx}
% ========== Font encoding packages ==========
\usepackage[T1]{fontenc}
\usepackage{fontspec}
% ========== Equations and math packages ==========
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\usepackage{mathtools}
% ========== Framing packages ==========
\usepackage{mdframed}
% BEGIN_FOLD
% ===== Begin skipbelow patch =====
\makeatletter
\xpatchcmd{\endmdframed}
{\aftergroup\endmdf@trivlist\color@endgroup}
{\endmdf@trivlist\color@endgroup\@doendpe}
{}{}
\makeatother
% ===== End skipbelow patch =====
% ===== Frames templates =====
\newcommand{\frameMultipleChoiceQuiz}{Example Frame}
\global \mdfdefinestyle{\frameMultipleChoiceQuiz}{
% Line
linecolor=DodgerBlue1, linewidth=0.5mm,
topline=false, bottomline=false, rightline=false,
skipabove=0.2\baselineskip, skipbelow=0.1\baselineskip,
innertopmargin=0.5\baselineskip, innerbottommargin=0.5\baselineskip, innerleftmargin=2mm, innerrightmargin=0.01\textwidth,
%
% Frame
frametitlerule=false, frametitlerulewidth=0.2mm
frametitlefont=\normalsize\bfseries, frametitlealignment=\justifying,
frametitleaboveskip=1.76mm, frametitlebelowskip=0mm,
nobreak=false, needspace=3\baselineskip
}
% END_FOLD
%\usepackage{multicol}
% END_FOLD
\begin{document}
\begin{frame}{Showing Contents Gradually}
\begin{columns}
\column[c]{0.4\textwidth}
\begin{mdframed}[style=\frameMultipleChoiceQuiz]
What is $\sqrt{x^{2}}$?
\begin{enumerate}
\item $X$
\item $-X$
\item $\left| X \right|$ \onslide<2->{\textbf{correct answer}}
\item Undefined
\end{enumerate}
\end{mdframed}
\column[c]{0.5\textwidth}
\onslide<3>{
\includegraphics[width=\textwidth]{example-image-a}
}
\onslide<3>{Comment on the image}
\end{columns}
\end{frame}
\end{document}