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. As described here, \itemize starts on a new line, so the correct way of achieving this is a verical shift of -\baselineskip. However, this doesn't work, if the baselinestretch is modified, e.g. by \linespread{1.15}:

\documentclass{beamer}
\usepackage{tikz}
\linespread{1.15}

\newcommand{\tikzmark}[2]{
\tikz[baseline=(#1.base), remember picture]{
\node(#1)[inner sep=0pt]{#2};
}
}   

\begin{document}
    \begin{frame}[t]{Title}
        \begin{tabular}[t]{p{0.1\linewidth}p{0.8\linewidth}}
            \tikzmark{left}{left text b} & \vspace*{-1\baselineskip}
            \begin{itemize}
                \item \tikzmark{right}{b number 1} \\ (with possibly two lines) 
                \item number 2 
            \end{itemize}
        \end{tabular}
            \tikz[overlay, remember picture]{
            \draw[red, line width=0.05pt](left.south west)--(right.south east|-left.south west);
            \draw[blue](right.south east)--(right.south east|-left.south east);
            }
    \end{frame}
\end{document}

enter image description here

Ktree
  • 688

2 Answers2

1

In general, it's a good idea not to modify low-level TeX directives such as \linespread and \baselineskip directly. Instead, consider loading the setspace package and issuing the instruction \setstretch{1.15}.

Turning to the immediate issue at hand, since 1/1.15=0.8696 or roughly 0.87, you may want to use \vspace*{-0.87\baselineskip} instead of \vspace*{-1\baselineskip} to align the first lines in the first and second columns of the tabular environment.

Mico
  • 506,678
  • This is very interesting, the \setstretch{1.15} behaves like a \linespread{1.15} placed in the preamble, no matter where it is placed. But would the usage of \linespread inside the document not be the better solution? In this case I don't have to recalculate the distance if I change the \linespread.. – Ktree Dec 21 '15 at 07:36
  • @Ktree - An answer to your question -- whether using \linespread{1.15} is "better" than using the machinery of the setspace package -- depends importantly on what else may be in your document. As I said, I think it's prudent not to manipulate some of TeX's low-level macros directly. – Mico Dec 21 '15 at 08:51
0

I found a very easy solution to this while trying to reproduce the problem on a different machine: Somehow the problem is caused when the baselinestretch is modified in the preamble. Using

\AtBeginDocument{\linespread{1.15}}

instead of

\linespread{1.15}

to only change it inside the document solves the problem. Of course it would still be interesting to know why. Should the baselinestretch generally not be changed in the preamble?

Ktree
  • 688