1

I am trying to include nodes as items, so that the text is aligned as it was a normal item, but I could still include arrows and boxes as in the MWE below:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{positioning,calc,decorations.pathreplacing}

\begin{document}

\begin{frame}
\begin{minipage}{.5\textwidth}
    \includegraphics[width=\linewidth]{example-image}
    \vspace{0.5cm}
    \includegraphics[width=\linewidth]{example-image}
\end{minipage}\hfill
\begin{minipage}{.475\textwidth}
    \begin{itemize}
        \item Mutated self proteins in tumor cells can be potential antigens presented by HLA-A
        \item
    \begin{tikzpicture}
    \node[align=left] (A) at (0,0) {Study immune system and cancer cells interactions};
    \node[below=1cm of A, anchor=center, fill=yellow] (B) {Immunotherapies};
    \draw[->, >=latex, blue!40!white, line width=5pt] (A) -- (B);
    \end{tikzpicture}
    \end{itemize}
\end{minipage}\hfill
\end{frame}

\end{document}

Which produces the following (text not aligned to the item symbol and to the text above, as if it was a normal item; overbox warning): this

2

The main problem is that your tikzpicture is too wide for the remaining space on the line, so it gets moved a line down. To fix this you need to specify a text width in the node (or clip the picture, but that would not be helpful). Just doing that will leave you some alignment problems:

  1. you need to specify that thet anchor for the node is the base of the first line of text, and then use that as the vertical alignment point for the whole picture, by specifying baseline

  2. then you will notice that your text is indented by amount that comes from the inner sep of the node, so you need to put that to 0.

Sample output

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{positioning,calc,decorations.pathreplacing}

\begin{document}

\begin{frame}

\begin{minipage}{.5\textwidth}
    \includegraphics[width=\linewidth]{example-image}
    \vspace{0.5cm}
    \includegraphics[width=\linewidth]{example-image}
\end{minipage}\hfill
\begin{minipage}{.475\textwidth}
    \begin{itemize}
    \item Mutated self proteins in tumor cells can be potential
      antigens presented by HLA-A
        \item%
    \begin{tikzpicture}[baseline=0]
      \node[align=left,inner sep=0pt,text width=0.9\linewidth,anchor=base]
      (A) at (0,0) {Study immune system and cancer cells interactions};
      \node[below=1.5cm of A, anchor=center, fill=yellow] (B) {Immunotherapies};
      \draw[->, >=latex, blue!40!white, line width=5pt] (A) -- (B);
    \end{tikzpicture}
  \end{itemize}
\end{minipage}\hfill

\end{frame}

\end{document}

By the way, I presume you are aware of the columns construction in beamer, instead of having to use minipages.

  • Thanks! for some reason I got used to minipages and never actually use columns... is the use of columns recommended over minipages? what are the advantages? Is it worth switching? Thanks again! – DaniCee Feb 6 '15 at 10:08
  • If you are happy with minipages that is fine. One thing one risks is unexpected line breaks between two minipages. Using columns the individual column environments are guaranteed to be next to each other. – Andrew Swann Feb 6 '15 at 12:12

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.