quartobeamer

Center a graphviz diagram written in quarto for beamer output


I am generating diagrams using graphviz/dot inside quarto and would like them to be centered, within the column or the whole frame.

I am producing beamer pdf output (as well as docx for accessibility).

// | fig-width: 1.8
// | fig-align: center

graph G {
    center=true;
    node [label=""];
    
    G -- a1;
    G -- a2;
    a1 -- a11;
    a1 -- a12;
    a1 -- a13;
    a2 -- a21;
    a2 -- a22;
    a12 -- a121;
    a12 -- a122;
    a22 -- a221;
    a22 -- a222;
    a22 -- a223;
    
    G [label="G"];
}

I've tried looking for centering for columns in quarto, but the align attribute there is about vertical alignment.

The center=true inside dot doesn't seem to make any difference either.

Any suggestions?


Solution

  • I actually got help from the quarto author. The trick seems to be to add //| label: fig-something and then it is written as a proper figure environment in latex. //| fig-align: center then ensures I get my centering as requested.