Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have this tikz diagram in a separate document. I use the standalone package to include it into my presentation. However, I experience several problems:

  • Setting the included picture size
  • Scaling the picture so that it matches the visible frame area exactly
  • Placing the picture in an arbitrary position within the file

For concreteness here is my main document

\documentclass{beamer}
\usepackage{standalone}
\usepackage{tikz}

\usecolortheme{wolverine}
\setbeamertemplate{headline}{inflines theme}
\setbeamertemplate{footline}{infolines theme}

\setbeamertemplate{headline}{%
 \hbox{%
   \begin{beamercolorbox}[wd=.25\paperwidth]{section in head/foot}%
   \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=.75\paperwidth]{section in head/foot}%
   \end{beamercolorbox}%
 }%
}%

\defbeamertemplate*{footline}{infolines theme}{\relax
  \leavevmode%
  \hbox{\relax
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
  \end{beamercolorbox}}%
  \vskip0pt%
}

\begin{document}
  \begin{frame}\frametitle{Frame Title}
       \include{mindmap}
   \end{frame}
\end{document}

While the included tikzpicture, residing in a file named mindmap.tex, is

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{mindmap,shadows}
\begin{tikzpicture}[mindmap]
  \begin{scope}
 [
 every node/.style={concept,circular drop shadow,execute at begin node=\hskip0pt},
 text=white,
 root concept/.append style={
   concept color=black, fill=black, line width=1ex, text=white, font=\large\scshape
 },
 grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=51.5,font=\itshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\bf\scriptsize}
]
  \node at (0,100) [fill=white, line width=1ex, text=black,font=\large\scshape] {Introduction to Programming Languages} [clockwise from=0] 
     child [concept color=gray] { node {Administration} [clockwise from=75]
        child {node {Office Hours} }
        child {node {Course Material} }
        child {node {Exams} }
        child {node {Assignments} }
     }  
     child [concept color=purple, sibling angle=33] { node {Hello, World!} } 
     child [concept color=green!50!black, sibling angle=33] { node {Syntactical Elements} 
         [clockwise from=-10]   
     child { node {Identifiers} 
           [clockwise from=0]
           child { node {Autarkic} 
             child { node {Pre-Declared Identifiers} }
           }
           child [sibling angle=60]{ node {Library Based} }
         }
     child { node {Literals} 
           [clockwise from=-60]
           child { node {String Literals} 
              [clockwise from=0]
              child { node{Escaping} } 
           }
         }
     child { node {Keywords} }
     child { node {Comments} }
     child { node {Blocks} }
     } 
     child [concept color=red!30,text=black, sibling angle=46] { node {Specification} [scale=2,clockwise from = -90]
       child {node {Semantics}
       [clockwise from = -45]
     child { node {Recursively Defined Sets} }
     child [sibling angle=60] { node {Language Legalese} }
     child [sibling angle=60] { node {Formal Semantics} }
       } 
       child[sibling angle=90] {node {Syntax} 
       [clockwise from = 210]
    child {node {RegExp}}
    child [sibling angle=45] {node {BNF}}
    child [sibling angle=45] {node {EBNF}}
      }  
    }
    child [concept color=yellow!40, text=black,sibling angle=45] { node {Motivation} }
    child [concept color=teal,sibling angle=53] { node {Paradigms} [clockwise from=45]
    [clockwise from = -150]      
      child { node {Imperative} }
      child [sibling angle=60] { node {Functional} }
      child [sibling angle=60]{ node {Logical} }
      child [sibling angle=60] { node {OO}}
    }
    child [concept color=orange] { node {History} } 
 ;
 \end{scope}%
\end{tikzpicture}%
\end{document}

The output I get is quite annoying:

The presentation with the included tikzpicture

BTW, I read this question, Scaling a tikzpicture for a Beamer slide, and it does not seem to shed light into this issue.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You shouldn't use \usetikzlibrary{mindmap,shadows} outside the preamble. To include the mindmap with a specified width just use

\includestandalone[width=.75\linewidth]{mindmap}

The preamble of the included files can be used if package option subpreambles is set to true.

You might like to replace the \documentclass{article} with \documentclass{standalone}, if you only draw an image.

Please try to create a MWE. There was no real reason for all the formatting in the main document and the big tree

Your code could look like this:

main.tex

\documentclass{beamer}
\usepackage[subpreambles=true]{standalone}
\usepackage{tikz}


\usepackage{lipsum}

\usecolortheme{wolverine}
\setbeamertemplate{headline}{inflines theme}
\setbeamertemplate{footline}{infolines theme}

\setbeamertemplate{headline}{%
 \hbox{%
   \begin{beamercolorbox}[wd=.25\paperwidth]{section in head/foot}%
   \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=.75\paperwidth]{section in head/foot}%
   \end{beamercolorbox}%
 }%
}%

\defbeamertemplate*{footline}{infolines theme}{\relax
  \leavevmode%
  \hbox{\relax
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
  \end{beamercolorbox}}%
  \vskip0pt%
}

\begin{document}
  \begin{frame}\frametitle{Frame Title}
       \centering
       \includestandalone[width=.75\linewidth]{mindmap}

   \end{frame}
\end{document}

mindmap.tex:

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{mindmap,shadows}
\begin{document}
\begin{tikzpicture}[mindmap]
  \begin{scope}
 [
 every node/.style={concept,circular drop shadow,execute at begin node=\hskip0pt},
 text=white,
 root concept/.append style={
   concept color=black, fill=black, line width=1ex, text=white, font=\large\scshape
 },
 grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=51.5,font=\itshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\bf\scriptsize}
]
  \node at (0,100) [fill=white, line width=1ex, text=black,font=\large\scshape] {Introduction to Programming Languages} [clockwise from=0] 
     child [concept color=gray] { node {Administration} [clockwise from=75]
        child {node {Office Hours} }
        child {node {Course Material} }
        child {node {Exams} }
        child {node {Assignments} }
     }  
     child [concept color=purple, sibling angle=33] { node {Hello, World!} } 
     child [concept color=green!50!black, sibling angle=33] { node {Syntactical Elements} 
         [clockwise from=-10]   
     child { node {Identifiers} 
           [clockwise from=0]
           child { node {Autarkic} 
             child { node {Pre-Declared Identifiers} }
           }
           child [sibling angle=60]{ node {Library Based} }
         }
     child { node {Literals} 
           [clockwise from=-60]
           child { node {String Literals} 
              [clockwise from=0]
              child { node{Escaping} } 
           }
         }
     child { node {Keywords} }
     child { node {Comments} }
     child { node {Blocks} }
     } 
     child [concept color=red!30,text=black, sibling angle=46] { node {Specification} [scale=2,clockwise from = -90]
       child {node {Semantics}
       [clockwise from = -45]
     child { node {Recursively Defined Sets} }
     child [sibling angle=60] { node {Language Legalese} }
     child [sibling angle=60] { node {Formal Semantics} }
       } 
       child[sibling angle=90] {node {Syntax} 
       [clockwise from = 210]
    child {node {RegExp}}
    child [sibling angle=45] {node {BNF}}
    child [sibling angle=45] {node {EBNF}}
      }  
    }
    child [concept color=yellow!40, text=black,sibling angle=45] { node {Motivation} }
    child [concept color=teal,sibling angle=53] { node {Paradigms} [clockwise from=45]
    [clockwise from = -150]      
      child { node {Imperative} }
      child [sibling angle=60] { node {Functional} }
      child [sibling angle=60]{ node {Logical} }
      child [sibling angle=60] { node {OO}}
    }
    child [concept color=orange] { node {History} } 
 ;
 \end{scope}%
\end{tikzpicture}%
\end{document}

result

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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