# CL now understands latex type!

Hey all!

CL now differentiates between regular-ol’ strings and strings that are meant to be math!

• you can define latex literals by using the  character, like
latex = \sin x
• appropriate sources produce latex: expressionInput.latex, cellContent, …etc
• latex is automatically rendered as math when you interpolate it into user-visible text. See this example.
• this is all done in a backwards-compatible way, so strings & latex are interchangeable.

This was a big change with not too much visible difference, for now, but in the future we can leverage this new type to improve CL in various ways.

6 Likes

So does this mean simpleFunction( is no longer needed to convert, for example, a string that student types into a math input into something that for a graph component can display?

A latex string is different than the output of simpleFunction (a function object). Latex strings can be functions, but they could also be arbitrary expressions… x + y + z < 3.

So you still need to use simpleFunction(latex) to try and interpret the latex as a function.

Can we get a more complete implementation of latex? I need limits matrices, arrows, overlines etc.

6 Likes

Sorry, but I’m lost here on what this change really means, or how to use it. I am sure it is very cool but I am not sure how I can learn more about it. Suggestions?

I think I found where to look for more info! Maybe never mind for now

I keep making this same request (to expand the LaTeX characters available) every couple of months. I feel embarrassed trying to write limits and matrix expressions that are native to Mathquill (Desmos’s typesetting engine) but that Desmos has deliberately disabled (because the calculator doesn’t evaluate those limits).

2 Likes

I didn’t realise matrices were an option in Mathquill. I have been using \binom and spaces to make 2x1 and 2x2 matrices but they look pretty amateurish.

Just to clear up some issues here about Mathquill and Desmos:

1. Desmos has a Matrix calculator so there would seem to be no particular reason it can’t render them in Activities, except that they’re disabled.

Limits though are a different story.

1. Mathquill does support Limits(and so does Desmos) but they’re rendered in what is known as \textstyle format rather than \displaystyle format, which basically means adjacent subscript style rather than underscript style(which is what we all want).
There is an unresolved issue on the Mathquill Github page about this exact behaviour, so until that is addressed, it’s not likely Desmos can do anything.

I can’t get limits to display in textstyle. No variant of \lim, \\lim, \mathoperator{lim} etc. will display a limit. Desmos just reads it as “lim” instead of “\lim”.

I’d love to hear that I’m wrong and you know of a way to get limits to display as math.

Hey Serge,

You’re right, Desmos doesn’t render the lim operator entirely correctly, however it does obey some aspects of what we need. For example:

lim_{x→\pi}\ \left(\frac{\cos\left(x\right)+\sin\left(2x\right)+1}{x^{2}-\pi^{2}}\right)`

Renders as:

It’s a clumsy look to be sure, but you get your limit without too much in the way of meaning.

Incidentally the Github issue is here, for anyone interested in where this rests with Mathquill:

2 Likes

Hi Mike –

Dumb question, but how do you type lim_{x→\pi}? I’ve tried \lim_{x \to \pi} (enclosed with ) but to no avail…

Hi Dave,

Not a dumb question at all. You’d like - we’d all like - for the usual latex syntax to work in Desmos but it often doesn’t. In my experience the best option is almost always to use html entities for representation.

In this case, for a right arrow, you really want to use: &rarr; which even here in the forum encodes directly to: →

All this stuff is kinda hacky. There really should be a more Latex-consistent way of doing this. I’m just lucky that I really love front end development and am familiar with some of these other ways of rendering things on the web. So not a dumb question at all.

Thanks Mike! Much appreciated.

1 Like

Is there somewhere to find a reference chart of how to type things in properly? I think that would be very helpful for the less experienced like me! (Limits, over bars, angles, matrices, summation, etc.)b

I am SO EXCITED about the new features we are seeing! I would also LOVE to see better Latex function for limits. I am not well-versed on these terms, Mathquill and \textstyle and what all of that means, but I figured out just enough Latex to get limits to display how I want in other environments, but I SO DISLIKE the way it can be done on Desmos that I have literally resorted to using images instead for every.single.limit.expression… super tedious!! But I am much happier with how it looks. Would LOVE to see a fix for this!

1 Like

Can anyone answer Carla’s question? I would like to see the same thing. I am very new to CL and would like to learn more but don’t even know where to start.

So Latex is pretty much just a markup language for documents, and very handy for mathy sorts of notation things as it has many use cases built in.

You can get the Latex you want from Desmos itself just be copy and pasting from a Desmos graph, like so:

y\ =\ \sum_{n=0}^{a}\frac{\left(-1\right)^{n}x^{\left(2n+1\right)}}{\left(2n+1\right)!}

Is something I copy-pasta’d from this graph

But for getting familiar with other ways of writing stuff - and especially for things Desmos cares not to support in their graphs at the moment - there are many great sources out there. You’ll find lots of things just by googling, but Overleaf tends to be a good resource, such as for example this page.

Just be aware that there are many different Latex packages and versions out there that may or may not be compatible with Mathquill or what Desmos supports.

I frequently google “Latex code {description of what I’m trying to do}”. I also find this site helpful to test things:
https://www.latex-tutorial.com/tools/sandbox/

1 Like

I get a lot of good beginner latex from the EquatIO app for Chrome. They have one for windows, but the Chrome version can add equations directly to Google Docs. Also, Debbie in this chain of emails has a good source.

1 Like