Published on

New Post in NextJS blog

Authors
  • avatar
    Name
    brbr
    Twitter

Introduction

aParsing and display of math equations is included in this blog template. Parsing of math is enabled by remark-math and rehype-katex. KaTeX and its associated font is included in _document.js so feel free to use it on any page. 1

Inline math symbols can be included by enclosing the term between the $ symbol.

Math code blocks are denoted by $$.

Inline Highlighting

Sample of inline highlighting sum = parseInt(num1) + parseInt(num2)

Code Blocks

Some Javascript code

var num1, num2, sum
num1 = prompt('Enter first number')
num2 = prompt('Enter second number')
sum = parseInt(num1) + parseInt(num2) // "+" means "add"
alert('Sum = ' + sum) // "+" means combine into a string

Some Python code 🐍

def fib():
    a, b = 0, 1
    while True:            # First iteration:
        yield a            # yield 0 to start with and then
        a, b = b, a + b    # a will now be 1, and b will also be 1, (0 + 1)

for index, fibonacci_number in zip(range(10), fib()):
     print('{i:3}: {f:3}'.format(i=index, f=fibonacci_number))

Hello Alice

I love using Next.js

Hello1

Footnotes

  1. For the full list of supported TeX functions, check out the KaTeX documentation