Closed dpo closed 3 years ago
Hi,
At the time of your issue, this mathjax-tex-options
only accepted inline options string not file path --- that was an oversight caused by unintentional git merges. Thanks for bringing it up, and It should be fixed now. Once you updated, a working example on my end:
$ python math-with-slack.py --mathjax-tex-options=test_config.js
where test_config.js
contains (I grabbed from http://docs.mathjax.org/en/latest/options/input/tex.htm):
{
packages: ['base'], // extensions to use
inlineMath: [ // start/end delimiter pairs for in-line math
['\\(', '\\)']
],
displayMath: [ // start/end delimiter pairs for display math
['$$', '$$'],
['\\[', '\\]']
],
processEscapes: true, // use \$ to produce a literal dollar sign
processEnvironments: true, // process \begin{xxx}...\end{xxx} outside math mode
processRefs: true, // process \ref{...} outside of math mode
digits: /^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,
// pattern for recognizing numbers
tags: 'none', // or 'ams' or 'all'
tagSide: 'right', // side for \tag macros
tagIndent: '0.8em', // amount to indent tags
useLabelIds: true, // use label name rather than tag for ids
multlineWidth: '85%', // width of multline environment
maxMacros: 1000, // maximum number of macro substitutions per expression
maxBuffer: 5 * 1024, // maximum size for the internal TeX string (5K)
}
This options file should contain a javascript dictionary. The dict should have the same structure as the dict under the "tex" option at: http://docs.mathjax.org/en/latest/options/input/tex.html. Note that I believe this dict can only contain pre-ES6 syntax (so no JS lambdas etc).
In general, I have considered this flag as a power user feature, so I haven't paid too much attention to its usability. Let me know what you think?
Amazing, thank you so much! This makes it much easier to share configs and update Slack with a given config file.
I've used the inline option to share the config, so that I can just send people the command without any additional config files. But admittedly, the inline option requires escaping every slash, which makes it unreadable.
I will close this for now, though I'm open to suggestions for a more usable interface. So feel free to open a new one if you (or anyone) have ideas.
The script documentation says that I can specify a file with MathJax options when installing (https://github.com/thisiscam/math-with-slack/blob/master/math-with-slack.py#L67). However, the README only shows an example where the config is given explicitly on the command line. I wasn't successful specifiying a file. What is the exact syntax and what should that file contain?
For instance, if I create a file with the content of the URL given in the documentation (http://docs.mathjax.org/en/latest/options/input/tex.html), I get no TeX rendering at all. In the README, three backslashes are used to specify delimiters. In the file, there are only two.
Could you please clarify?
Thanks.