Skip to content

Support applying options to multiple examples as suggested in #640 #1339  #1368

@hansonchar

Description

@hansonchar

Brief outline of the proposed feature

Motivation for this change

The conversation at #640 on the possibility of supporting the specification of options that can be applied to multiple examples.

To demonstrate the usage of this feature, I've modified ControlElectric.lua, while simplifying the code by removing unnecessary double quotes at the same time.

** Pull request already approved **

#1339

Usage example

For the record: Here are other examples that could make use of this PR:

  • --[[
    % TODOsp: codeexamples: the following 3 examples need these libraries
    % \usetikzlibrary{graphs,graphdrawing}
    % \usegdlibrary{force}
    --]]
    example
    [[
    \begin{tikzpicture}
    \draw [help lines] (0,0) grid (3,2);
    \graph [spring layout]
    {
    a[x=1] -- { b, c, d, e -- {f,g,h} };
    { h, g } -- a;
    };
    \end{tikzpicture}
    ]]
    example
    [[
    \begin{tikzpicture}
    \draw [help lines] (0,0) grid (3,2);
    \graph [spring layout]
    {
    a -- { b, c, d[x=0], e -- {f[x=2], g, h[x=1]} };
    { h, g } -- a;
    };
    \end{tikzpicture}
    ]]
    example
    [[
    \begin{tikzpicture}
    \draw [help lines] (0,0) grid (3,2);
    \graph [spring layout]
    {
    a -- { b, c, d[x=0], e -- {f[x=2,y=1], g, h[x=1]} };
    { h, g } -- a;
    };
    \end{tikzpicture}
    ]]

  • --[[
    % TODOsp: codeexamples: the following 4 examples need these libraries
    % \usetikzlibrary{graphs,graphdrawing}
    % \usegdlibrary{layered}
    --]]
    example
    [[
    \tikz \draw (0,0)
    -- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} }
    -- (1.5,0) graph [edges=blue, layered layout,
    anchor node=y, anchor at={(2,0)}] { x -> {y,z} };
    ]]
    example
    [[
    \begin{tikzpicture}
    \draw [help lines] (0,0) grid (3,2);
    \graph [layered layout, anchor node=c, edges=rounded corners]
    { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a};
    \end{tikzpicture}
    ]]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions