Math & ScienceMathType to LaTeX Issue

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
aerodoc
Posts: 9
Joined: Sun Jul 24, 2011 2:05 am

MathType to LaTeX Issue

Post by aerodoc »

Mathtype converted a matrix to latex and this is what it gives me. When I used textworks, it gives me the following error. Any idea?

-------------------------------------------------------------------
! Misplaced alignment tab character &.
l.15 {{A}_{11}} &
{{A}_{12}} & {{A}_{16}} \\
?
Process interrupted by user

-------------------------------------------------------------------

Code: Select all

\documentclass{article}

\begin{document}

\[\left[ \begin{matrix}
   {{N}_{x}}  \\
   {{N}_{y}}  \\
   {{N}_{xy}}  \\
\end{matrix} \right]=\left[ \begin{matrix}
   {{A}_{11}} & {{A}_{12}} & {{A}_{16}}  \\
   {{A}_{12}} & {{A}_{22}} & {{A}_{26}}  \\
   {{A}_{16}} & {{A}_{26}} & {{A}_{66}}  \\
\end{matrix} \right]\left[ \begin{matrix}
   \varepsilon _{x}^{o}  \\
   \varepsilon _{y}^{o}  \\
   \gamma _{xy}^{o}  \\
\end{matrix} \right]\]


\end{document}[*]

Last edited by aerodoc on Mon Jul 25, 2011 9:29 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

aerodoc
Posts: 9
Joined: Sun Jul 24, 2011 2:05 am

MathType to LaTeX Issue

Post by aerodoc »

Well, it looks like this works, as provided by the designer. Not sure what these lines are for, but it needed the 2nd and/or 3rd line.

---------------------------------------------------------------------

Code: Select all

\documentclass{article}
\usepackage{amssymb,amsmath}
\renewcommand{\rmdefault}{ptm}
\begin{document}

\[\left[ \begin{matrix}
{{N}_{x}} \\
{{N}_{y}} \\
{{N}_{xy}} \\
\end{matrix} \right]=\left[ \begin{matrix}
{{A}_{11}} & {{A}_{12}} & {{A}_{16}} \\
{{A}_{12}} & {{A}_{22}} & {{A}_{26}} \\
{{A}_{16}} & {{A}_{26}} & {{A}_{66}} \\
\end{matrix} \right]\left[ \begin{matrix}
\varepsilon _{x}^{o} \\
\varepsilon _{y}^{o} \\
\gamma _{xy}^{o} \\
\end{matrix} \right]\]

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Last edited by aerodoc on Mon Jul 25, 2011 9:28 pm, edited 2 times in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

MathType to LaTeX Issue

Post by localghost »

aerodoc wrote:[.] Not sure what these lines are for, but it needed the 2nd and/or 3rd line. […]
The amsmath package included in the second line provides the »matrix« environment, thus the generated code wouldn't work without the package. The third line switches to another font and is superfluous here.

There is the »bmatrix« which adds brackets automatically and this way shortens your code.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}   % loads »amsmath«

\begin{document}
  \[
    \begin{bmatrix}
      N_x \\
      N_y \\
      N_{xy} \\
    \end{bmatrix}
    =
    \begin{bmatrix}
      A_{11} & A_{12} & A_{16} \\
      A_{12} & A_{22} & A_{26} \\
      A_{16} & A_{26} & A_{66} \\
    \end{bmatrix}
    \begin{bmatrix}
      \varepsilon_x^o \\
      \varepsilon_y^o \\
      \gamma_{xy}^o \\
    \end{bmatrix}
  \]
\end{document}

Thorsten
aerodoc
Posts: 9
Joined: Sun Jul 24, 2011 2:05 am

Re: MathType to LaTeX Issue

Post by aerodoc »

Thanks! Now I just need to figure out this confusing font stuff, but thats another issue.
Post Reply