learnlatex / learnlatex.github.io

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

Refactor runlatex javascript to fully merge with the fork used at latex.org and texwelt.de #155

Closed davidcarlisle closed 3 years ago

davidcarlisle commented 3 years ago

This PR introduces a new runlatex configuration object extending the original buttons object.

buttons gets essentially renamed to runlatex.texts and has some additional fields not used at learnlatex but for example used to comment default preambles added in the forums.

additional paramteters

runlatex.editorlines=100;
runlatex.adddefaultpreamble=false;
runlatex.adddefaultengine=false;
runlatex.usecaptions=false;

The runlatex-sk fork is equivalent to setting these to:

runlatex.editorlines=40; Smaller editor pane

runlatex.adddefaultpreamble=true; Fragments that look like TeX get the run latex button but a default preamble is "guessed" based on commands used in the content.

runlatex.adddefaultengine=true; at learnlatex, if a comment such as % !TeX lualatex is not used then pdflatex is assumed, if this is true the default engine is guessed based on packages or commands used.

runlatex.usecaptions=true; If this is true and the runlatex.texts object has a caption entry, the caption is added above each code fragment that has a button to submit the example, can be used for texts such as edit and run this example

changing the buttons object requires changes in buttons.js in all translations and moving the preincludes object inside runlatex involves editing lessons 12 and 13 in all translations.