0

This question already has an answer here:

I am very new to LaTeX so please bear with me if my question is rudimentary. I searched through other questions and while this question has been answered the solutions provided did not work for me, the solutions specifically at What's the best way make an "augmented" coefficient matrix? did not work in iBook Author. This question is how to make an augmented matrix in iBook Author which has minimal support for LaTeX. I am working in iBook Author and am trying to add an augmented matrix. I can get the matrix to display but not the horizontal line. The use of "array" has not worked for me as it is not supported by iBook Author. In iBook Author, there is no need to enter \documentclass, \begin{document}, etc. which is why it is not included in my example.

This is what I use to get the matrix but I need it to be an augmented matrix with a continuous vertical line separating the 4th digit in each row:

\begin{bmatrix}
4 & 8 & -12 & 4 \\
3 & 5 & 6 & 7 \\
2 & 5 & 3 & 8 \\
\end{bmatrix}

I have tried using "array" as well as "ccc|c" and nothing has worked. Any help provided would be greatly appreciated. Thank you.

Please see the screen cap below from the text file, created using Word for reference to what I am trying to achieve.

augmentedmatrix

marked as duplicate by Werner math-mode Mar 3 '16 at 7:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

You should always post a full document with \documentclass, \begin{document} and \end{document}. In other words, a MWE (Minimal Working Example).

That said, the following works for me:

\documentclass[a4paper]{report}
\usepackage{amsmath}

\begin{document}
\[\left[\begin{array}{ccc|c}
a & b & c & d \\
e & f & g & h \\
i & j & k & l \\
m & n & o & p
\end{array}\right]\]
\end{document}

enter image description here

array is the enviroment creating the matrix. ccc|c means three center-aligned columns, with a vertical bar between third and fourth. \left and \right are to make tall brackets, without them the [] do not scale and stay very short.

As @egreg notes, adding @{} before the first c and after the last one removes the "padding space" between the brackets and the matrix, and is therefore advisable.

Update

@Benjamin points out in a comment that array may not be supported by iBook Author. Since iBook Author seems to have partial support of MathML, I posted a spam question on Math.SE to get the MathML code for the above, which is:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mo>[</mo>
    <mtable columnalign="center center center center" rowspacing="4pt" columnspacing="1em" columnlines="none none solid">
      <mtr>
        <mtd>
          <mi>a</mi>
        </mtd>
        <mtd>
          <mi>b</mi>
        </mtd>
        <mtd>
          <mi>c</mi>
        </mtd>
        <mtd>
          <mi>d</mi>
        </mtd>
      </mtr>
      <mtr>
        <mtd>
          <mi>e</mi>
        </mtd>
        <mtd>
          <mi>f</mi>
        </mtd>
        <mtd>
          <mi>g</mi>
        </mtd>
        <mtd>
          <mi>h</mi>
        </mtd>
      </mtr>
      <mtr>
        <mtd>
          <mi>i</mi>
        </mtd>
        <mtd>
          <mi>j</mi>
        </mtd>
        <mtd>
          <mi>k</mi>
        </mtd>
        <mtd>
          <mi>l</mi>
        </mtd>
      </mtr>
      <mtr>
        <mtd>
          <mi>m</mi>
        </mtd>
        <mtd>
          <mi>n</mi>
        </mtd>
        <mtd>
          <mi>o</mi>
        </mtd>
        <mtd>
          <mi>p</mi>
        </mtd>
      </mtr>
    </mtable>
    <mo>]</mo>
  </mrow>
</math>

The spam thing is now deleted. Note, however, that bmatrix isn't supported either, so perhaps it is a good idea to move to actual LaTeX and use the solution above.

  • Better with \begin{array}{@{}ccc|c@{}}, to do the same as bmatrix – egreg Mar 2 '16 at 22:37
  • @egreg I perfectly agree. Answer updated. – MickG Mar 2 '16 at 22:41
  • @MickG This is a perfect answer for LaTeX, but the OP asked for a solution for iBook Author, which only supports a small subset of LaTeX commands: support.apple.com/de-de/HT202501 But do we even allow such questions here? I suppose not. – Benjamin Mar 3 '16 at 0:12
  • @Benjamin hm, your link says bmatrix is not supported, but OP posted a code fragment using it… hoping MathML is supported enough, I will add the MathML rendering of the above array, getting it straight out of Math SE. – MickG Mar 3 '16 at 7:29
  • @MickG Well actually it does. I tried it. The document seems to be not up-to-date. But unfortunately your MathML example does not work, as columnlines is really not supported by iBook Author. But you can fake the desired output with two mtables. – Benjamin Mar 3 '16 at 9:32

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