1

In a beamer presentation (no setspace, no enumitem) I want to use an itemize environment inside the column of a tabular. I want the first \item to be displayed on the same baseline, as the first lines of the other columns. This question was originally asked here, but as there occured different problems, I split the question. In this question I already figured out how it works with modified linespread. However, I can't manage to appropriately align the first \item, if the tabular itself is placed inside an itemize environment. Which would be the correct shift distance here? Note that the needed distance seems to change slightly when the level of nesting increases!

\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}

nested tabulars and itemizes

1

The 1pt is the interlineskip and with \rlap the parbox has no real width

\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}

enter image description here

3
  • where is the tikz code in your answer? If you look close, you will see that the lines are actually not perfectly aligned :( Moreover, if the 1pt is the interlineskip, shouldn't \nointerlineskip do the trick then? Doesn't work for me..
    – Ktree
    Dec 21 '15 at 8:50
  • then tikz stuff was deleted. It is not important for the answer. "Doesn't work for me" is not a useful description ...
    – user2478
    Dec 21 '15 at 9:10
  • by "Doesn't work for me" I mean that using \nointerlineskip has no effect, if I try it. This makes me think the 1pt actually doesn't come frome interlineskip. But anyway, it seems that 1pt is just "something that is very close to the desired distance, but not the actual distance", as the lines are not perfectly aligned in your answer. Still I find the solution with \parbox instead of tabular interesting, I just think the problem still isn't really solved...
    – Ktree
    Dec 21 '15 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.