#SELINAP.COM » Feed SELINAP.COM » Comments Feed SELINAP.COM Ping your blog to technorati Dr.Web CureIT! free and portable virus removal How to store functions in a dictionary in Python SELINAP.COM To leave furtively and stealthily. * Home * All Articles * About * Contact Browse: Home / LaTeX / How to create a matrix in LaTeX How to create a matrix in LaTeX By Selinap on May 18, 2009 IFRAME: http://api.tweetmeme.com/button.js?url=http%3A%2F%2Fselinap.com%2F2009% 2F05%2Fhow-to-create-a-matrix-in-latex%2F&service=bit.ly&style=compact style="border:none; overflow:hidden; width:90px; height:29px"> IFRAME: http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fselinap.com% 2F2009%2F05%2Fhow-to-create-a-matrix-in-latex%2F&layout=button_count&sh ow_faces=false&width=450&action=like&colorscheme=light style="border:none; overflow:hidden; width:90px; height:29px"> IFRAME: http://www.stumbleupon.com/badge/embed/1/?url=http%3A%2F%2Fselinap.com% 2F2009%2F05%2Fhow-to-create-a-matrix-in-latex%2F We can create a matrix in LaTeX using the array environment, or simplematrix, matrix, pmatrix, bmatrix, vmatrix, and Vmatrix environments via amsmath package. This article provides some examples on how to create a matrix in LaTeX. Creating a matrix with array Here are some examples. 1. unbracketed matrix m1 \[ M = \begin{array}{cc} x & y \\ z & w \\ \end{array} \] 2. matrix surrounded by square brackets m2 \[ M = \left[ {\begin{array}{cc} x & y \\ z & w \\ \end{array} } \right] \] 3. matrix surrounded by parentheses m3 \[ M = \left( {\begin{array}{cc} x & y \\ z & w \\ \end{array} } \right) \] 4. matrix surrounded by single vertical lines m4 \[ M = \left| {\begin{array}{cc} x & y \\ z & w \\ \end{array} } \right| \] Using amsmath package Call \usepackage{amsmath} in the preamble, after \documentclass{}. The amsmath package environment for matrix: 1. smallmatrix: inline matrix m5 $M = \begin{smallmatrix} x&y\\ z&w \end{smallmatrix}$ $M = \left( \begin{smallmatrix} x&y\\ z&w \end{smallmatrix}\right)$ 2. matrix: unbracketed matrix m6 $M = \begin{matrix} x&y\\ z&w \end{matrix}$ 3. pmatrix: matrix surrounded by parentheses m7 $M = \begin{pmatrix} x&y\\ z&w \end{pmatrix}$ 4. bmatrix: matrix surrounded by square brackets m8 $M = \begin{bmatrix} x&y\\ z&w \end{bmatrix}$ 5. vmatrix: matrix surrounded by single vertical lines m9 $M = \begin{vmatrix} x&y\\ z&w \end{vmatrix}$ 6. Vmatrix: matrix surrounded by double vertical lines m10 $M = \begin{Vmatrix} x&y\\ z&w \end{Vmatrix}$ Related * Insert source code with syntax highlighting in LaTeX * How to set the margins of a page in LaTeX * Multiple column layout in LaTeX * LaTeX editor with live preview pane for Ubuntu/Linux * LaTeX Binary Operators Symbols Posted in LaTeX | Tagged amsmath, array, bmatrix, documentclass, environment, LaTeX, matrix, package, pmatrix, simplematrix, usepackage, vmatrix | 5 Responses 5 responses to “How to create a matrix in LaTeX” 1. ufw ufw January 10, 2010 at 10:06 pm | Permalink | Reply Awesome, thanks a lot! 2. lmods lmods April 27, 2010 at 11:08 am | Permalink | Reply gracias me ha servido de mucho… thanks 3. jeanounou jeanounou August 24, 2010 at 7:36 am | Permalink | Reply How about a border matrix? How can I write a circle around a letter, like in “copyright” or “registered trademark”? Is it possible to have a circle around all letters (not only C and R)? Thanks. 1. Selinap Selinap August 24, 2010 at 8:02 am | Permalink | Reply @jeanounou: You can use TikZ (http://en.wikipedia.org/wiki/PGF/TikZ) to put a letter in a circle. For example (adapted from here): \documentclass{article} \usepackage{tikz} \newcommand*\circleit[1]{% \tikz[baseline=(C.base)]\node[draw,circle,inner sep=0.7pt](C) {#1};\! } \begin{document} The letter A in a circle: $\circleit{A}$ \end{document} 4. Dafe Dafe October 26, 2010 at 1:19 pm | Permalink | Reply That’s very helpful, thank you. Leave a Reply Click here to cancel reply. Name * ________________________________________ Email * ________________________________________ Website ________________________________________ Comment ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ ____________________________________________________________ Submit [_] Notify me of follow up comments via e-mail. « Previous Next » Subscribe. Enter your email: ____________________ Subscribe me! Advertisement © 2008 - 2010 SELINAP.COM. Web Hosting. Traffic Stats Number of visitors online stats