Macros in MathJaX - mathjax

I would like to add some macros in my MathJax configuration. Specifically I would like to add:
\arcsin and be displayed as {\rm arcsin}
\arccos and be displayed as {\rm arccos}
\arctan and be displayed as {\rm arctan}
\arccot and be displayed as {\rm arccot}
I have read the MathJaX documentation and although I think that I do the steps right, I end up with either the MathJaX not working properly or not loaded at all. By the way, why are these commands not supported at all? I think they should. Is there a specific reason?
How can I add these macros in my configuration?

MathJax 3 supports all the commands you mentioned (\arcsin, \arccos, \arctan and \arccot) so you don't have to create macros for them. For \arccot, the physics extension must be loaded.

Related

converting KaTeX to MathJax

Is there currently any way in javascript to convert a KaTeX formular to MathJax, I want to support exporting to Anki which just works with MathJax.
If not, is there a table which shows which commands of KaTeX are not supported in MathJax, I can't seem to find one.
I just need the conversion from KaTeX to MathJax, not the other way around
A workaround might be the new addon for anki that supports katex. I'm not ready to use it yet (there appears to be some bugs with line-breaking. See comments on the link).
https://ankiweb.net/shared/info/1087328706
I have the same use case as you. I write markdown and katex in vscode (with Markdown+Math extension), and export to anki (using ankdown - slightly modified).
I find that sometimes mathjax causes problems - for example with tags.

How to do a bold 1 (\mathbbm{1}) in MathJax

I'm looking for blackboard bold numerals in LaTeX displayed with MathJax.
It seems that the \mathbbm command is not (yet) available from MathJax (as said in the documentation).
Is there anyway to have support for the \mathbbm command, e.g., to have nice bold 1 ?
I tried to load an extension, or trick from this question, but nothing works.
Here is an example showing the failure: with makebigmaths.
It seems to be a known and old issue of MathJax, coming from a font limitation.
And no third party extensions seem to solve it.
However, Jupyter notebooks supports it in its Markdown cells.
You can use Unicode characters directly, e.g., 𝟙, or via the non-standard macro \unicode{x1D7D9}.
Both of these can be used in macro definitions as well, cf. http://docs.mathjax.org/en/latest/tex.html#defining-tex-macros.
One can use \Bbb instead of \mathbbm which is mentioned under "Font control" in the current documentation. Judging by the question Obsolete command \Bbb, it is an obsolete TeX command.
I use \Bbb in an align environment using MathJax version 3.2.2 for doxygen.

Sahi: Cannot execute scripts recorded in a browser in multiple browsers

Our web application is designed such that the text transform is picked from CSS.
There are multiple links on a webpage; hence i will take example of a Next link.
When i hover the mouse over Next link in FF, it shows the below code:
_click(_link("Next"));
Similarly when i hover the mouse over the same link in Chrome, it shows the below code:
_click(_link("NEXT"));
When the script is recorded in FF and executed in chrome, it fails at the location because "Next" link is unavailable. This is one example of a link and there are multiple links and multiple pages. For this scenario, do i need to verify the text for each link or is there a universal way i.e. toLowercase method that can help me.
Thanks.
As Kshitij pointed out, you can get this working by using a regular expression as your accessor... but you might also check the Alternatives pulldown in the Controller. Perhaps there's an alternative accessor that is better suited for both browsers.
I think, the question should be how can Sahi identify the element with text by ignoring the case-sensitivity.
Any tool can only record the attributes which is available on the browser at that time.
You can use the following code to achieve the functionality:
_click(_link("/Next/i"));

CSS filter for IE6 standard mode and quirk mode?

Is there any CSS filter can be applied to detect IE6's standard mode and quirk mode?
The story is that a jQuery script is using $.support.boxModel to handle different rendering mode. But the CSS use the *width hack to define the dimension. But this hack can only filter whether the browser is IE but not the real rendering mode IE is on.
You can't do it in css, but you can include different stylesheets for different versions of IE using conditional comments.
Why would you need that? Usually you write a style sheet for one explicit HTML document or at least one specific site where you know whether that page/site is running in quirks or standards mode.
It's not like a page can unexpectedly change modes :-)
If you really need to support a mixture of pages with different modes you'll need to use two separate style sheets, one for each mode.
I ended up using js injection
if(!$.support.boxModel) $('body').addClass('nobox');
And then do the styling in CSS.

Is it possible to provide Code highlighting on sites.google.com websites?

Is it possible to do Code Syntax highlighting on sites.google.com websites like the way we do it on Blogger.com or Wordpress.com?
Unfortunately there is until now no support for syntax highlighting within Google Sites. As a workaround you could use http://tohtml.com/ and enter your code there and copy the colored output (not the HTML) directly into your Google Sites page.
This works perfectly, as long as you don't need to edit large pieces of the code regularly.
I have tried creating a gadget myself with Google Code Prettify, and there were a few issues.
One is that classes aren't supported, so you will have to follow what Stack Overflow is doing to prettify.
http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify
The other problem I faced was the interaction between the iframe and the parent frame. You will notice that there is a domain permission problem, and so you will be unable to access the parent.document from your iframe.
This should save some people a few hours of hacky testing.
Yes, you can!
Just select the desired text, and go to "Formatting" -> "Code" OR "Block Code"
You can insert gadgets into Google Sites pages. You could create a gadget that did syntax highlighting using any number of open source javascript syntax highlighters.
Not an ideal solution but would get you what you want. Lemme know if you want further pointers.
I've found an alternative way.
If you use IntelliJ, just copy the code from the IntelliJ editor and paste it into your Google site text (not in html mode).
Works out-of-the-box!

Resources