I am trying to convert latex into an image like those online latex to image converters.
Most of the methods I have seen for doing so suggest calling an external application via say the subprocess module which will generate the image for me.
However, management is not keen on this as it will require external users to install additional software in addition to our own which, with I can assume to be a simple task.
I have seen which is more or less the problem. It suggests use of MathJax or built-in function of Sumpy or python specific libs . Another option is a cpp library for which I have to create bindings for (in which I have zero experience)
Another solution I have is to
Have .PNG files that contain btyes for numbers (0-9) and other symbols that are needed
Then using image crate for each char use include btyes and place the btyes in the image.
But this solution is error prone and not exactly flexible for more complex LaTeX equations.
So is there some rust lib that provides this functionality directly or indirectly. Any help is appreciated!
However, calling into an external process for such a complex task doesn't seem too bad. Couldn't you just package your application as a Docker container with LaTeX preinstalled?
Very curious indeed that these two libraries didn't show up on my searches , both seem promising , and need to check if output as image functions correctly
I have looked at the libraries and i believe typst is more then enough for my use case but i didnt seem to find any api callable via code , so it there only the cli or is there a callable api via code
However in both cases i get with cargo build --verbose
Updating git repository `https://github.com/typst/typst/blob/main/crates/typst`
warning: spurious network error (3 tries remaining): request failed with status code: 404; class=Http (34)
warning: spurious network error (2 tries remaining): request failed with status code: 404; class=Http (34)
warning: spurious network error (1 tries remaining): request failed with status code: 404; class=Http (34)
error: failed to get `typst` as a dependency of package `arkley_describe v0.0.3 (C:\Users\Aarav Aditya Shah\Documents\GitHub\arkley\arkley_describe)`
Caused by:
failed to load source for dependency `typst`
Caused by:
Unable to update https://github.com/typst/typst/blob/main/crates/typst
Caused by:
failed to fetch into: ....\.cargo\git\db\typst-ae98927b3345e35f
Caused by:
network failure seems to have happened
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
request failed with status code: 404; class=Http (34)
If i use github to clone it works but not with cargo
You will want to specify the git url, not the viewable tree url.
I found this in the green "Code" button on the main page: https://github.com/typst/typst.git
For reference, this matches the cargo reference example (which shows details like how to specify a branch).
That is a side effect of the typst authors seemingly not having published their crate via crates.io.
When you do the latter, docs are generated and uploaded to docs.rs, and a crates.io entry is upserted as well.
EDIT:
I just thought of something else. You can get a version of what would be uploaded on docs.rs by cloning the git repo, then navigating to the crate, and executing cargo doc --open. That will build the docs, as well as open up a browser window to their index.