TransWikia.com

TikZ: positioning library with multiplier

TeX - LaTeX Asked on December 16, 2020

I’m using the positioning library in TikZ to places nodes. Is it possible to have some kind of multiplier applied to a placement, for example, something like (above=of C)*2?

Minimum example with an error in node D (where I tried something that didn’t work):

documentclass{standalone}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}begin{tikzpicture}[node distance=1cm,
    entity/.style={
        draw, rectangle,
        minimum size=1cm, text height=1.5ex, text depth=0.25ex
    }
]
    node (C) {};
    node (A) [entity, above left=of C] {A};
    node (B) [entity, above right=of C] {B};
    node (D) [entity, ($(above=of C) * 2$)] {D};
end{tikzpicture}end{document}

Note: Usually I specifying the position of nodes with coordinates but was curious about using the positioning library.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP