Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've just started writing in latex to expose math problems to a forum.
I am trying to display a matrix:

\[
\begin{align*}
 \begin{matrix}
  1 & -9 & 3 \\
  1 & 2 & -2 \\
  -2 & 1 & 1
 \end{matrix}
\end{align*}
\]

But I get this:

Matrix

There's 1b1 and there's not the last element that I'm trying to display, why?

share|improve this question
    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 19 '12 at 2:23
    
Your use of the word "forum" suggests that this is to do with entering LaTeX-like mathematics on a website which then converts it to some sort of HTML/XHTML that a browser can understand. It is, in my experience, highly unlikely that this is actually TeX doing the conversion and more likely to be some sort of javascript. If so, it is possible that this question will be off-topic here as TeX isn't actually used. Can you provide a little more information as to the conversion that the forum uses? –  Andrew Stacey Nov 19 '12 at 10:28
    
Truly I don't know what conversion does the forum use.It just says that we shall use the latex tags and to search a guide online.This is the forum: mymathforum.com/viewforum.php?f=20 –  Ramy Al Zuhouri Nov 19 '12 at 14:49
add comment

migrated from stackoverflow.com Nov 19 '12 at 2:19

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 1 down vote accepted

As @Peter Grill mentioned, \[ already starts math mode, so you don't need align*. If you need square brackets as delimiters you can use \left[ and \right] commands or predefined environment bmatrix.

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

%
% Option #1
%
\[ \left[
\begin{matrix}
  1 & -9 & 3 \\
  1 & 2 & -2 \\
  -2 & 1 & 1
\end{matrix}
\right] \]

%
% Option #2
%
\[ 
\begin{bmatrix}
  1 & -9 & 3 \\
  1 & 2 & -2 \\
  -2 & 1 & 1 
\end{bmatrix}
\]

\end{document}

Both approaches give the same result:

enter image description here

share|improve this answer
    
So maybe it's the forum that somehow doesn't recognize this syntax. There is the latex tag, but if I copy and paste this code it doesn't work, this is what I get: img850.imageshack.us/img850/3136/screenshot20121119at125.png –  Ramy Al Zuhouri Nov 18 '12 at 23:55
    
I checked copy & paste right now on my side - everything is ok. It seems that you have additional software dealing with buffer and/or shortcuts and/or keyboard layouts? –  redmode Nov 19 '12 at 11:52
    
@RamyAlZuhouri: the forum doesn't do syntax, it merely reports tags to the readers. fwiw, i also cut-and-pasted redmode's sample, and it worked for me. it looks as if you are pasting into an smart editor of some sort, and it's confused by the sample. (i typically simply process these examples by copying to a file and processing that from the command line.) –  wasteofspace Nov 19 '12 at 11:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.