What LaTeX packages can be compiled in CL?

I’m trying to write a piecewise-defined function in LaTeX. I want this LaTeX to be compiled in the content sink of a Note component. The standard way of doing this is something like:

f(x)=\begin{cases}5-x,&x<3\\-1+\frac{1}{2}x,&x\ge3\end{cases}

When I make (what I think are) the necessary adjustments for CL script, the function shows up blank when I preview the activity.

Am I doing something wrong, or is the cases environment not supported in CL? Is there some documentation of the packages available for compiling in CL?

Furthermore, it’s not entirely clear to me when CL requires an extra backslash in LaTeX and when it doesn’t. Should I always add an extra backslash? What if the LaTeX code requires two successive backslashes? How many extra backslashes should be added in this case?

You can copy an equation from the graph area and paste into CL. It pastes as Latex.

Thanks for your response, but unless I’m missing something, I don’t think this method solves my problem. From what I understand, piecewise functions in the calculator are not defined using the cases environment in LaTeX. When I copy and paste a piecewise function from the calculator into CL, it doesn’t copy using cases.

Sorry, that was just a guess. Will wait to see what others say :slight_smile:

We process Latex using a library called mathquill, which is basically something that behaves a lot like LaTeX, not the LaTeX software itself, so it doesn’t support packages. Playing around in the calculator is a good way to see what’s supported, but the set of packages supported is pretty limited (e.g. there’s no support for the cases environment currently). I don’t believe that we have explicit documentation of all supported commands.

As far as the back-slashes, that comes from CL, not from LaTeX directly. Backslash in a CL string means “take the next character exactly as it is, don’t use it to end the string, or start an interpolation, or anything else”. Because we want the slashes to go directly through to LaTeX, instead of being used to change how CL interprets the string, “\” in a CL string is the way to write “”. If you would need two successive slashes in latex, then you would need four in CL, although I hope that shouldn’t come up often…

1 Like

So you don’t plan to use the coding to accomplish anything in the graph, you just want the code to appear as it normally would within the note area?
So the main issue I’m seeing is how do you get CL to “take” the extra large curly brace and two rows afterwards"?

Thanks! This is very clear and helpful.

Yeah, that’s exactly right. From eric’s response, it seems that CL won’t “take” the cases environment.

wondering if you could place the equation as an image inside the graph as a work-around?

Or use multiple lines like this:
f(x)={ line 1
{ line 2

Just a few thoughts.