LaTeX matrix when publishing

Hello,
I'm trying to publish some latex, and for some reason it is not accepting my matrix. I have tested on another site and it seems to work, but I am wondering if the syntax for matlab latex is different from other places
% $$ \vec {x} = \begin {bmatrix} T-T_{s} \\ C_{A} - C_{As} \\ C_{P} - C_{Ps} \end
% {bmatrix} $$
Is not making a matrix for me. What is wrong?
This is the output on the published file
Error updating Text.
String must have valid interpreter syntax:
$$ \vec {x} = \begin {bmatrix} T-T_{s} \\ C_{A} - C_{As} \\ C_{P} - C_{Ps} \end {bmatrix}

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Sept. de 2015

1 voto

bmatrix is part of amsmath but you cannot (at all easily) load the ams* packages.

5 comentarios

Rick
Rick el 10 de Sept. de 2015
I don't care necessarily if it's a bmatrix, just any way I can get a matrix to show up in latex?
Yes, see for example
str = '$\begin{array}{ccc}a & b & c \\ d & e & f \\g & h & i \end{array}$';
text(0.5,0.5,str, 'Interpreter', 'latex')
For the purpose of publish try
% $\begin{array}{ccc}a & b & c \\ d & e & f \\g & h & i \end{array}$
It might matter that everything is on one line: I do not know enough about publish for that. Also perhaps you need $$ for publish instead of just $ -- I have not used publish myself.
Andy Meecham
Andy Meecham el 19 de Sept. de 2015
Editada: Andy Meecham el 19 de Sept. de 2015

Just had the very same issue! Strangely enough the

pmatrix

Call works just fine. If I use the following:

%%
% 
% $$\hat{\mathbf{x}}_k = \pmatrix{x \cr
%                                 y \cr
%                                 \dot{x} \cr
%                                 \dot{y} \cr}$$

then I get a nicely formatted vector, but with parentheses. If I use

'bmatrix' 

I get the same error you report. In the end I decided that I'd just have to live with parentheses rather than try and use some extreme TeX-Fu. Hope this helps.

Walter Roberson
Walter Roberson el 19 de Sept. de 2015
pmatrix is part of the mathtools package, but bmatrix is part of the amsmath package.
Pedro Pedrosa
Pedro Pedrosa el 10 de Mayo de 2019
If you want square braces use \matrix{} enclosed with \left[ \right].

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 9 de Sept. de 2015

Comentada:

el 10 de Mayo de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by