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
Click For Summary
SUMMARY

The forum discussion addresses issues with non-standard LaTeX code generated by Scientific Workplace for matrix representation. The generated code utilizes non-standard macros, which may require specific style or class files (.sty or .cls) to compile correctly. A recommended standard format for the matrix is provided, using the bmatrix and array environments to ensure compatibility with LaTeX. Users are advised to explore the provided alternatives for proper formatting.

PREREQUISITES
  • Familiarity with LaTeX syntax and environments
  • Understanding of matrix representation in LaTeX
  • Knowledge of LaTeX style and class files (.sty, .cls)
  • Experience with Scientific Workplace software
NEXT STEPS
  • Research how to create and use custom LaTeX style files (.sty)
  • Learn about the bmatrix and array environments in LaTeX
  • Explore the use of the \hline command for table formatting in LaTeX
  • Investigate troubleshooting techniques for LaTeX compilation errors
USEFUL FOR

This discussion is beneficial for LaTeX users, particularly those using Scientific Workplace, who need to format matrices correctly and troubleshoot generated code issues.

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:
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]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:
  • Like
Likes   Reactions: PainterGuy and FactChecker

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 15 ·
Replies
15
Views
25K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
5
Views
8K
Replies
7
Views
3K
  • · Replies 766 ·
26
Replies
766
Views
743K