tueda / makefile4latex

A GNU Makefile for typesetting LaTeX documents.
MIT License
26 stars 3 forks source link

Adding svg and jpg/png as possible outputs #10

Closed ruzickap closed 4 years ago

ruzickap commented 4 years ago

Hello.

Would it be possible to ass the svg and png as outputs?

I'm using this command to get svg from the tex:

latex ${FILE}.tex
dvisvgm -n ${FILE}.dvi

It may be also handy to get the "png / jpg" output as well:

pdflatex ${FILE}.tex
pdftoppm -singlefile -jpeg -r 200 ${FILE}.pdf ${FILE}
# or
pdftoppm -singlefile -png -r 200 ${FILE}.pdf ${FILE}

I'm using it for generating the cheatsheets like: https://github.com/ruzickap/cheatsheet-atom

Thank you...

tueda commented 4 years ago

Thank you for your suggestion. I put svg, jpg, png rules into the Makefile, so you can use

make svg
make jpg
make png

For now, I'm using dvisvgm for .svg files as you suggested. Indeed this has the advantage that it is included in TeX Live. But I'm not sure if it is best from the viewpoint of quality; pdf2svg, pdftocairo or mudraw may be used as a pdf -> svg converter. This may be changed in future.

For jpg/png outputs, I do not like to fix the image resolution to any value, because it really depends on one's purpose. If the default value is not good for you, then you can change it by PDFTOPPM_OPT (or PDFTOPPM_JPG_OPT/PDFTOPPM_PNG_OPT) in the user customization file .latex.mk:

echo 'PDFTOPPM_OPT += -r 200' >>.latex.mk
ruzickap commented 4 years ago

Awesome thanks a lot. It's working fine :-)