markdown

How to insert math symbols in pseudocode in Markdown?


I want to use pseudocode in markdown. And there are some math symbols, can I insert math symbols in Markdown?

I know I can use the ``` to make a code block and choose a similar code language to show the pseudocode, but that can't show the math symbol . And I know how to use the math block, but the code can't be showed clearly.

Do you have some methods to use mathematical notation, primarily set notation, in a code block?


Solution

  • Your best bet is probably to use Unicode characters, e.g.

    for { x ∈ ℤ | 10 ≤ x < 20 } do
       ...
    end
    

    or

    Z = X ∩ Y
    

    You can copy and paste them from the web, or use something like a compose key or a Windows Alt code. The mathematical operators range is likely a good place to start.