Clear Filters
Clear Filters

Can LaTeX commands be embedded in LiveScripts?

2 views (last 30 days)
Is there a way to add LaTex code into a LiveScript that gets exported as written? E.g.,
\begin{description}
or
\hspace{1cm}
etc.
I could imagine implementing this under the Insert tab adding a LaTeX option to Code Example. But is there another way?
Thanks!!

Answers (1)

Walter Roberson
Walter Roberson on 13 Aug 2023
It depends what you mean by "exported"
If you happen to mean that you want it sent to Report Generator, then my understanding is that you can do that.
If you happen to mean that you want the raw text to be displayed on the screen, then Yes, you can do that.
If you happen to mean that you want to generate latex at run-time, and you want to have the rendered latex displayed in LiveScript, then there is no support for that. The closest you would get to that is that there is some internal support for displaying MathML -- but I have been unable to get anything to display on demand (at most I have been able to put in a breakpoint and modify the MathML of an expression so that the modified version is displayed, but I have never been able to trigger a display myself.)
If you were able to inject latex in LiveScript, you would only be able to affect one single expression, with no ability to affect blocks such as your \begin{description} would want to do. For that kind of work, you need Report Generator.
  2 Comments
Brian Rasnow
Brian Rasnow on 13 Aug 2023
Sorry to be unclear. When I export the LiveScript to Latex and open/run the resulting .tex file, I want the embedded Latex code to be active. Now I put Latex code in the .mlx file, Export to Latex adds a \begin{verbatim} ... \end{verbatim} block around it, also escapes the backslashes, ... requiring a lot of editing of the .tex file to achieve what I need. If I could specify in the LiveScript a block is Latex code so Export to Latex just copied the block literally, then I wouldn't have to make major tweaks all around the .tex file, and all the power of Latex would be accessible (without live view is fine for me, although that would be icing on the cake).
Walter Roberson
Walter Roberson on 13 Aug 2023
As far as I know there is no support for that other than what can be done with Report Generator

Sign in to comment.

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!