Skip to content

math formulas are not interpreting visually in Copilot Chat, showing in katex or latex format #255243

Description

@ededovic

When I ask a question of Copilot Chat:
write the below as math formula

  # Negative log-likelihood for normal distribution
  nll = -np.sum(-0.5*np.log(2*np.pi*sigma**2) - (y-predicted_y)**2 / (2*sigma**2))

This is the response I get in the vs code:

[ nll = -\sum_{i=1}^{n} \left[ -\frac{1}{2}\log(2\pi\sigma^2) - \frac{(y_i-\hat{y_i})^2}{2\sigma^2} \right] ]

Where:

( n ) is the number of observations.
( \log ) denotes the natural logarithm.
( \pi ) represents the mathematical constant pi.
( \sigma ) is the standard deviation.
( y_i ) represents the actual value for the i-th observation.
( \hat{y_i} ) represents the predicted value for the i-th observation.
The sum is over all ( i ) from 1 to ( n ).

I would be ok with this, notice it is missing i in the \sum as well as some other niceties (I converted the above into notebook markdown by replacing [ ] and ( ) with $ $) :

formula-Screenshot 2024-02-28 211332

Version: 1.87.0 (user setup)
Commit: 019f4d1
Date: 2024-02-27T23:41:44.469Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.22631

Activity

  1. changed the title [-]math formulas not showing up visually[/-] [+]math formulas not showing up visually in Copilot Chat[/+] on Feb 29, 2024
  2. changed the title [-]math formulas not showing up visually in Copilot Chat[/-] [+]math formulas not interpreting k/latex visually in Copilot Chat[/+] on Feb 29, 2024
  3. changed the title [-]math formulas not interpreting k/latex visually in Copilot Chat[/-] [+]math formulas are not interpreting visually in Copilot Chat, showing in katex or latex format[/+] on Feb 29, 2024
  4. howsmadae commented on Jul 13, 2024

    @howsmadae

    Is there any work around for the time being? I rely on copilot to quickly check my formulas for my chemistry class.

  5. hschmiedhofer commented on Aug 2, 2024

    @hschmiedhofer

    Is there any work around for the time being? I rely on copilot to quickly check my formulas for my chemistry class.

    I just told it to render the formula again but replace ( [ ] ) with $ and it worked for me

    Please elaborate a bit, Fremdkoerper .

    I am having no luck with this at all in latest vscode 1.92.o and GitHub Copilot Chat v0.19.2024073102 (pre-release).

    This is the best I can get:

    image

    Problem is, I'd like to use GitHub Copilot for studying Deep Learning, especially since it is now backed by ChatGPT 4. However, without properly rendered formulas it's quite useless.

  6. LinoGoncalves commented on Aug 3, 2024

    @LinoGoncalves

    I'm having the same issues with Latex rending in Github copilot, even in the latest release VS Code (1.92) and Github Copilot Chat (Release: 2024-08-02).

    Example below:

    Prompt_: What is the formula for Sample Standard Deviation?_

    Response:
    _$$ s = \sqrt{\frac{\sum (x_i - \bar{x})^2}{n - 1}} $$

    Where:

    $s$ is the sample standard deviation.
    $x_i$ represents each data point in the sample.
    $\bar{x}$ is the sample mean.
    $n$ is the number of data points in the sample._

    Math notation really needs to display correctly for such as state-of-the-art piece of tech.

  7. sthaber commented on Aug 5, 2024

    @sthaber

    Is there any work around for the time being? I rely on copilot to quickly check my formulas for my chemistry class.

    I just told it to render the formula again but replace ( [ ] ) with $ and it worked for me

    I've just been pasting it into web based LaTeX renderers. Would be nice if it supported it natively. Clearly the model is trained to think the renderer will work.

  8. self-assigned this
    on Aug 29, 2024
  9. added this to the September 2024 milestone on Aug 29, 2024
  10. 47 remaining items

  11. mjbvz commented on Jul 25, 2025

    @mjbvz
    Contributor

    The latest VS Code insider build enables Katex rendering of block and inline math equations

    Image

    To enabled it, just set "chat.math.enabled": true. We include instructions so models should know how to render math when needed. The supported markup is $$...$$ for math blocks and $...$ for inline math equations

    Please give it a try and open new issues for any bugs you run into. I'll keep polishing it next iteration and we'll enable it by default once it is ready

  12. sudg6 commented on Jul 26, 2025

    @sudg6
  13. Shaw-Way commented on Jul 30, 2025

    @Shaw-Way

    The latest VS Code insider build enables Katex rendering of block and inline math equations
    Image

    To enabled it, just set "chat.math.enabled": true. We include instructions so models should know how to render math when needed. The supported markup is $$...$$ for math blocks and $...$ for inline math equations

    Please give it a try and open new issues for any bugs you run into. I'll keep polishing it next iteration and we'll enable it by default once it is ready

    Image Image

    not work for me, what went wrong

  14. mjbvz commented on Jul 30, 2025

    @mjbvz
    Contributor

    Carl Shaw (@Shaw-Way) It's a top level setting, not under GitHub.copilot.advanced. You should see it listed in the settings ui. Also make sure you are using the latest VS Code insiders release

  15. mjbvz commented on Aug 19, 2025

    @mjbvz
    Contributor

    Closing as math is now enabled by default in VS Code insiders. The plan is to ship it enabled by default in the next stable release

    Please keep testing and open issues if you notice any bugs/issues

  16. locked and limited conversation to collaborators on Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions