0

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

Sebastiano
  • 54,118
TechEng
  • 111

1 Answers1

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.

MickG
  • 5,426
  • Better with \begin{array}{@{}ccc|c@{}}, to do the same as bmatrix – egreg Mar 02 '16 at 22:37
  • @egreg I perfectly agree. Answer updated. – MickG Mar 02 '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: https://support.apple.com/de-de/HT202501 But do we even allow such questions here? I suppose not. – Benjamin Mar 03 '16 at 00: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 03 '16 at 07: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 03 '16 at 09:32
  • Your responses are appreciated. Is there a solution to use LaTeX in iBook Author even though there is only a small subset of commands supported that will give me the desired outcome? If this is not the forum for LaTex support because I am using iBook Author, please direct me to a more suitable forum. Thank you. – TechEng Mar 04 '16 at 16:10
  • It might be a good idea to ask on meta whether questions abot iBook Author are allowed here, since someone is unsure, as comments above show. I personally have no idea what it is or what commands it supports, and even less where else to ask. A meta thread might be a good place to ask for redirection to another asking place. All I could suggest is Yahoo Answers which is probably not that good a suggestion :). – MickG Mar 04 '16 at 16:41
  • Try the solutions given on the question this has been closed as duplicate of. – MickG Mar 04 '16 at 16:42