Skip to content

Commit b3d58d4

Browse files
committed
Add inkscape usage and configuration when using LaTeX
1 parent 3cdff0b commit b3d58d4

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

docs/authoring/diagrams.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ Valid values for `mermaid-format` include `js`, `png`, and `svg`,
205205

206206
When rendering to LaTeX-based formats, `mermaid-format: svg` requires additional tooling and may have rendering issues:
207207

208-
- **Requires installation:** `rsvg-convert` must be available in your system PATH for Quarto to convert SVG to PDF to include in LaTeX.
208+
- **Requires installation:** `rsvg-convert` or `inkscape` must be available in your system PATH for Quarto to convert SVG to PDF to include in LaTeX.
209209
- **Potential rendering issues:** Text clipping in diagrams with multi-line labels
210210
- **Recommended:** Keep default `mermaid-format: png` for PDF output with LaTeX.
211211

212-
For more details, including installation instructions, see [SVG Images](/docs/output-formats/pdf-basics.qmd#svg-images).
212+
For more details, including installation instructions and Inkscape configuration, see [SVG Images](/docs/output-formats/pdf-basics.qmd#svg-images).
213213
:::
214214

215215
## Mermaid Themes {#mermaid-theming}

docs/output-formats/pdf-basics.qmd

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,42 @@ You can learn more about installing `librsvg`{spellcheck="false"} (which provide
229229
scoop install rsvg-convert
230230
````
231231
232-
::: callout-note
232+
### Alternative: Using Inkscape
233+
234+
If you prefer to use Inkscape instead of `rsvg-convert`, you can disable the default conversion by setting `use-rsvg-convert: false`. This will use the [SVG LaTeX package](https://ctan.org/pkg/svg) to include the svg using `\includesvg{}` which uses Inkscape to convert to PDF. This requires some configuration to opt-in:
235+
236+
```yaml
237+
format:
238+
pdf:
239+
use-rsvg-convert: false
240+
pdf-engine-opts: ["-shell-escape"]
241+
```
242+
243+
Note that this configuration requires:
244+
245+
- Inkscape to be installed and available on your system PATH
246+
- The `-shell-escape` option for your LaTeX engine to allow execution of external programs
247+
- The SVG LaTeX package (automatically included by Quarto)
248+
249+
### Platform Considerations
250+
251+
The availability and ease of installation for SVG conversion tools varies by platform:
252+
253+
- **Linux/macOS:** `rsvg-convert` is typically available through package managers (`librsvg` package). This is the recommended approach for these platforms.
254+
- **Windows:** Installing `rsvg-convert` is more challenging. While it can be installed via Scoop (as shown above), most Windows users should consider using PNG format for diagrams rather than SVG.
255+
- **Inkscape:** Available cross-platform but requires the `-shell-escape` configuration. Consider using this only when you specifically need Inkscape's rendering capabilities.
256+
257+
For diagram formats, PNG is generally recommended for best compatibility and ease of use. See the @nt-svg-diagram below for more details.
258+
259+
::: {#nte-svg-diagram .callout-note}
233260
## SVG Format for Diagrams
234261
235-
When using Mermaid or Graphviz diagrams in PDF documents, the default PNG format is recommended. While SVG output is possible with `mermaid-format: svg`, it requires `rsvg-convert` and may have rendering issues such as text clipping in diagrams with multi-line labels. See [Diagrams](/docs/authoring/diagrams.qmd#mermaid-formats) for more information.
262+
When using Mermaid or Graphviz diagrams in PDF documents, the default PNG format is recommended. While SVG output is possible with `mermaid-format: svg`, it requires external tooling:
263+
264+
- `rsvg-convert` (default) - See [installation instructions](#svg-images) above
265+
- Inkscape (alternative) - Requires `use-rsvg-convert: false` and `-shell-escape` configuration
266+
267+
SVG format may also have rendering issues such as text clipping in diagrams with multi-line labels. For most users, PNG format provides better compatibility and ease of use. See [Diagrams](/docs/authoring/diagrams.qmd#mermaid-formats) for more information.
236268
:::
237269
238270
## Remote Images

0 commit comments

Comments
 (0)