0

Could someone help me debug the code below?

I am struggling to get an animated mind map into a presentation. Thanks to marmot I managed to get the mind map animated, but when I integrate that code into a presentation, I get error messages. All I have managed to understand is it has to do with the arrows (eliminating the \DrawArrowConnection command solves the issue, but I need the arrows).

It is likely to be some beginner's mistake, but I have been playing around for an hour and still don't manage...

Thanks!

Alright, now I am having trouble putting this into a full presentation. For some reason I cannot find I get errors, which have to do with the arrows. Here's the sample code

\documentclass{beamer}
% Setup appearance:

\usetheme{Madrid}
\usefonttheme[onlylarge]{structurebold}
\setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
\setbeamertemplate{navigation symbols}{}


% Standard packages
\usepackage[latin1]{inputenc}
\usepackage[french]{babel}
\usepackage{multirow}
\usepackage{blkarray}
%\usepackage{times}
\usepackage[T1]{fontenc}
%\usepackage{slashbox}

\usepackage{amssymb,amsfonts,amsmath,amsthm}
\usepackage{graphicx}
\usepackage[all]{xy}
\usepackage{smartdiagram}

% Setup TikZ
\usepackage{tikz}
\usetikzlibrary{mindmap,trees,shadows,overlay-beamer-styles}
\usetikzlibrary{shapes.arrows,calc,positioning}%%For arrows
\newcommand{\DrawArrowConnection}[6][]{
\path let \p1=($(#2)-(#3)$),\n1={0.25*veclen(\x1,\y1)} in 
($(#2)!\n1!90:(#3)$) coordinate (#2-A)
($(#2)!\n1!270:(#3)$) coordinate (#2-B)
($(#3)!\n1!90:(#2)$) coordinate (#3-A)
($(#3)!\n1!270:(#2)$) coordinate (#3-B);
\foreach \Y in {A,B}
{
\pgfcoordinate{P-#2-\Y}{\pgfpointshapeborder{#2}{\pgfpointanchor{#3-\Y}{center}}}
\pgfcoordinate{P-#3-\Y}{\pgfpointshapeborder{#3}{\pgfpointanchor{#2-\Y}{center}}}
}
\pgfmathsetmacro{\shiftstarta}{0.4+#6} % modified: added offset calculations
\pgfmathsetmacro{\shiftenda}{0.6+#6}   % 
\pgfmathsetmacro{\shiftstartb}{0.4-#6} %
\pgfmathsetmacro{\shiftendb}{0.6-#6}   % end of offset calculations
% modified below: occurrences of 0.4 and 0.6 replaced by the offset macros
\shade[#1]%*argument allows visible on
let \p1=($(#2)-(#3)$),\n1={atan2(\y1,\x1)-90} in
[top color=#4,bottom color=#5,shading angle=\n1] (P-#2-A) 
 to[bend left=15] ($($(P-#2-A)!\shiftstarta!(P-#3-B)$)!0.25!($(P-#2-B)!\shiftstarta!(P-#3-A)$)$)
-- ($($(P-#2-A)!\shiftstarta!(P-#3-B)$)!3.14pt!270:(P-#3-B)$)
-- ($($(P-#2-A)!\shiftenda!(P-#3-B)$)!0.25!($(P-#2-B)!\shiftstarta!(P-#3-A)$)$) 
to[bend left=15] (P-#3-B) --
 (P-#3-A)  to[bend left=15] 
($($(P-#3-A)!\shiftstartb!(P-#2-B)$)!0.25!($(P-#3-B)!\shiftendb!(P-#2-A)$)$)
-- ($($(P-#3-A)!\shiftendb!(P-#2-B)$)!3.14pt!270:(P-#2-B)$)
-- ($($(P-#3-A)!\shiftendb!(P-#2-B)$)!0.25!($(P-#3-B)!\shiftendb!(P-#2-A)$)$) 
to[bend left=15] (P-#2-B) -- cycle;
}



% Author, Title, etc.

\title[Title]{Title}
\date{}

% The main document
    \AtBeginSection[]
    {
        \begin{frame}<beamer>
            \frametitle{Plan}
            \tableofcontents[currentsection]
        \end{frame}
    }
\begin{document}
% Keys to support piece-wise uncovering of elements in TikZ pictures:
  % \node[visible on=<2->](foo){Foo}
  % \node[visible on=<{2,4}>](bar){Bar}   % put braces around comma expressions
  %
  % Internally works by setting opacity=0 when invisible, which has the 
  % adavantage (compared to \node<2->(foo){Foo} that the node is always there, hence
  % always consumes space plus that coordinate (foo) is always available.
  %
  % The actual command that implements the invisibility can be overriden
  % by altering the style invisible. For instance \tikzsset{invisible/.style={opacity=0.2}}
  % would dim the "invisible" parts. Alternatively, the color might be set to white, if the
  % output driver does not support transparencies (e.g., PS) 
  %
  \tikzset{
    invisible/.style={opacity=0},
    visible on/.style={alt={#1{}{invisible}}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
  }

\begin{frame}
  \titlepage
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Index}
  \tableofcontents
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{First section}
\begin{frame}{First frame}
\begin{itemize}
    \item Item 1
    \item Item 2
    \end{itemize}
\end{frame} 
\begin{frame}
\begin{tikzpicture}
\path[mindmap, concept color=black, text=white,
 level 1 concept/.append style={level distance=27mm, sibling angle=90},
  level 2 concept/.append style={level distance=17mm, sibling angle=90},every node/.append style={scale=0.6}]
node[concept] {A}
[clockwise from=135]
child[visible on=<8->,concept color=blue] {
  node(B)[concept] {B}
  [clockwise from=135, level 2 concept/.append style={sibling angle=50}]
  child[visible on=<9->] {node[concept] {b1}}
  }
child[concept color=green!60!black,visible on=<5->] {
  node(C)[concept] {C}
  [clockwise from=90]
  child[visible on=<6->]{node(c1)[concept] {c1}}
  child[ visible on=<7->]{node(c2)[concept] {c2}}}
child[concept color=red!60!black,visible on=<2->] {
  node[concept] {D}
  [clockwise from=0]
 child[visible on=<3->]{node[concept] {d1}}
  child[visible on=<4->]{node[concept] {d2}}
  }
child[visible on=<10->,concept color=yellow!60!black] {
  node[concept] {E}
  }
  ;
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%
%%%%%%%%%%%%%%           CONNECTIONS
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DrawArrowConnection[visible on=<8->]{B}{C}{green!60!black}{green!60!black}{0}
\end{tikzpicture}
\end{frame}
\end{document}
  • Thanks, @leandriis. Actually, I would have liked to continue the conversation in the other question (the one whose link you edited), but comments would not allow enough characters. Is there a way to do that? – Ana May 4 at 10:40
  • 1
    You're welcome. Asking a follow up question as you did, is perfectly fine. Playing around with your code, I came to the conclusion that the error messages one gets are due to the usage of tikz in combination with the babel package. In that case adding \usetikzlibrary{babel} (as also recommended here: Beamer, Babel and Tikz conflict ) can help. – leandriis May 4 at 10:45
  • o_O Indeed, totally solved. Glad I asked, I would have never found the problem...Thanks again! – Ana May 4 at 11:42
  • Would you agree to close this question as a duplicate to the one I linked in my previous comment? – leandriis May 4 at 12:17

Your Answer

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

Browse other questions tagged or ask your own question.