I am having two problems with diagram converting a tikz figure within a quarto document:
\ref
, but not for @fig-...
)Here is a MWE:
---
title: "A tikz diagram extension test"
filters:
- diagram
---
## Test section
Hello, please see \ref{fig-delta} and @fig-delta
```tikz
%%| label: fig-delta
%%| caption: A test
\begin{tikzpicture}
\node (a) at (0, 0) {a};
\node (b) at (2, 0) {b};
\draw (a) -- (b);
\end{tikzpicture}
```
And here is the output (I am using firefox)
Note: I also posted an issue on GitHub
I've experienced similar problems with tikz figures. Here are my workarounds:
I found no way to alter the svg scaling in the conversion. What worked however, was to increase zoom for img elements in style.css
:
.img-fluid {
zoom: 150%;
}
This assumes that the style file is included in front matter or _quarto.yaml
:
format:
html:
css: style/style.css
(If you have different kinds of figure images, a more precise CSS selector might be needed.)
I've made the experience that life in Quarto is a lot easier if one uses div syntax for everything, including the tikz figures.
In your example, this would read:
Please see @fig-delta.
:::{#fig-delta}
```tikz
\begin{tikzpicture}
\node (a) at (0, 0) {a};
\node (b) at (2, 0) {b};
\draw (a) -- (b);
\end{tikzpicture}
```
A test
:::
To see it in action, here's what a similar snippet generates in my thesis document. (Feel free to copy other workarounds from the linked repo!)