-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TikZ support package #437
Comments
(Side note: dpic uses different syntax than TikZ and is not written in Lua, but fills a similar niche (see e.g. page 8 of dpicdoc.pdf), is BSD-licensed and written in C. This, or the GNU |
I want to add that it is not just graphs with axis and plots that would be useful to be able to do, but other diagramming such as state machines and transition graphs for example. Underneath graphics primitives abstracted up to markup environments for special diagramming. Then we could create environments such like \begin{statemachine} Then render something like this I could just embed them as images using other languages and tools, but then labelling and fonts would need to also match the document, and also the issue of referencing in specialised contents tables rather than "Table of Figures". |
If you have a tool that takes markup in and spits the plots you want out it is pretty trivial to write a SILE package to deal with them. Passing contextual information like the current document font is just a little more work. If you have a language/tool you want to implement feel free to open an issue for it and I'll get you started. We well have to resolve #1092, so it might look like this:
... or you may need to specify on the CLI what handlers you'll use in advance, something like:
Either way it is quite doable and should be easy to get rolling. TikZ in the other hand is a special snowflake because it's technically an input language with deep tries to LaTeX itself and no stand alone handler that generates outputs. It expects to reach deep into TeX internals. As such it's not really in the same category as, say, some stand alone tool that converted UML markup to SVG. (Lilypond is also a special snowflake because it doesn't output one graphic, the expectation is that it would generate many graphics such as one per bar, then let the typsetter sort out placing them perhaps across page breaks etc.) |
Handler (like the notion and terms callback, delegate and function pointer etc) is a programattic notion and terminology, imo that is leaking programmatic abstraction up into typesetting markup abstractions. The risk there is typesetting markup becomes more programming than descriptive marking up and then the markup loses clarity of purpose. |
You should have that comment on #1347 - There might be a good name somewhere between my |
Good point on the programming vs. markup terminology. |
FWIW, https://pikchr.org is a small CLI application in C that is an evolution by SQLite author(s) of the venerable PIC by Brian Kernighan. It allows drawing SVG diagrams from a markup language. The following script allows to roughly reproduce the diagram mentioned above:
which results in the following SVG image: Notable differences:
See also https://kroki.io for some other interesting diagramming tools. |
@akavel That looks quite promising, especially because with SVG output it should be dead simple to integrate into SILE. Would you mind opening your above message as a new issue (since this isn't about TikZ)? I'd like to play around with implementing it, both because I have at least one immediate use for it as a small test and because I think it would make a good proof of concept for how to write a package for this sort of thing. |
Rejected (Wontfix): It does not seem relevant to introduce a dependency of that kind in the core distribution. Tikz is a huge beast 😸 Maintainers have settled on keeping the core free, as much as they can, of packages that require external dependencies. Not that this is therefore out of scope for core SILE, but not necessarily out of scope for the SILE ecosystem: Anything that requires compiling or using external dependencies belongs in a 3rd-party package, not to not to the core distribution. We already have the tooling available for that and anybody can spin up a 3rd party package. If SILE needs to implement some API to make it more usable, we can look into that. For future reference, at this date here are examples of 3rd-party packages that use external tooling:
The core converters package is also an interesting resource to consider. |
This was mentioned on the Wiki but an issue was never opened, so here goes. For me the need for this is greatly reduced by having SVG support, but it would still be nice to have for bringing documents over from TeX and would probably still be a huge boon for some markets.
Implement a package that generates graphs using TikZ and embeds the output. Since there is a Lua interface this should be easier than (but conceptually similar) to how MathJax (#220) and Lilypond (#435) support might work. It's probably also worth cross-linking my idea for pre-processing raster images with ImageMagick (#436).
The text was updated successfully, but these errors were encountered: