CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...
http://cdelord.fr/pp
GNU General Public License v3.0
252 stars 21 forks source link

How to use asymptote with other formats than png #55

Closed robinrosenstock closed 6 years ago

robinrosenstock commented 6 years ago

I want to use svg generated from pp and asymptote. But pp always append png to the filename. How to use asymptote with other formats than png?

CDSoft commented 6 years ago

Currently pp generates only PNG images. There were two options for Asymptote: PDF or other formats. The advantage of PDF is that it accepts transparency. So internally pp makes asymptote generate PDF files converted to PNG to be accepted by pandoc. I can try to change the output format. e.g. if the format is given in the image name it will be used to generate the image (when possible).

robinrosenstock commented 6 years ago

I can try to change the output format. e.g. if the format is given in the image name it will be used to generate the image (when possible).

yeah specify format in the image name, I think also this would be best way.

CDSoft commented 6 years ago

I have a patch to use PNG and SVG formats. I'm wondering if SVG shouldn't become the default format for diagrams when available (files are smaller). Asymptote diagrams with transparency should be given the PNG extension explicitly.

robinrosenstock commented 6 years ago

I'm wondering if SVG shouldn't become the default format for diagrams when available (files are smaller)

I have no problem with that...

CDSoft commented 6 years ago

done in v. 2.3

robinrosenstock commented 6 years ago

Thanks

bpj commented 6 years ago

Note that most (all?) LaTeX engines barf at SVG. They want PDF.

robinrosenstock commented 6 years ago

@bpj you are correct, but when using pandoc, it automatically converts svg files to pdf, I think it is doing it with librsvg, see here.

There are not so many open vector formats and svg is propably the way to go in the web. So the svg format is the lowest common denominator for output formats I use most often: html and pdf.

CDSoft commented 6 years ago

I have added PDF in diagram formats (pp 2.3.1). But it may not work with PlantUML. If you want PDF, you have to explicitly add the .pdf extension to image names.

robinrosenstock commented 6 years ago

I have added PDF in diagram formats

Can you elaborate? Do you mean its the standard now?

CDSoft commented 6 years ago

No, PDF is just one possible output format. The default format is still SVG.

CDSoft commented 6 years ago

Well I think that the default format should take the output format into account. To make a PDF document, pandoc uses LaTeX. In this case the default image format should be PDF or PNG.