1 minute read

For inputting formulas on the Github

For an in-line formula

  1. Modify _config.yml as below.
# Conversion
markdown: kramdown
highlighter: rouge
lsi: false
excerpt_separator: "\n\n"
incremental: false

  1. Include mathjax_support.html in the _inlcudes folder.
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    TeX: {
      equationNumbers: {
        autoNumber: "AMS"
      }
    },
    tex2jax: {
    inlineMath: [ ['$', '$'] ],
    displayMath: [ ['$$', '$$'] ],
    processEscapes: true,
  }
});
MathJax.Hub.Register.MessageHook("Math Processing Error",function (message) {
	  alert("Math Processing Error: "+message[1]);
	});
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
	  alert("Math Processing Error: "+message[1]);
	});
</script>
<script type="text/javascript" async
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
  1. Insert codes like below, on the layout/default.html ```html
For inputting formulas on the Github - Jaehoon9201’s blog


4. When postings, insert <mark style='background-color: #f1f8ff'>use_math: true</mark> 
```html
---
title:  'log 와 ln'
categories:
  - Math
tags: [Math]
use_math: true
---

it makes github work & -- &.

For an display a formula

In fact, above setting is enough to insert formulas ‘in-line’ or ‘display’ way.

But strangely, i couldn’t ‘display’ way using && -- &&

So, I did below setting additionally.

  1. Include Mathjax.html in the _inlcudes folder.
<script type="text/javascript">
  window.MathJax = {
    tex: {
      packages: ['base', 'ams']
    },
    loader: {
      load: ['ui/menu', '[tex]/ams']
    },
    startup: {
      ready() {
        MathJax.startup.defaultReady();
        const Macro = MathJax._.input.tex.Symbol.Macro;
        const MapHandler = MathJax._.input.tex.MapHandler.MapHandler;
        const Array = MathJax._.input.tex.ams.AmsMethods.default.Array;
        const env = new Macro('psmallmatrix', Array, [null, '(', ')', 'c', '.333em', '.2em', 'S', 1]);
        MapHandler.getMap('AMSmath-environment').add('psmallmatrix', env);
      }
    }
  };
</script>
<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
  1. Include below code in the _layouts/default.html folder.
    <script type="text/javascript">
  window.MathJax = {
    tex: {
      packages: ['base', 'ams']
    },
    loader: {
      load: ['ui/menu', '[tex]/ams']
    },
    startup: {
      ready() {
        MathJax.startup.defaultReady();
        const Macro = MathJax._.input.tex.Symbol.Macro;
        const MapHandler = MathJax._.input.tex.MapHandler.MapHandler;
        const Array = MathJax._.input.tex.ams.AmsMethods.default.Array;
        const env = new Macro('psmallmatrix', Array, [null, '(', ')', 'c', '.333em', '.2em', 'S', 1]);
        MapHandler.getMap('AMSmath-environment').add('psmallmatrix', env);
      }
    }
  };
</script>
<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>

Then, it makes also github work && -- && .

Tags:

Categories:

Updated: