Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display mathematics symbols in Typora

Tags:

markdown

I read the leetcode's official solution to reverse an integer

Upon copying the following to my markdown notes

enter image description here

but got

enter image description here

I use typora which is usually powerful.

Why the contents failed to display as it is on the website?

like image 746
Alice Avatar asked Mar 05 '23 06:03

Alice


1 Answers

The text you're copying contains katex, which isn't supported by Typora. So you should use Latex syntax to render Mathematics expressions.

In typora, you could just press $$ and Return key to input a math block. But in your case, you need inline math. Press command/ctrl + , and make sure inline math is checked.

screenshot image

To use inline math, put your content between $. For example $f(x)=x_{1}^{2}+x_{2}^{2}$ results

screenshot image

If you write following in Typora

To explain, lets assume that $\text{rev}$ is positive.

1. If $temp=rev\cdot10+pop$ causes overflow, then it must be that $rev\geq\frac{INTMAX}{10}$
2. If $rev>\frac{INTMAX}{10}$, then $temp=rev\cdot10+pop$ is guaranteed to overflow.
3. If $rev==\frac{INTMAX}{10}$, then $temp=rev\cdot10+pop$ will overflow if and only if $pop>7$

Similar logic can be applied when $\text{rev}$ is negative.

It looks like,

screenshot

Here \cdot results multiplication dot (), \geq results and \frac{}{} results fractions.

See all the Latex Math Symbols and difference between dot characters.

like image 76
itsmysterybox Avatar answered Apr 10 '23 08:04

itsmysterybox