learnlatex / learnlatex.github.io

Learn LaTeX online
https://www.learnlatex.org/
Creative Commons Attribution Share Alike 4.0 International
151 stars 54 forks source link

Linking to online tex systems #18

Closed davidcarlisle closed 4 years ago

davidcarlisle commented 4 years ago

Code examples will need links to an online TeX system.

A rough draft is being worked on at

https://davidcarlisle.github.io/texlive.js/test2

(can be moved under this learnlatex organisation if there is general agreement to the approach)

The test currently has lots of inline script which could be moved to the page template once it works, so basically shows a possible way to have just markdown documents with active links for the examples.

The overleaf link currently goes to a read-only instance under my account (ideally for people with accounts it ought to open a writeable version unique to them, if that is possible)

The texlive.js link runs tex in the browser using a site-hosted instance of texlive.js it currently only works in firefox (some known chrome and edge issues to avoid)

This issue is opened to track the general issue linking to online systems not specifically the test above.

samcarter commented 4 years ago

ideally for people with accounts it ought to open a writeable version unique to them, if that is possible

For https://texnique.fr code blocks have a link to open as new projects for people logged-in into overleaf. Just wondering, maybe something in the source of texnique.fr could help with this problem.

josephwright commented 4 years ago

I plan to ask the Overleaf people about how they do their own templates at the point we have agreed content to be 'activated'

davidcarlisle commented 4 years ago

Yes that's why I just put a placeholder in for overleaf, I figure they will let us know what they want. Mainly I was working to get the texlive link working well enough to see if people think it is a good idea. One thing I didn't mention is that it doesn't (currently) include xetex or luatex (although I have seen projects that have compiled xetex to javascript)

davidcarlisle commented 4 years ago

The current code is using latexonline.cc so running the examples in a hosted docker container which is noticeably faster than texlive.js and gives the possibility of using xetex and luatex also bibtex.

https://latexonline.cc/compile?text=%5Cdocumentclass%7Barticle%7D%5Cbegin%7Bdocument%7Dhello%5Cend%7Bdocument%7D

In the current draft buttons for edit/compile are just added if the code includes \documentclass it would be easy to take fragments and add a standard preamble if that is required, just needs some way to distinguish those from really small framents where it does not make sense, could be a majic comment, or perhaps use

   ```tex

instead of

    ```latex

to distinguish fragments which should not be compiled.

josephwright commented 4 years ago

The current code also has a disabled link to OverLeaf There is (apparently simple) code at

https://texnique.fr/osqa/m/default/media/js/writelatex.js

But adding a similar form and submit code here produces

There was an error creating your project The link to open this content on Overleaf was missing some required parameters.

I plan to ask Overleaf themselves to suggest how best to do this: we'll want the same set up as their own tutorial pages.

Skillmon commented 4 years ago

@josephwright Overleaf is using project-templates for their help articles and the links are setup such that the template is copied as a new project with some preferences (iirc).

davidcarlisle commented 4 years ago

I plan to ask the Overleaf people about how they do their own templates at the point we have agreed content to be 'activated'

agreed they should say how final linking should work but I have fixed the code mentioned above so the overlink button now works, for testing anyway.