• GNU/Linux Admin

    You don't need <script> and </script> in the custom JS portion of the page.


  • After I include that script I dont need to refresh page to show the equations. But I still cannot preview equations in PREVIEW panel... Is it possible to do that?

    http://docs.mathjax.org/en/latest/advanced/dynamic.html

    捕获.PNG

  • GNU/Linux Admin

    You can try adding action:composer.preview to the list of events you listen for. I don't know if it'll convert the Mathjax in the preview box, but it is worth a try.


  • @julian said in Mathjax support:

    action:composer.preview

    I tried this:

    $(window).on('action:posts.loaded action:ajaxify.end action:composer.preview', function () {
      MathJax.Hub.Queue(["Typeset", MathJax.Hub, "content"]);
    });
    

    Unfortunately it does not work ..


  • 捕获.JPG

    To those who need Mathjax support on nodebb. Now the dynamic rendering works:

    1. Include this in the header:
    
    <script>
        window.MathJax = {
      tex: {
        inlineMath: [['$','$'], ['\\(','\\)']],
        tags: "ams",
        macros: {
          ra: "{\\rm a}",
          rb: "{\\rm b}",
          rD: "{\\rm D}",
          cell: "{\\rm cell}",
          drag: "{\\rm drag}",
          lift: "{\\rm lift}",
          turb: "{\\rm turb}",
          rd: "{\\rm d}",
          buo: "{\\rm buo}",
          rc: "{\\rm c}",
          rN: "{\\rm N}",
          tr: "{\\rm tr}",
          dev: "{\\rm dev}",
          mag: "{\\rm mag}",
          max: "{\\rm max}",
          min: "{\\rm min}",
          rleft: "{\\rm left}",
          wall: "{\\rm wall}",
          outlet: "{\\rm outlet}",
          inlet: "{\\rm inlet}",
          rright: "{\\rm right}",
          own: "{\\rm own}",
          nei: "{\\rm nei}",
          exp: "{\\rm exp}",
          rq: "{\\rm q}",
          rref: "{\\rm ref}",
          rE: "{\\rm E}",
          bfH: "{\\bf H}",
          dpm: "{\\rm dpm}",
          rT: "{\\rm T}",
          rP: "{\\rm P}",
          rgh: "{\\rm rgh}",
          rL: "{\\rm L}",
          rR: "{\\rm R}",
          Kd: "{\\rm Kd}",
          rr: "{\\rm r}",
          rW: "{\\rm W}",
          bfU: "{\\bf U}",
          bfh: "{\\bf h}",
          bfHbyA: "{\\bf HbyA}",
          bfS: "{\\bf S}",
          bfg: "{\\bf g}",
          bfT: "{\\bf T}",
          bfV: "{\\bf V}",
          bfd: "{\\bf d}",
          bfI: "{\\bf I}",
          bfK: "{\\bf K}",
          bfA: "{\\bf A}",
          bfn: "{\\bf n}",
          bfR: "{\\bf R}",
          bfM: "{\\bf M}",
          bfx: "{\\bf x}",
          bfX: "{\\bf X}",
          bfF: "{\\bf F}",
          bfq: "{\\bf q}",
    	  dt: "{\\Delta t}",
          p: "{\\partial}"    // this macro has an optional parameter that defaults to 'x' \ddx[t]{y}
        },
        autoload: {
          color: [],
          colorV2: ['color'],
    	  verb: ['verb']
        },
        packages: {'[+]': ['verb']}
      },
      options: {
        skipHtmlTags: ["<pre>","<span>","<code>"],
        ignoreHtmlClass: 'tex2jax_ignore',
        processHtmlClass: 'tex2jax_process'
      },
      loader: {
        load: ['[tex]/verb']
      },
      startup: {
        ready: () => {
          MathJax.startup.defaultReady();
          MathJax.startup.promise.then(() => {
            console.log('MathJax initial typesetting complete');
          });
        }
      }
    };
    
    
    (function () {
      var script = document.createElement('script');
      script.src = 'https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js';
      script.async = true;
      document.head.appendChild(script);
    })();
        
        
    </script>
    
    
    
    1. Include the following to Javascript
    $(window).on('action:posts.loaded action:ajaxify.end action:composer.preview', function () {
      MathJax.startup.defaultReady();
          MathJax.startup.promise.then(() => {
            console.log('MathJax initial typesetting complete');
          });
    });
    

  • @sharonyue
    are you able to render $\sqrt{2}$ ?


  • @sharonyue
    Screenshot of the problem :

    Captureoqpqo.PNG


  • @abhinov-singh It works at my site. What did you put in your CSS?

    捕获.JPG


  • @sharonyue
    Can you please tell me the steps for how to use Mathjax on NodeBB
    I will follow that strictly

    Thanks in advance


  • @abhinov-singh Please see it here: https://community.nodebb.org/topic/8278/mathjax-support/16 You simply needs two steps. Please try it and give me a feedback.

Suggested Topics

  • 12
  • 10
  • 1
  • 3
  • 2
| |