Home > Enterprise >  Matlab LATEX problem: Does Matlab simultaneously emply two different LATEX interpteters?
Matlab LATEX problem: Does Matlab simultaneously emply two different LATEX interpteters?

Time:01-10

Answer is a resounding YES unless I am making a mistake. The following string:

$\begin{array}{ccc}' 'a & b & c \ ' 'd & e & f \' 'g & h & i ' '\end{array}$

produces different outputs in the livescript input and output panes as this screenshot shows:

enter image description here

Input pane has apostrophes and output pane does not. I think this is just the bugginess of Matlab with LATEX. Perhaps unsurprising as LATEX support is still evolving. Or maybe I am doing something wrong.

CodePudding user response:

"The best questions are those who answer themselves"

As you may notice, MatLab relies on different interpreters on different figure and text contexts. It is possible to setup interpreters

latex -- Supports the full LATEX markup language.
tex   -- Supports a subset of plain TEX markup language. See the String property for a list of supported TEX instructions.
none  -- Displays literal characters. 

Source: http://matlab.izmiran.ru/help/techdoc/ref/text_props.html

CodePudding user response:

str is a horizontally concatenated character vector, so the actual variable contains

str = '$\begin{array}{ccc}a & b & c \\ d & e & f \\g & h & i \end{array}$'

but when you copy the code you gave ($\begin{array}{ccc}' 'a & b & c \\ ' 'd & e & f \\' 'g & h & i ' '\end{array}$) into the popup under Insert -> Equation you enter single quotes into the string, that are displayed by LaTeX. So MATLAB just does as you tell it to do (if my assumptions of your workflow are correct)

For the future please don't paste screenshots of code, just the code itself in a properly formatted block.

  • Related