在 beamer 演示文稿中(否setspace
,否enumitem
),我想在表格的列内使用 itemize 环境。我希望第一行\item
显示在与其他列的第一行相同的基线上。这个问题最初是问的这里,但由于出现了不同的问题,我把问题拆分了。这问题我已经弄清楚了它如何与修改的 一起工作。但是,如果表格本身放在环境中,linespread
我无法设法正确对齐第一个。这里正确的移位距离是多少?请注意,当嵌套级别增加时,所需的距离似乎会略有变化!\item
itemize
\documentclass{beamer}
\usepackage{tikz}
\newcommand{\tikzmark}[2]{
\tikz[baseline=(#1.base), remember picture]{
\node(#1)[inner sep=0pt]{#2};
}
}
\begin{document}
\setlength{\tabcolsep}{0pt}
\begin{frame}{title}
\begin{itemize}%
\item level 1, 1
\item
\begin{tabular}[t]{lp{0.8\linewidth}}
\tikzmark{left}{level 1, 2} & \vspace*{-1\baselineskip}
\begin{itemize}
\item \tikzmark{right}{level 2,1} \\ (with possibly two lines)
\item
\begin{tabular}[t]{lp{0.8\linewidth}}
\tikzmark{left2}{level 2, 2} & \vspace*{-1\baselineskip}
\begin{itemize}
\item \tikzmark{right2}{level 3,1} \\ (with possibly two lines)
\item level 3, 2
\end{itemize}
\end{tabular}
\end{itemize}
\end{tabular}
\end{itemize}
\tikz[overlay, remember picture]{
\draw[red, line width=0.05pt](left.south west)--(right.south east|-left.south west);
}
\tikz[overlay, remember picture]{
\draw[red, line width=0.05pt](left2.south west)--(right2.south east|-left2.south west);
}
\end{frame}
\end{document}
答案1
1pt 是 interlineskip,与\rlap
parbox 一起没有实际宽度
\documentclass{beamer}
\begin{document}
\begin{frame}{title}
\begin{itemize}%
\item level 1, 1
\item level 1, 2
\rlap{\parbox[t]{\linewidth}{\vspace*{\dimexpr-\baselineskip+1pt}
\begin{itemize}
\item level 2, 1 \newline (with possibly two lines)
\item level 2, 2
\rlap{\parbox[t]{\linewidth}{\vspace*{\dimexpr-\baselineskip+1pt}
\begin{itemize}
\item level 3, 1 \newline (with possibly two lines)
\item level 3, 2
\end{itemize}}}% inner parbox
\end{itemize}}}% outer parbox
\end{itemize}
\end{frame}
\end{document}