I need to automate the process of generating a report in LaTeX assembling multiple figures stored in .svg
and .png
formats. My initial idea was to write an HTML template using CSS Grid Layout, format paths and captions with jinja2
Python package, generate a .pdf
using weasyprint
and compile the final report with LaTeX.
However, I have difficulties with converting .html
to .pdf
because of CSS Grid Layout: in Chrome no pdf can be converted, in Firefox the resulting pdf looks really different from the webpage.
What solution could you suggest based on the following criteria?
Flexibility of setting up the layout: I have about 100 figures of different size to assemble and would like them to be properly aligned. Some part of the figures are repetitive blocks. Therefore some kind of grid and subgrid abstractions would perfectly work.
Quick solution: I am sure it is possible to use plain CSS/LaTeX to define the layout I want, but I am not an expert in CSS/LaTeX, and cannot spend a lot of time learning it. However, maybe there are some frameworks around that would simplify the work and are easy to learn?
Automatic solution: I would like to automate as far as possible the process starting from generating the individual figures to generating the final report.
Possible post-processing: it is possible to automate a lot, however I would like to have a possibility to correct some parts of the figures in a vector-graphic redactor.
Maybe it is possible to solve the problem of converting HTML to PDF? I tried to use some plugins available for Firefox, but they did not work.
An example of a layout:
If my question does not fit the format of stackoverflow, please tell me to what community I should move it.
When it comes to positioning of pictures in LaTeX I think of minipages -- you can adjust their size and allow for some align.
My workflow would be:
Setup a LaTeX-template with self-defined commands for placing pictures in a special layout, using minipages. The names of the pictures can be handed over to the command as arguments.
If you want automation, create a bash-script that inserts LaTeX-code into the document-part, so the bash-script eg. iterates over the images in your directory and places them according to the layout defined in the template.
The final LaTeX-doc can be post-processed to your liking.
BTW
cannot spend a lot of time learning it
Think about using LaTeX then ;) It really requires some time.