How do I fix this generated LaTex code for a matrix?

  • Context: LaTeX 
  • Thread starter Thread starter PainterGuy
  • Start date Start date
  • Tags Tags
    Code Latex Matrix
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
PainterGuy
Messages
938
Reaction score
73
Hi,

I'm using Scientific Workplace to write LaTex and it generates the code shown below for the given matrix. I don't think the generated code is standard LaTex in this particular instance. How can I fix it without making too many modifications? I mean if there is a simple way to fix it. Thank you for your help, in advance!

1618472829295.png


Generated code:
$M_{1}=\left[ \MATRIX{2,2}{c}\VR{,,c,,,}{,,c,,,}{,,,,,}\HR{,,}\CELL{3.0}\CELL{914.\,\allowbreak 5}\CELL{1434.\,\allowbreak 5}\CELL{4.\,\allowbreak 151\,4\times 10^{5}}\right] $

Trying to compile the generated code:
[tex]M_{1}=\left[ \MATRIX{2,2}{c}\VR{,,c,,,}{,,c,,,}{,,,,,}\HR{,,}\CELL{3.0}\CELL{914.\,\allowbreak 5}\CELL{1434.\,\allowbreak 5}\CELL{4.\,\allowbreak 151\,4\times 10^{5}}\right][/tex]Helpful link:
https://www.physicsforums.com/threads/introducing-latex-math-typesetting.8997/
 
Last edited:
Physics news on Phys.org
Yes, it looks like it uses non-standard macros. Probably there is a style or class file somewhere (look for extensions .sty or .cls) that you can load into your ##\LaTeX##-document to ensure these macros work. If you want to use the generated code, it may be best to look into that.

Alternatively, a more standard way of formatting would be
$$
\begin{bmatrix}
3.0& 914.5\\
1434.5& 4.1514 \times 10^5
\end{bmatrix}
$$
To see the code, right click on the above expression, then Show Math As - TeX Commands. If you insist on including the table bars, you could try something like
$$
\left[
\begin{array}{|c|c|}
\hline
3.0& 914.5\\
\hline
1434.5& 4.1514 \times 10^5\\
\hline
\end{array}
\right]
$$
 
Last edited:
Reply
  • Like
Likes   Reactions: PainterGuy and FactChecker