intellibar / main

IntelliBar is an AI-powered assistant for the Mac.
https://intellibar.app/
34 stars 0 forks source link

Render latex outputs? #34

Open 5183nischal opened 3 months ago

5183nischal commented 3 months ago

Hi! I use intellibar heavily when reading technical papers and many times the output of the model contains math written in latex. It would be amazing to be able to see latex rendered like maybe in latex. More generally, would markdown rendering be possible? Thank you!

astoilkov commented 3 months ago

@5183nischal I'm on it. Can you send me a few example outputs? I'm asking because from my testing it sometimes wraps expressions around \[ ... \], sometimes around \( ... \), and sometimes it doesn't wrap them at all.

Regarding Markdown rendering — we are already doing it. For example, when you see bold or code blocks in the output this is actually Markdown coming from the model that we transform. However, latex is a special case because it doesn't come in Markdown format (which is $ signs around).

5183nischal commented 3 months ago

Here is a sample output:

Mathematically, a random variable (X) with mean (\mu) is said to be sub-Gaussian if there exists a positive constant (\sigma) such that for all (t \in \mathbb{R}), the moment generating function (MGF) of (X-\mu) satisfies the inequality: [ \mathbb{E}[e^{t(X-\mu)}] \leq e^{\frac{\sigma^2 t^2}{2}}. ] This inequality implies that the tails of the distribution of (X) decay at least as fast as those of a Gaussian distribution with variance (\sigma^2). The smallest (\sigma) for which this inequality holds is often called the sub-Gaussian parameter of (X).

As you see it uses [ ... ] for math blocks and ( ) for inline stuff and this is pretty consistent with how people generally use them as well. In my experience, it almost always wraps them in these and sometimes even in \begin{equation} ...\end{equation}

astoilkov commented 3 months ago

Awesome, thanks!