我制作了一些幻灯片,用于在 Beamer 寻找室友/住房;然而,仔细检查后,我发现两个完全相同的块具有不同的间距 - 其中一个具有较大的标题栏,而另一个没有,这使得它们略微不均匀。 这两个块都是用完全相同的模板制作的,并使用两列宽度均匀分割0.5\textwidth
。 以下是代码:
\documentclass{beamer}
% Variableblock styling + bullet point styling:
\newenvironment{variableblock}[3]{%
\setbeamercolor{block body}{#2}
\setbeamercolor{block title}{#3}
\setbeamercolor{itemize item}{fg=black}
\begin{block}{#1}}{\end{block}}
\setbeamertemplate{itemize/enumerate body begin}{\scriptsize}
% Slide:
\begin{document}
\begin{frame}
\frametitle{Roommate Preferences}
\framesubtitle{What I'm looking for \& Dealbreakers}
I actually don't really want a roommate, but I would be down to have 1-2 housemates to share an apartment.
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{variableblock}{What I'm Looking For}{bg=green!10,fg=black}{bg=green!40,fg=black}
\begin{itemize}
\item Friendly/agreeable person.
\item Has some sense of organization and hygiene.
\item Mindful of my circumstances (e.g. don't bring too many people over when I have exams/are sleeping/having an anxiety attack).
\item Be able to talk things out in a civil manner.
\item Someone who I can probably hang out with/study with/talk to.
\item $\uparrow$ Preferably share similar academic interests/major.
\end{itemize}
\end{variableblock}
\end{column}
\begin{column}{0.5\textwidth}
\begin{variableblock}{Deal Breakers}{bg=red!10,fg=black}{bg=red!40,fg=black}
\begin{itemize}
\item Drugs/Alcohol/Excessive Partying.
\item Political/Religious views. I've already got my yeehaw neighbor for that.
\item Lack of hygiene/cleanliness in shared spaces. No, I will not be vacuuming the entire room and taking out all the trash for another year.
\item Toxicity/Negativity/Being Inconsiderate/Disregarding Privacy/Boundaries.
\item Being loud/excessive amount of visitors/relationships \& PDA.
\end{itemize}
\end{variableblock}
\end{column}
\end{columns}
\end{frame}
\end{document}
这将创建以下输出:
如您所见,绿色块在块文本下有一些额外的间距,而红色块没有,尽管它们来自同一个模板,并且除了项目符号内容外,代码也基本相同。如果有人知道为什么间距变得奇怪和/或对这个问题有任何补救措施,请告诉我。谢谢!
答案1
您columns
可以使用tcbraster
(来自tcolorbox
)来自动调整框的高度。结果非常相似。下图中的不同宽度是由于columns
环境添加了额外的宽度,而解决方案未使用该宽度tcolorbox
。
\documentclass{beamer}
\usepackage[most]{tcolorbox}
% Variableblock styling + bullet point styling:
\newenvironment{variableblock}[3]{%
\setbeamercolor{block body}{#2}
\setbeamercolor{block title}{#3}
\setbeamercolor{itemize item}{fg=black}
\begin{block}{#1}}{\end{block}}
\setbeamertemplate{itemize/enumerate body begin}{\scriptsize}
% Slide:
\begin{document}
\begin{frame}
\frametitle{Roommate Preferences}
\framesubtitle{What I'm looking for \& Dealbreakers}
I actually don't really want a roommate, but I would be down to have 1-2 housemates to share an apartment.
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{variableblock}{What I'm Looking For}{bg=green!10,fg=black}{bg=green!40,fg=black}
\begin{itemize}
\item Friendly/agreeable person.
\item Has some sense of organization and hygiene.
\item Mindful of my circumstances (e.g. don't bring too many people over when I have exams/are sleeping/having an anxiety attack).
\item Be able to talk things out in a civil manner.
\item Someone who I can probably hang out with/study with/talk to.
\item $\uparrow$ Preferably share similar academic interests/major.
\end{itemize}
\end{variableblock}
\end{column}
\begin{column}{0.5\textwidth}
\begin{variableblock}{Deal Breakers}{bg=red!10,fg=black}{bg=red!40,fg=black}
\begin{itemize}
\item Drugs/Alcohol/Excessive Partying.
\item Political/Religious views. I've already got my yeehaw neighbor for that.
\item Lack of hygiene/cleanliness in shared spaces. No, I will not be vacuuming the entire room and taking out all the trash for another year.
\item Toxicity/Negativity/Being Inconsiderate/Disregarding Privacy/Boundaries.
\item Being loud/excessive amount of visitors/relationships \& PDA.
\end{itemize}
\end{variableblock}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Roommate Preferences}
\framesubtitle{What I'm looking for \& Dealbreakers}
I actually don't really want a roommate, but I would be down to have 1-2 housemates to share an apartment.
\begin{tcbitemize}[raster columns=2, raster equal height=rows, sharp corners, coltitle=black, boxrule=0pt, left=0pt, right=0pt]
\tcbitem[title=What I'm Looking For, colbacktitle=green!40, colback=green!10]
\begin{itemize}
\item Friendly/agreeable person.
\item Has some sense of organization and hygiene.
\item Mindful of my circumstances (e.g. don't bring too many people over when I have exams/are sleeping/having an anxiety attack).
\item Be able to talk things out in a civil manner.
\item Someone who I can probably hang out with/study with/talk to.
\item $\uparrow$ Preferably share similar academic interests/major.
\end{itemize}
\tcbitem[title=Deal Breakers, colbacktitle=red!40, colback=red!10]
\begin{itemize}
\item Drugs/Alcohol/Excessive Partying.
\item Political/Religious views. I've already got my yeehaw neighbor for that.
\item Lack of hygiene/cleanliness in shared spaces. No, I will not be vacuuming the entire room and taking out all the trash for another year.
\item Toxicity/Negativity/Being Inconsiderate/Disregarding Privacy/Boundaries.
\item Being loud/excessive amount of visitors/relationships \& PDA.
\end{itemize}
\end{tcbitemize}
\end{frame}
\end{document}
答案2
\documentclass{beamer}
\newenvironment{variableblock}[3]{%
\setbeamercolor{block body}{#2}
\setbeamercolor{block title}{#3}
\setbeamercolor{itemize item}{fg=black}
\begin{block}{#1}}{\end{block}}
\setbeamertemplate{itemize/enumerate body begin}{\scriptsize}
\begin{document}
% Slide:
\begin{frame}
\frametitle{Roommate Preferences}
\framesubtitle{What I'm looking for \& Dealbreakers}
I actually don't really want a roommate, but I would be down to have 1-2 housemates to share an apartment.
\begin{minipage}[t]{0.48\textwidth}
\begin{variableblock}{What I'm Looking For}{bg=green!10,fg=black}{bg=green!40,fg=black}
\begin{itemize}
\item Friendly/agreeable person.
\item Has some sense of organization and hygiene.
\item Mindful of my circumstances (e.g. don't bring too many people over when I have exams/are sleeping/having an anxiety attack).
\item Be able to talk things out in a civil manner.
\item Someone who I can probably hang out with/study with/talk to.
\item $\uparrow$ Preferably share similar academic interests/major.
\vspace{0.15cm}
\end{itemize}
\end{variableblock}
\end{minipage}
\hfill
\begin{minipage}[t]{0.48\textwidth}
\begin{variableblock}{Deal Breakers}{bg=red!10,fg=black}{bg=red!40,fg=black}
\begin{itemize}
\item Drugs/Alcohol/Excessive Partying.
\item Political/Religious views. I've already got my yeehaw neighbor for that.
\item Lack of hygiene/cleanliness in shared spaces. No, I will not be vacuuming the entire room and taking out all the trash for another year.
\item Toxicity/Negativity/Being Inconsiderate/Disregarding Privacy/Boundaries.
\item Being loud/excessive amount of visitors/relationships \& PDA.
\end{itemize}
\end{variableblock}
\end{minipage}
\end{frame}
\end{document}