Skip to content

Instantly share code, notes, and snippets.

@laughinghan
Last active February 23, 2017 02:23
Show Gist options
  • Save laughinghan/52f8a143654359c01bbc9c6e5c139bb1 to your computer and use it in GitHub Desktop.
Save laughinghan/52f8a143654359c01bbc9c6e5c139bb1 to your computer and use it in GitHub Desktop.
Dump of all LaTeX commands supported by latest master

Dump of all LaTeX commands supported by latest master (50daba7).

First apply this patch to src/publicapi.js:

diff --git a/src/publicapi.js b/src/publicapi.js
index 84b13db..9eef76e 100644
--- a/src/publicapi.js
+++ b/src/publicapi.js
@@ -79,6 +79,7 @@ function getInterface(v) {
   MQ.L = L;
   MQ.R = R;
   MQ.saneKeyboardEvents = saneKeyboardEvents;
+  MQ.LatexCommands = LatexCmds;
 
   function config(currentOptions, newOptions) {
     if (newOptions && newOptions.handlers) {

Then in the Console on /test/demo.html on the master branch:

var dump = {};
Object.keys(MQ.LatexCommands).forEach(function(key) {
  var cmd = MQ.LatexCommands[key](key), ctrlSeq = cmd.ctrlSeq;
  if (!cmd.htmlTemplate) return;
  if (!dump[ctrlSeq]) {
    if (cmd.createBlocks) cmd.createBlocks();
    cmd.jQize();
    cmd.jQ.find('*').andSelf().attr({'mathquill-command-id': null, 'mathquill-block-id': null});
    dump[ctrlSeq] = {
      ch: cmd.jQ[0].textContent,
      tagName: cmd.jQ[0].tagName,
      className: cmd.jQ[0].className,
      html: cmd.jQ[0].outerHTML
    };
  }
  if ('\\'+key+' ' !== ctrlSeq) {
    if (!dump[ctrlSeq].aliases) dump[ctrlSeq].aliases = [];
    dump[ctrlSeq].aliases.push(key);
  }
});
JSON.stringify(dump, null, 2)

DUMP OUT, FLAWLESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment