-
Notifications
You must be signed in to change notification settings - Fork 163
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
Shell-escape #38
Comments
Tectonic very explicitly does not, because the engine is intended to be fully standalone, so that it can have fully reproducible document compiles. Calling out to arbitrary programs that may or may not be available on arbitrary machines breaks that. I really want to discourage the use of shell-escape techniques as much as possible. However, I believe that |
The question is if there are alternatives for things like syntax highlighting :) Might it be possible to write LaTeX packages in Rust? (One of the downsides of that would be that it's not compatible with other implementations anymore though.) |
I just recently had to deal with this — my solution was the I believe the correct solution for this sort of thing is not to attempt to integrate Rust (or, say, Lua) into the TeX engine, but to instead write programs that can generate (La)TeX code that's then fed into the engine. TeX is impossible to parse, but not hard to generate. |
Which is what these programs that are called via shell-escape do :) |
OK yes but they do it at the wrong time :-) You can't encapsulate/embed the TeX engine if it needs to run arbitrary executables at runtime — it should be a handed a complete set of inputs that it can process without needing to talk to the outside world. I don't feel like I've converged on the most persuasive way to make this case but I have an extremely strong engineering/design sense that shell-escape is a bad path to go down. |
It definitely is a bad path, and documentation always warns about that flag, but I don't see a good alternative. Maybe it could be allowed in an "impure" mode, with proper warnings? |
Maybe it could be made to only access an isolated environment like chroot, or even containers with only programs specified in |
Turns out Tectonic isn't as feature complete as it says it is tectonic-typesetting/tectonic#38
@pkgw just my 2c since this seems to just be sitting here. I really want Would it be possible to add it so that users aren't blocked from using these packages, just strongly discourage it? e.g.
|
If it would be possible to implement minted commands as a rust implementation which doesn't require shell-escape. I have written code to syntax highlight with syntect and convert to tex which does not require shell-escape. I just don't know yet the right way to export this code to the tex engine, or how to package themes, and language definitions for the bundle, nor whether this should be an external command, feature, or sandboxed webassembly 😬. All these questions really belong in a separate issue, but i'd much rather put in the effort than see us cave on shell-escape. |
Are you proposing creating a fork of minted that uses syntext instead of pygments? If this approach is used, I must admit I have quite a few concerns about the maintanability involved with your own rust-ed forks of minted, biber, TikZ externalise, pythontex, etc. |
yes, here is an example that is already using tectonic, built into a preprocessor that writes tex like pkgw's comment, recommends. Reading though reading again he advocates against hooking into rust code to implement tex commands as I advocate above. I understand why, it's a slippery slope as you remind me but given that it can be done without sacrificing reproducibility (and it can) its at least worth considering for only the most popular packages. If only to quell the stalemate. |
I see. At the moment I'm tempted by tectonic (hence my commenting here), but the main thing keeping me away is not being able to use my the packages that have become essential to my daily workflow (minted, biber,...). It sounds like at the moment I'll have to stick with the standard engines for |
At this point, it seems to me that it would help a lot of people to add a (I would like to implement any command-line flag with something like a |
New to using tectonic, but with |
Do you know where to go in xetex to enable shellescape? I started poking around, but it seems the code to actually run commands is missing. In particular, |
My use case to use |
I loved tectonic. As a new Latex user it was just beautiful. Installing = easy, compiling = easy, output = nice, auto downloading packages = awesome, not able to use minted = quit tectonic. pretty sad but the lstlisting package is garbage in terms of linting. not even yaml works. why do you wanna make it so hard with the -Z flag. what about |
Yeah, I mean if you find another way to make minted work with tectonic and without Minted is a modern and (in contrast to |
No |
Since i cannot wait until the PR is merged (got some deadlines over here) and tectonic is by far the smoothest LaTeX compiler, i created a small helper script to use minted with tectonic with a tutorial until it is built in. https://breuer.dev/tutorial/tectonic-minted Just comment on the post if something is not working properly and i will try to fix it :) |
For any *cough Emacs users here, I've made a minted replacement (for Org exports) that:
See here for a sample, and the implementation at https://tecosaur.github.io/emacs-config/config.html#pretty-code-blocks. |
@breuerfelix I had a similar need, and ended up switching to Rubber. Which however does not pull packages. Sic. 😞 |
@DanySK also heard of it and tried alternatives. nothing is as easy-to-use as tectonic :) |
@breuerfelix that's a very nice effort, but it hardly applies to documents that already have minted used across the board with inline code. I will consider it for future papers though... |
Hi there. I have a thesis that uses minted, biber and standalone and all three packages need |
Wohaaa! Niice! Out of nowhere. Awesome. 🎉 |
How does one enable |
@charmoniumQ |
I tried that:
|
From browsing through the codebase, I think unstable options are not implemented for the V2 CLI (there is no call to |
It is supported through Tectonic.toml for the V2 interface. Edit: my understanding is that it is intentionally only enabled through Tectonic.toml as it furthers reproducibility for the arguments passed in not to affect the processing. |
I wanted to clarify #38 (comment):
As #38 (comment) correctly points out, that's not the case:
Now, if we use
|
@cogumbreiro Yes, my comment referred strictly to the V2 CLI e.g. |
I wonder whether If you're using a makefile or latexmk it's as straightforward as adding some build steps. |
@Caellian it's also pretty easy using tectonic as a library to just read (code blocks from) markdown files directly and parsing with something like pulldown-cmark and using syntect for syntax highlighting (or just use syntect directly I suppose), the tex generated by the following is probably fairly specific to the project, but here is some code that works like that https://github.com/ratmice/lumpy-leandoc/blob/master/src/tex_gen.rs One of the benefits of that is it keeps the install phase down to a single Edit: I really only mention markdown here, because that is what the linked code doing, to just use syntect itself would be much simpler... The extent of the actual syntax highlighting code is the |
@ratmice Right, but if you're simply working on a document it might be unpractical to roll your own version of tectonic to support that as it could take well over a week to just get familiar with it and write the logic required to simply get started writing the actual document. It makes sense only if you're trying to automate the process for a lot of documents. |
Yeah, I think it would take some amount of work to make it usable for everybody as a general solution, where we use something like what was discussed in #1120 to add additional fields to |
@ratmice I do envision that sort of arrangement becoming common, and is something I expect to need for projects like tectonopedia. That being said, compiling the full Tectonic crate is relatively hard and expensive. Approaches that don't require a full (re)build will be a lot easier on people. I have two main ideas about how one could go about this. One direction is "outside-in": a stock Or, you could take an "inside-out" approach, where some external program drives a stock |
Yeah, build times were a bit long for my project. The main advantage was that it had a single But I would need to play with it to understand if that would actually be a viable option. |
Does tectonic support the
--shell-escape
flag? It is used to do things like syntax highlighting with pygments (using theminted.sty
package).The text was updated successfully, but these errors were encountered: