我尝试使用NiceTabular
来创建整齐排列的幻灯片。但是,里面的内容itemize
似乎与标题没有正确对齐。
我的问题如下
- 如何将第一项
itemize
与第一列的标题精确对齐? - 如何删除表格中示例文本和项目之间的空行?
- 我基本上想让
NiceTabular
它的行为类似于tabularx
,但借助 提供的强大功能NiceTabular
(例如能够p
以简洁的方式确定内容与列的水平对齐方式和hvlines
),我很乐意使用NiceTabular
。 是否可以让第二列和第三列自动填充 的剩余部分\textwidth
?
我的MWE
\documentclass[aspectratio=169, xcolor={x11names},t]{beamer}
\useinnertheme{rectangles}
\usecolortheme{seahorse}
\usepackage{calc}
\usepackage[export]{adjustbox}
\usepackage{blindtext}
\usepackage{booktabs}
\usepackage{nicematrix}
\newlength{\widthSideBar}
\setlength{\widthSideBar}{0mm}
\newlength{\widthTextMarginLeft}
\setlength{\widthTextMarginLeft}{10mm}
\newlength{\widthTextMarginRight}
\setlength{\widthTextMarginRight}{5mm}
\setbeamersize{text margin left=\widthTextMarginLeft, text margin right=\widthTextMarginRight}
\setbeamersize{sidebar width left=\widthSideBar, sidebar width right=0cm}
\setbeamertemplate{itemize items}[triangle]
% Adjusting \leftmargini for adjustbox environments
\newlength{\widthItemizeIcon}
\setlength{\widthItemizeIcon}{3.1mm}% good value 3.1mm
\newcommand{\adjustboxItemize}{
\addtolength{\leftmargini}{\widthItemizeIcon}
\addtolength{\leftmargini}{\labelsep}}
\setlength{\leftmargini}{0mm}
\setlength{\parskip}{5mm}
\makeatletter
\newcommand{\itemizecompact}{
\def\@listi{\leftmargin\leftmargini
\setlength{\topsep}{0mm}
\setlength{\itemsep}{0mm}
\setlength{\parsep}{0mm}
}
\let\@listI\@listi
\@listi
}
\makeatother
\newlength{\widthQuad}
\setlength{\widthQuad}{\widthof{\widthof{\quad}}}
\newcommand{\sampletext}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullamnec mi et neque pharetra sollicitudin. Praesent imperdiet mi nec ante.}
\begin{document}
\begin{frame}[plain]
\adjustboxItemize
\itemizecompact
{\noindent\setlength{\tabcolsep}{5.5pt}%
\begin{NiceTabular}{@{}>{\bfseries}p[l]{2.5cm} p[l]{\dimexpr 0.63\linewidth - \tabcolsep - 2.5cm/2 \relax} @{\quad}p[l]{\dimexpr 0.37\linewidth - \tabcolsep - 2.5cm/2 - \widthQuad \relax}}
One-line title & \blindlist{itemize} & \includegraphics[width=\columnwidth, valign=t]{example-image-a}
\\
One-line title & \sampletext \newline \blindlist{itemize} & \includegraphics[width=\columnwidth, valign=t]{example-image-b}
\\
\end{NiceTabular}
}
\end{frame}
\end{document}
答案1
使用 Hendrik Vogt 提供的补丁问题,您得到了预期的输出。
\documentclass[aspectratio=169, xcolor={x11names},t]{beamer}
\makeatletter
\def\beamer@callorigitem{%
\@ifnextchar[
\beamer@@callorigitem
{\beamer@origitem
\if@minipage\else
\kern0pt % don't put the \kern at the top of a \minipage
\fi
\ignorespaces
}%
}
\newcommand*\if@minipage@and@vmode[2]{%
\let\mini@vmode 0%
\if@minipage\ifvmode
\let\mini@vmode 1%
\fi\fi
\if\mini@vmode 1 #1\else #2\fi
}
% Redefine \beamerorig@set@color, \pgfsys@begininvisible and \pgfsys@endinvisible
% such that they don't act at the top of a \minipage;
% instead save the corresponding commands in \set@minipage@color ...
\def\set@minipage@color{}%
\let\save@beamerorig@set@color\beamerorig@set@color
\def\beamerorig@set@color{%
\if@minipage@and@vmode{%
\begingroup
\def\reset@color{\relax}%
\xdef\addto@minipage@color{\save@beamerorig@set@color}%
\endgroup
\expandafter\g@addto@macro\expandafter\set@minipage@color
\expandafter{\addto@minipage@color}%
\aftergroup\reset@color
}{%
\save@beamerorig@set@color
}%
}
\let\save@pgfsys@begininvisible\pgfsys@begininvisible
\let\save@pgfsys@endinvisible\pgfsys@endinvisible
\def\pgfsys@begininvisible{%
\if@minipage@and@vmode
{\g@addto@macro\set@minipage@color{\save@pgfsys@begininvisible}}
{\save@pgfsys@begininvisible}%
}
\def\pgfsys@endinvisible{%
\if@minipage@and@vmode
{\g@addto@macro\set@minipage@color{\save@pgfsys@endinvisible}}
{\save@pgfsys@endinvisible}%
}
% ... and execute them at the beginning of the first paragraph of the minipage
% (where \everypar issues \@minipagefalse).
\let\save@minipagefalse\@minipagefalse
\def\@minipagefalse{%
\set@minipage@color
\gdef\set@minipage@color{}%
\save@minipagefalse
}
\makeatother
\useinnertheme{rectangles}
\usecolortheme{seahorse}
\usepackage{calc}
\usepackage[export]{adjustbox}
\usepackage{blindtext}
\usepackage{booktabs}
\usepackage{nicematrix}
\newlength{\widthSideBar}
\setlength{\widthSideBar}{0mm}
\newlength{\widthTextMarginLeft}
\setlength{\widthTextMarginLeft}{10mm}
\newlength{\widthTextMarginRight}
\setlength{\widthTextMarginRight}{5mm}
\setbeamersize{text margin left=\widthTextMarginLeft, text margin right=\widthTextMarginRight}
\setbeamersize{sidebar width left=\widthSideBar, sidebar width right=0cm}
\setbeamertemplate{itemize items}[triangle]
% Adjusting \leftmargini for adjustbox environments
\newlength{\widthItemizeIcon}
\setlength{\widthItemizeIcon}{3.1mm}% good value 3.1mm
\newcommand{\adjustboxItemize}{
\addtolength{\leftmargini}{\widthItemizeIcon}
\addtolength{\leftmargini}{\labelsep}}
\setlength{\leftmargini}{0mm}
\setlength{\parskip}{5mm}
\makeatletter
\newcommand{\itemizecompact}{
\def\@listi{\leftmargin\leftmargini
\setlength{\topsep}{0mm}
\setlength{\itemsep}{0mm}
\setlength{\parsep}{0mm}
}
\let\@listI\@listi
\@listi
}
\makeatother
\newlength{\widthQuad}
\setlength{\widthQuad}{\widthof{\widthof{\quad}}}
\newcommand{\sampletext}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullamnec mi et neque pharetra sollicitudin. Praesent imperdiet mi nec ante.}
\begin{document}
\begin{frame}[plain]
\adjustboxItemize
\itemizecompact
{\noindent\setlength{\tabcolsep}{5.5pt}%
\begin{NiceTabular}{@{}>{\bfseries}p[l]{2.5cm} p[l]{\dimexpr 0.63\linewidth - \tabcolsep - 2.5cm/2 \relax} @{\quad}p[l]{\dimexpr 0.37\linewidth - \tabcolsep - 2.5cm/2 - \widthQuad \relax}}
One-line title & \blindlist{itemize} & \includegraphics[width=\columnwidth, valign=t]{example-image-a}
\\
One-line title & \sampletext \newline \blindlist{itemize} & \includegraphics[width=\columnwidth, valign=t]{example-image-b}
\\
\end{NiceTabular}
}
\end{frame}
\end{document}