Fix various issues with the PDFLatex extension
What does the merge request do?
- Closes #245 (closed) (duplicate of https://bugs.launchpad.net/inkscape/+bug/171921)
- Closes #339 (closed)
- Closes https://bugs.launchpad.net/inkscape/+bug/172079 (mostly, preamble is globally configurable, which should be ok, for more advanced features TexText is better suited anyway)
- Closes https://bugs.launchpad.net/inkscape/+bug/1402731
- Closes https://bugs.launchpad.net/inkscape/+bug/1604183
The following changes have been made to the Render LaTeX extension:
- It is now possible to specify the font size in pt (#245 (closed)).
- There are two modes of operation, one based on "minimal" and one on "standalone". The latter natively supports different font sizes, while the former does not - however it requires more packages. These are included in a full TeXLive install (and can be installed on-the-fly in MikTeX, this even works on Windows).
The different between the two can be seen in the following picture:
- The extension works well in different document units and scalings (10pt text in Inkscape has roughly the same size as the text returned by the extension when set to 10pt)
- A bug related to the way the extension imports the generated files was fixed. Each character is a symbol; after a lot of runs, we run out of unique ids (the call to
set_random_ids
on the pdflatex output was well meant, but pretty useless because it doesn't know the ids of the document to insert into) - so suddenly random character substitutions occured. This was fixed by unlinking the clones first, seems like the cleanest solution to me.1 (We're calling Inkscape anyway for pdf->svg conversion, so one more action doesn't hurt there). - With both modes, the output('s top left corner) is now centered on the view (#339 (closed)). This is realized by calling the verb "page-fit-to-selection" during PDF->SVG conversion.
- It is now possible to specify the packages loaded in the preamble.
- As proposed in ux#140 (closed), the extension has been moved out of its submenu (it was the only entry there).
- The preview checkbox was disabled, the extension is too slow for this.
- If a LaTeX compile error occurs, the error message is now more readable (instead of a backtrace, a well-formatted log of pdflatex is shown).
Keep in mind that this is an equation renderer and not supposed to be a fully-featured LaTeX editor. For more complex use cases, I kindly refer to @jcwinkler's TexText extension (https://github.com/textext/textext).
Summary for release notes
The Formula (pdflatex) equation has been made more user-friendly. It now features a font size selector, a field to specify preamble contents, better support for scaled documents and better error messages on compile errors. Also several bugs have been fixed, such as incorrect insertion position (#339 (closed)) and random character substitution in documents with many formulae.
Checklist
-
Add unit tests (if applicable) -
Changes to inkex/
are well documented -
Clean merge request history
-
I did explore other options. Setting very long random IDs on all
<defs>
children works, but is ugly. Also, I ran into #457 (closed) when trying to process these elements individually.↩