9

I am trying to type this matrix like this enter image description here

I tried

\documentclass{article}
\usepackage{amsmath}
\usepackage{fouriernc}
\begin{document}
\[
    \left( {\left| {\begin{array}{*{2}c}
                {a_2 } & {a_3 }  \\
                {b_2 } & {b_3 }  \\
        \end{array}} \right|;  \left| {\begin{array}{*{2}c}
                {a_3 } & {a_1 }  \\
                {b_3 } & {b_1 }  \\
        \end{array}} \right|;\left| {\begin{array}{*{2}c}
                {a_1 } & {a_2 }  \\
                {b_1 } & {b_2 }  \\
        \end{array}} \right|} \right).
\]
\end{document}

I got enter image description here

How can I get like this first picture, i.e. with reduced horizontal spacing?

2
  • Just to be clear, it's the horizontal spacing that you're wanting to change?
    – Teepeemm
    Commented Aug 30, 2022 at 23:41
  • Yes. I am wanting to change the horizontal spacing. Commented Aug 30, 2022 at 23:43

4 Answers 4

12

(You have a lot of {stuff} where the outer braces aren't necessary. That's not really causing the excess spacing, but does clutter up your code.)

One fix would be to put in enough negative spacing \! to get the outcome you want. You could probably play around with the column specifiers once you look up how to do that.

But since you're already loading amsmath, you can use their matrix environments: vmatrix will surround it with |.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
    \left( {\left| {\begin{array}{*{2}c} % yours
                {a_2 } & {a_3 }  \\
                {b_2 } & {b_3 }  \\
        \end{array}} \right|;  \left| {\begin{array}{*{2}c}
                {a_3 } & {a_1 }  \\
                {b_3 } & {b_1 }  \\
        \end{array}} \right|;\left| {\begin{array}{*{2}c}
                {a_1 } & {a_2 }  \\
                {b_1 } & {b_2 }  \\
        \end{array}} \right|} \right).
\\
    \left( % mine
     \begin{vmatrix}
      a_2 & a_3 \\
      b_2 & b_3 \\
     \end{vmatrix}
     ;
     \begin{vmatrix}
      a_3 & a_1 \\
      b_3 & b_1 \\
     \end{vmatrix}
     ;
     \begin{vmatrix}
      a_1 & a_2 \\
      b_1 & b_2 \\
     \end{vmatrix}
    \right).
\end{gather*}

\end{document}

code output

8

You could use @{} at the start and end of the array column specification to remove the padding on the left and right of those columns:

\documentclass{article}
\usepackage{amsmath}
\usepackage{fouriernc}
\begin{document}
\[
    \left( {\left| {\begin{array}{@{}*{2}c@{}}
                {a_2 } & {a_3 }  \\
                {b_2 } & {b_3 }  \\
        \end{array}} \right|;  \left| {\begin{array}{@{}*{2}c@{}}
                {a_3 } & {a_1 }  \\
                {b_3 } & {b_1 }  \\
        \end{array}} \right|;\left| {\begin{array}{@{}*{2}c@{}}
                {a_1 } & {a_2 }  \\
                {b_1 } & {b_2 }  \\
        \end{array}} \right|} \right).
\]
\end{document}
8

Use vmatrix, not array.

I also suggest to define a command for the task, which might seem redundant (we split at semicolons just to add them back in) but isn't as I'll show later.

\documentclass{article}
\usepackage{amsmath}
\usepackage{fouriernc}

\ExplSyntaxOn

\NewDocumentCommand{\rowvec}{m}
 {
  \left(
  \seq_set_split:Nnn \l_tmpa_seq { ; } { #1 }
  \seq_use:Nn \l_tmpa_seq { ; }
  \right)
 }

\ExplSyntaxOff


\begin{document}

\[
\rowvec{x;y;z}+\rowvec{1;2;3}
\]

\[
\rowvec{
  \begin{vmatrix}
  a_2 & a_3 \\
  b_2 & b_3
  \end{vmatrix} ;
  \begin{vmatrix}
  a_3 & a_1 \\
  b_3 & b_1
  \end{vmatrix} ;
  \begin{vmatrix}
  a_1 & a_2 \\
  b_1 & b_2
  \end{vmatrix}
}
\]

\end{document}

enter image description here

Now, suppose your coauthor finds that the space after the semicolons is too small: you simply change the definition. For instance, adding a thick space \; after the semicolon (and a thin space in front of it).

\documentclass{article}
\usepackage{amsmath}
\usepackage{fouriernc}

\ExplSyntaxOn

\NewDocumentCommand{\rowvec}{m}
 {
  \left(
  \seq_set_split:Nnn \l_tmpa_seq { ; } { #1 }
  \seq_use:Nn \l_tmpa_seq { \,;\; }
  \right)
 }

\ExplSyntaxOff


\begin{document}

\[
\rowvec{x;y;z}+\rowvec{1;2;3}
\]

\[
\rowvec{
  \begin{vmatrix}
  a_2 & a_3 \\
  b_2 & b_3
  \end{vmatrix} ;
  \begin{vmatrix}
  a_3 & a_1 \\
  b_3 & b_1
  \end{vmatrix} ;
  \begin{vmatrix}
  a_1 & a_2 \\
  b_1 & b_2
  \end{vmatrix}
}
\]

\end{document}

enter image description here

Or maybe you change your mind and decide to use commas instead of semicolons. You just need to change the code into

\seq_use:Nn \l_tmpa_seq { , }

and keep the rest of the document as it is without the need of chasing for semicolons.

7

If we are using Plain-TeX then there is no problem:

$$
  \left(
     \left|\matrix{a_2 & a_3\cr b_2 & b_3}\right|; 
     \left|\matrix{a_3 & a_1\cr b_3 & b_1}\right|; 
     \left|\matrix{a_1 & a_2\cr b_1 & b_2}\right|
  \right) 
$$

\bye

gives the result as requested.

1
  • You should add this example of nested matrices into your optex-math.pdf. Just a suggestion.
    – user206750
    Commented Oct 4, 2022 at 2:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .