Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>CommenTeXNew to Visual Studio Code? Get it now.
CommenTeX

CommenTeX

Preview

willhampshire

|
1 install
| (0) | Free
Doc string TeX rendering
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CommenTeX

VERSION ALPHA 0.1

Render LaTeX equations inside docstrings, on a new line.

example

Example

def intensity_malus_law(theta: ThetaArray, A: float, B: float, C: float
                        ) -> IntensityArray:
    r"""Malus' Law.

    $$ I(\theta) = A \sin^2{(\theta - C)} + B $$
    #   --- equation will render here on new line, indented by 4 spaces ---

    Args:
        theta (ThetaArray): array of angles [rad] of the polariser, 
            relative to known crossed polariser
        A (float): fitting constant, multiplier term
        B (float): fitting constant, offset

    Returns:
        IntensityArray: Array of intensity float values
    """

The default render colour is white (dark mode most common).

Change text colour

In your project directory, create .vscode/settings.json file, and paste/append:

{
    "commentex.colour": "#ff05ff"
}

e.g. pure white #ffffff, black #000000. Recommend using a weakened colour, such as very light grey when in dark mode.

Re-render equation by clicking cursor inside the equation and then click off. Equation should have the new hex colour.

Description

Places SVG overlays of rendered LaTeX equations onto the page.

Note raw strings should be used to avoid Python interpreting escape characters. Auto equation indent is 4 spaces and can be moved by adding more spaces to the line the equation sits on.

Based on VSCode web-like extension framework, developed using TypeScript.

Alpha (first working) version so expect plenty of bugs. Contributions welcome. Open source (in principle).

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft