We all know that code is meant to be read, and comments should be clear and concise. A problem with text editors is that, while they are perfect for writing and displaying code, they do a pretty poor job with comments. Comments shouldn’t be restricted to the rigid rules of all the rest of the code, as they are (usually) completely ignored by any parser.

If you are working in a math heavy field, you have experienced at least once the frustrating feeling of not being able to comment your code by using a simple, straightforward formula. I mean, you can, but… how should you write it?

W_i = V_i - sum (V_i * W_j * W_j / ||W_j||^2) from j=1 to i-1

Or, maybe:

W_i = V_i - (V_i * W_1 * W_1 / ||W_1||^2) - ... - (V_i * W_i-1 * W_i-1 / ||W_i-1||^2)

That quickly gets messy and difficult to understand. What about this, instead?

Notepadqq 1.4 introduces a Math Rendering mode that can be used to do just that: insert math formulas within comments by using the well-known TeX syntax.

You can enable it via the “View -> Math Rendering” menu.

## How to use it

First, enable Math Rendering from the View menu. Then start a comment in your favourite programming language and write your formula within dollar markers, like this: `$ formula $`

. It’s as simple as that.

You can also use two dollar markers, as in `$$ formula $$`

, in order to allow the editor to vertically expand the line if needed.

Take a look here for a good reference of the syntax we support: https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference