Control Tikz arrowhead size globally (in Beamer, if that matters)

beamertikz-arrows

How do you globally set the default arrow size that Tikz uses when drawing graphical model diagrams?

Reduced example:

\documentclass[13pt]{beamer}
\usetheme{Singapore}
\usepackage{tikz}
\usetikzlibrary{fit,positioning,shapes,arrows,positioning,matrix,shapes.geometric,bayesnet}
\begin{document}
\begin{frame}{test}
\begin{tikzpicture}[]
    \node[obs,circle] (a) {a};
    \node[obs,circle,right=of a] (b) {b};%
    \node[obs,circle,right=of b] (c) {c};%
    \edge {a} {b}; 
    \edge[style={-latex}] {b} {c};
    \end{tikzpicture}
\end{frame}
\end{document}

enter image description here

  • The code can't be littered with adjustments [style={-latex}] for every edge
  • The adjustment should be a single command in the header that affects the default style for all arrows in all tikzpictures
  • I'd like to adjust the size somewhere between the default -> and the smaller -latex (pictured above).

Related questions

This question is very similar (the same?), but I couldn't pull a solution from the answers. The answers discuss how to override the style for single arrows, not how to scale all the default arrowheads by some fixed, global amount.

This one has an answer that is way too fancy for my needs, and it's hard for me to parse out what the simpler answer is from this larger amount of code.

This question probably contains a hint for the answer, but it's for tikz-cd and sets the size of the "latex" arrow head, which isn't the default in Beamer it seems. Tex/Latex/Tikz/etc syntax is arcane enough that I can't guess what changes to this would let me set the default arrow size globally.

This one changes some other arrow properties, but again—the langauge is such that one cannot guess a simplified command to affect the arrow head size.

This one probably contains the answer, but also contains a lot of extra information that is making it hard for me to parse out a simple solution to this specific issue.

From that question, this answer seems the simplest. I can confirm that adding

\usetikzlibrary{arrows.meta}
\tikzset{>={Latex[scale=1.2]}

Does seem to change the default arrow style to Latex and also configure its size.

Which raises the question: what was the default style in Beamer before applying this? Using -> and <-> by default draw a larger arrow than -latex, so it must be something else (in Beamer at least). What is it, and whats the simplest way to configure it?

Is there a way to scale whatever this default arrowhead is, or to all arrowheads? Such that using e.g. \edge[style={<->}] would automatically lead to an arrowhead of the desired size? It looks like this arrows.meta is a package for very fancy arrows, which I don't especially care about. Is there no way to globally adjust the size of the simpler/older arrows package?

Best Answer

Changing the arrow length: redefine the style latent from bayesnet. (obs is based on latent) Default uses node distance=1.

Or use instead

    \tikzstyle{obs} = [circle,fill=white,draw=black,inner sep=1pt,
    minimum size=20pt, font=\fontsize{10}{10}\selectfont, node distance=0.5,fill=gray!25 ]

To avoid adding the optional parameter[style={-latex}] every time to \edge, you can define a new command.

\newcommand{\edgex}[3][style={-latex}]{% edge with a new style <<<
    % Connect all nodes #2 to all nodes #3.
    \foreach \x in {#2} { %
        \foreach \y in {#3} { %
            \draw[#1] (\x) -- (\y) ;%
        } ;
    } ;
}
    

Putting everything together:

a

\documentclass[13pt]{beamer}
\usetheme{Singapore}
\usepackage{tikz}
\usetikzlibrary{fit,positioning,shapes,positioning,matrix,shapes.geometric,bayesnet}
\usetikzlibrary{arrows.meta}

\newcommand{\edgex}[3][style={-latex}]{% edge with a new style <<<
    % Connect all nodes #2 to all nodes #3.
    \foreach \x in {#2} { %
        \foreach \y in {#3} { %
            \draw[#1] (\x) -- (\y) ;%
        } ;
    } ;
}
    
\begin{document}
\begin{frame}{test}
\begin{tikzpicture}[]
    \node[obs,circle] (a) {a};
    \node[obs,circle,right=of a] (b) {b};%
    \node[obs,circle,right=of b] (c) {c};%
    \edge {a} {b}; 
    \edge[style={-latex}] {b} {c};
\end{tikzpicture}
\bigskip
    
% change distance between nodes
\tikzstyle{obs} = [circle,fill=white,draw=black,inner sep=1pt,minimum size=20pt, font=\fontsize{10}{10}\selectfont, node distance=0.5,fill=gray!25 ]
    
    
\begin{tikzpicture} 
    \node[obs,circle] (a) {a};
    \node[obs,circle,right=of a] (b) {b};%
    \node[obs,circle,right=of b] (c) {c};%
    \edge {a} {b}; 
    \edgex {b} {c};
\end{tikzpicture}
    
\end{frame}
\end{document}
Related Question