LaTeX forum ⇒ LyXCreating an Augmented matrix? Topic is solved

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Posts: 2
Joined: Thu Jan 17, 2013 11:30 am

Creating an Augmented matrix?

Postby turkish » Thu Jan 17, 2013 12:03 pm


How do I create an augmented matrix in LyX? That is, a set of cells on the left and right separated by a | (vertical line).

I did a Google search, searched the manual and searched on this forum, but the best solution I could find says right click an adjacent cell and then click 'insert line left' or 'right'. When I do that I only get the options 'insert line above' and 'below' (which works nicely, but I don't need it there :P).

I'm wondering if there is a module for this that I don't installed.

Any ideas?

Thanks and regards.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8865
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Jan 17, 2013 12:26 pm


welcome to the board!

If you use only LyX tools, you could use an array (like tabular) instead of a matrix. Internally matrices are array too. With an array you can use vertical lines.

If you would use LaTeX in LyX, the matrix environment could be extended. I write about this some time ago on my blog: An extension to amsmath matrix environments.

In LyX it can be done by adding to the document preamble:

  1. \makeatletter
  2. \renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  3. \hskip -\arraycolsep
  4. \let\@ifnextchar\new@ifnextchar
  5. \array{#1}}
  6. \makeatother

Later you can use matrices with LaTeX (!) syntax, also in LyX (ERT):

  1. \begin{pmatrix}[cc|c]
  2. 1 & 2 & 3\\
  3. 4 & 5 & 9
  4. \end{pmatrix}

matrix1.png (1.86 KiB) Viewed 14335 times

Even more sophisticated, with color, adjusted spacing, bold font, right alignment:

  1. \begin{bmatrix}[*2cr@{\quad}|@{\quad}>{\bf\color{red}}r]
  2. a & b & 1 & 4 \\
  3. c & d & -2 & -3
  4. \end{bmatrix}

matrix2.png (1.89 KiB) Viewed 14335 times

You see you can use complex array column specifications.

Site admin

Posts: 2
Joined: Thu Jan 17, 2013 11:30 am

Postby turkish » Thu Jan 17, 2013 12:38 pm


You are a legend. Thank you for the quick reply.

I'm a little intimidated by ERT so I prefer the LyX tools (one of the reasons it's so great IMO).

I inserted an array instead, as you suggested, and the insert left/right line option is now visible. I created the following in about 10 seconds.

augmented_matrix.PNG (6.65 KiB) Viewed 14333 times

Exactly what I wanted. Thanks a bunch :)


Posts: 1
Joined: Sat Apr 12, 2014 2:06 am

Postby gry » Sat Apr 12, 2014 2:36 am

You haven't actually told me what you used to insert a vertical bar into an array.

User avatar
Site Moderator
Posts: 3756
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Apr 12, 2014 11:12 am

The vertical bar is represented by the vertical line (|, pipe symbol) in the argument of the matrix?
If this was not what you wanted to know, i guess you need to be a little clearer about what you are asking.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Posts: 1
Joined: Tue May 30, 2017 7:11 pm

Postby cm1971 » Tue May 30, 2017 7:18 pm

1. How to run Latex code on LYX?
2. I use array on LYX to create an augmented matrix but I coud not insert the vertical line that separated the entries on the left and the right?
any help?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8865
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Jun 01, 2017 2:27 pm

LaTeX code can be embedded in LyX via "ERT" that means Evil Red Text.

If you would like to let us help to to fix or to improve your code, please post your code.

Site admin

Return to “LyX”

Who is online

Users browsing this forum: No registered users and 4 guests