Skip to content
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

Make sure that having a LaTeX distribution is optional #24

Closed
leotrs opened this issue May 20, 2020 · 18 comments
Closed

Make sure that having a LaTeX distribution is optional #24

leotrs opened this issue May 20, 2020 · 18 comments
Labels
enhancement Additions and improvements in general

Comments

@leotrs
Copy link
Contributor

leotrs commented May 20, 2020

As mentioned in #23.

The installation instructions in the README should allow users who will not use/need LaTeX, but only text.

The installation instructions in the README should guide the user to install a suitable (preferably small) LaTeX distribution in as many platforms as possible (Windows/MacOS/Linux).

Tests should be aware of this being optional. For example, a fresh installation of manim (without latex) will not pass tests that require LaTeX.

@leotrs
Copy link
Contributor Author

leotrs commented May 20, 2020

Originally from @kilacoda in #28:

We could implement a check in manimlib.imports for that I think. Something like

if latex_installed():
    from manimlib.mobject.types.svg.tex_mobject import *

@PgBiel PgBiel added the enhancement Additions and improvements in general label May 20, 2020
@TonyCrane
Copy link
Contributor

TonyCrane commented May 20, 2020

For users who do not have LaTeX installed, what about adding an option to use the website API to render LaTeX formulas(get SVG file directly) online instead of the local offline rendering.

Like this, using the LaTeX rendering API on the Zhihu website in China will directly return the rendered svg file.

https://www.zhihu.com/equation?tex=...

There may also be better APIs to choose from, but I may know less.

For some people, they want to write some simple formulas with LaTeX, but they can't handle the installation of LaTeX, or they can't afford a large capacity. I think online rendering is a good solution at this time. But for those who want to use other LaTeX features, they may also need to install the LaTeX distribution.

(I’m in a poor English.Hope that you can understand me.)

@safinsingh
Copy link
Contributor

This is a really creative solution, but it would require people to always have internet. Honestly, that shouldn't be much of a problem though, so maybe we could add a flag for it. Thanks!

@leotrs
Copy link
Contributor Author

leotrs commented May 21, 2020

@tony031218 your English is perfectly understandable! You propose a very interesting solution. As with most new features, I think it comes down to: if we offer it as an alternative, users will expect us to maintain it. If the online service we choose happens to change their API, or it has privacy or security issues, or if it just stops working altogether, we are going to receive a barrage of issues about a feature that we cannot control. We would be trading the barrage of features about miktex, with a barrage of features about this feature. Is it worth it? I don't know

@TonyCrane
Copy link
Contributor

I simply implemented this feature and will improve it later.

Currently I plan to use Zhihu's API, but if this function is used by enough people, maybe we can build a server by ourselves.

Online rendering is just an alternative, we still recommend using offline rendering.

@leotrs
Copy link
Contributor Author

leotrs commented May 21, 2020

I really don't think we should implement the server ourselves. That sounds like orthogonal to manim, and like a whole very different project.

@kilacoda
Copy link
Contributor

This is a really creative solution, but it would require people to always have internet. Honestly, that shouldn't be much of a problem though, so maybe we could add a flag for it. Thanks!

We could probably add that part in a try-except block, like

try:
    download_latex_image_online()
except ConnectionError:
    print("No internet connectivity. Aborting latex download.")

(assuming ConnectionError is defined somewhere.)

@TonyCrane
Copy link
Contributor

After about two hours, I will submit a pr, then you can try it and make some suggestions. I'm going to take an exam now.

@eulertour
Copy link
Member

I don't think we should build code making web requests to private servers into manim. Even if we put the complexity of the issue aside, it's a pretty niche issue and gets us into a potential privacy issue that we can avoid entirely.

@PgBiel
Copy link
Member

PgBiel commented May 21, 2020

I don't think we should build code making web requests to private servers into manim. Even if we put the complexity of the issue aside, it's a pretty niche issue and gets us into a potential privacy issue that we can avoid entirely.

I agree. We can, however, make this extendable, i.e., people should be allowed to handle this in their own away. In this sense, this falls into the discussion about manim addons. I feel the need for an issue about this

@eulertour
Copy link
Member

We can, however, make this extendable, i.e., people should be allowed to handle this in their own away. In this sense, this falls into the discussion about manim addons.

This I can totally get behind, if someone provides an extension/addon and some people want to download it, that's perfectly fine.

@TonyCrane
Copy link
Contributor

I'm sorry you are not satisfied with my plan.

I made this suggestion not to make online rendering a complete replacement for the LaTeX distribution, but to provide a solution for those who cannot successfully install LaTeX or are unwilling to install the distribution, that is, to connect to the Internet for online rendering.

This has many limitations, such as the inability to use LaTeX's other functions and macro packages flexibly, and as you said, it is not good to send requests to the server frequently (but in fact, these APIs excuse the processing time is very short, and there are many People use them via links).

You can see my implementation here: https://github.com/Tony031218/manim/tree/online-latex
And there are still many contents that need to be improved, such as handling LaTeX formulas that are wrong, the output log file, and the svg generated with Chinese characters will contain text elements, etc.

btw, do I need or can I submit a pr to this repo?

@leotrs
Copy link
Contributor Author

leotrs commented May 21, 2020

@tony031218 Yes, it was clear that this was never meant to be a full replacement :)

The major problem with implementing a feature "just in case" something else doesn't work is that we will be expected to maintain it and support it, even when it is used only every once in a while because, well, it is "just in case".

You are of course welcome to submit PRs! Just note that every PR needs to be code reviewed and approved by at least two members with write access.

@leotrs
Copy link
Contributor Author

leotrs commented May 29, 2020

This got derailed for a little bit, but the question still stands: can we make manim independent of a latex distribution? And if so, how can this be achieved? What would installation look like?

@PgBiel
Copy link
Member

PgBiel commented May 30, 2020

just don't use TexMobject or TextMobject and it should be pretty much fine already
(well, Brace is included there too)

@leotrs
Copy link
Contributor Author

leotrs commented May 30, 2020

OK, if it's that easy then this is a problem of documenting this within the official installation instructions.

@yoshiask
Copy link
Contributor

I'm beginning to think that anything we want to be optional shouldn't be baked into the library at all. I think they should be add-ons that come shipped with it, but can removed or added as necessary.

@leotrs
Copy link
Contributor Author

leotrs commented Jul 12, 2020

@yoshiask I like that idea. And it seems like this is a problem of documentation. So let's keep that in mind when writing the tutorial.

@leotrs leotrs closed this as completed Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general
Projects
None yet
Development

No branches or pull requests

7 participants