0

I have a markdown document that I wish to output in pdf format. I cannot find a way to format the images correctly.

If I use

<center><img src="_images/parameter_form.png" alt="Select Parameters" width="400"></center>

I works perfectly with make html, but with make latexpdf the image does not appear at all.

If I use (based on this stack overflow answer)

![Select Parameters](_images/parameter_form.png) { width=400 }

The images is not sized and the format string { width=400 } appears in the text

What am I doing wrcng?

mzjn
  • 48,958
  • 13
  • 128
  • 248
Psionman
  • 3,084
  • 1
  • 32
  • 65
  • You are trying to use HTML in a PDF. That will not work. There might be some Markdown flavor that does what you want, but I do not know what that could be. Otherwise you must find a syntax that supports image sizing, such as MyST or reStructuredText. – Steve Piercy Aug 09 '22 at 08:33
  • The second example I my code is markdown, but as you say doesnt support sizing. I think I'll abandon pdf and just provide an html doc – Psionman Aug 09 '22 at 09:57

1 Answers1

0

The answer is to use MyST. This Sphinx parser allows a richer syntax in markdown and specifically the image tag

```{image} _images/parameter_form.png
:alt: Select Parameters
:width: 400px
:align: center
```

Perfect!

Psionman
  • 3,084
  • 1
  • 32
  • 65