Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following code, I have LaTeX display a system of m linear equations in n variables. I have the proper alignments, but it is not displayed properly in two aspects. The vertical dots are not quite centered in the columns, and in each equation, there is an unseemly wide space about the "+" and the "=". I would like LaTeX to have these dots centered, and I would like to have the proper space about the binary operator of addition and the binary relation of equating.

\documentclass[10pt]{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}


\begin{document}

\begin{align*}
\left\{
\begin{array}{ccccccccccc}
a_{1,1}x_{1} & + & a_{1,2}x_{2} & + & \cdots & + & a_{1,n}x_{n} & = & b_{1} \\
a_{2,1}x_{1} & + & a_{2,2}x_{2} & + & \cdots & + & a_{2,n}x_{n} & = & b_{2} \\
\vdots & & \vdots & & \ddots & &  \vdots & &  \vdots \\
a_{m,1}x_{1} & + & a_{m,2}x_{2} & + & \cdots & + & a_{m,n}x_{n} & = & b_{m} \\
\end{array}
\right.
\end{align*}

\end{document}
share|improve this question
    
How did you edit this post in 30 seconds? –  user143462 Jul 19 at 0:07
    
Do you know systeme package? –  stalking is prohibited Jul 19 at 0:08
    
No. I have not hear of that package. –  user143462 Jul 19 at 0:08
    
Pressing a button can be in less than 1 ms. –  stalking is prohibited Jul 19 at 0:08
1  
@user143462 The {} button is for moving the highlighted text 4 positions to the right. –  Przemysław Scherwentke Jul 19 at 0:22

3 Answers 3

Here's a solution that basically takes your code and just modifies the length parameter \arraycolsep; its default value (in all LaTeX document classes I'm familiar with) is 5pt, and I set it to 1.5pt around the + symbols and to 2.5pt around the = symbols. These changes also bring about a change in the positioning of the \vdots symbols.

enter image description here

\documentclass[10pt]{amsart}
%\usepackage{amsmath}  % none of these packages are used for this MWE
%\usepackage{amsfonts}
%\usepackage{amssymb}
%\usepackage{amsthm}
%\usepackage{mathtools}

\begin{document}
\[  % no need to use "align*" env.
\setlength\arraycolsep{1.5pt} % default value: 5pt
\left\{
\begin{array}{ccc ccc c @{\extracolsep{2.5pt}}c@{\extracolsep{2.5pt}}c}
a_{1,1}x_{1} & + & a_{1,2}x_{2} & + & \cdots & + & a_{1,n}x_{n} & = & b_{1} \\
a_{2,1}x_{1} & + & a_{2,2}x_{2} & + & \cdots & + & a_{2,n}x_{n} & = & b_{2} \\
\vdots & & \vdots & & \ddots & &  \vdots & &  \vdots \\
a_{m,1}x_{1} & + & a_{m,2}x_{2} & + & \cdots & + & a_{m,n}x_{n} & = & b_{m} \\
\end{array}
\right.
\]
\end{document}

Addendum, prompted by some follow-up questions by the OP: The OP has asked how I came up with the lengths 1.5pt and 2.5pt. First, some preliminaries. By default, TeX inserts \medmuskip = 4 mu plus 2.0 mu minus 4.0 mu between items of math-types mathord and mathbin (such as +), and \thickmuskip = 5mu plus 5mu around items of math-type mathrel (such as =). The stretch and shrink components in these "glue" lengths only come into play if TeX sees a need to stretch or shrink the expression; the the purposes of our discussion we can work with fixed lengths of 4mu and 5mu, respectively. (1 mu = 1/18 em, where an em-space is usually the width of the letter M.) Note, though, that the space around symbols such as = can expand considerably but not shrink.

In the answer given above, I chose a value of 1.5pt rather than 4mu as the default space between columns for the following reason: Since the "math molecules" of type mathord on lines 1 and 2 of the array -- e.g., a_{1,2}x_{2} -- are less wide than those in the final row -- e.g., a_{m,2}x_{2} -- assigning 4mu would lead to spacing between the items of type mathord and mathbin that would look OK on the final row but probably too wide in all other rows. Choosing a slightly lower value (viz., 1.5pt) represents a bit of a compromise, in the hope that the space would look OK "on average", i.e., across all rows of the array. Finally, 2.5pt is very close to 5mu since I believe it's important to provide enough space around items of type mathrel.

share|improve this answer
    
Please see my comment that I left for Scherwentl. In your array environment, you allow the default space between columns except about the "=". How did you decide to have 1.5 point between columns that are before or after "+"? Can the code have started with "\begin{array}{c@{1.5pt}c@{1.5pt}} ... c@{2.5pt}c}"? Is there a web site that you can suggest for the syntax for the array environment? –  user143462 Jul 23 at 18:28
    
What are the spaces about binary operators and binary relations in "standard TeX"? I am using 10 point font. In the last row, having the letter "m" to indicate the mth row does make some of those entries wider than corresponding entries in the first and second rows. I guess the "@{\extracolsep{2.5pt}}" command suppresses the "\setlength\arraycolsep{1.5pt}" and only inserts 2.5pt about the "=". Thanks. –  user143462 Jul 23 at 20:46
    
@user143462 - Please see the addendum to my answer, in which I've tried to address some of your follow-up questions in more detail. Note that there's no single uniform amount of whitespace in your setup since the items of type mathord have different widths; hence, by necessity the space around the + signs will be wider in some rows than in others. The value of 1.5pt is an attempt at a compromise. Not perfect, but hopefully better than if I hadn't recognized the issue at all. –  Mico Jul 23 at 21:36
    
I understand that you are compromising with choosing 2.5 pt. I want to be sure that I understand the different measurements for horizontal space. I looked in a table. There are 2.84526 points in a mm, and there are 10.00002 points in an em. So, there would be about 3.5146 mm in an em. The width of the letter "M" - the capital letter "M" - depends on the font, and it is not 3.5146 mm for every font. The table does not specify the font. You say that "2.5 pt is very close to 5 mu." 2.5 pt is about 0.879 mm, and 5 mu is about 0.976 mm. For typesetting, I agree that this is close. Is that right? –  user143462 Jul 24 at 1:10
    
@user143462 - I guess that judging whether 0.88mm and 0.98 mm are "close" depends importantly on who's doing the judging. A master typographer (which I'm not!) would probably say that 0.1mm is not close to 0... For the job at hand, though, I think it's ok to treat the two lengths as being very close. You're obviously free to adjust the lengths to suit your own needs and tastes. –  Mico Jul 24 at 12:10

An example of a solution. It may be simplified, if we know, e.g., the structure of equations.

\documentclass[10pt]{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}


\begin{document}

\begin{align*}
\left\{
\begin{array}{c@{\,}c@{\,}c@{\,}c@{\,}c@{\,}c@{\,}c@{\;}c@{\;}ccccc}
a_{1,1}x_{1} & + & a_{1,2}x_{2} & + & \cdots & + & a_{1,n}x_{n} & = & b_{1} \\
a_{2,1}x_{1} & + & a_{2,2}x_{2} & + & \cdots & + & a_{2,n}x_{n} & = & b_{2} \\
\vdots & & \vdots & & \ddots & &  \vdots & &  \vdots \\
a_{m,1}x_{1} & + & a_{m,2}x_{2} & + & \cdots & + & a_{m,n}x_{n} & = & b_{m} \\
\end{array}
\right.
\end{align*}

\end{document}

enter image description here

share|improve this answer
    
I think that \thinspace is a bit too tight around binary operators; you may want to go with \medspace for the binary operator and \thickspace around the relational operator. –  Mico Jul 19 at 3:48
    
I like both displays - those from @Mico and Scherwentl. They look the same. Scherwentl seems to allude to wanting to display each equation in this system of equations with the same spacing about the "+" as would be provided if the equation were displayed by itself in an equation environment. (Same for the spacing about the "=".) That is what I would like. Are these spaces certain, or do they stretch and compress? In the array environment, @{specified space} suppresses the default space between columns and inserts "specified space" between them. Is "\," to tight? Spacing looks same as in Mico. –  user143462 Jul 23 at 18:21

Another solution with the alignat environmentand theempheqpackage for the brace. Don't loadamsmath:: empheq loadsmathtools, which loads it. I deleted the\ddots`, that I don't understand in this context. The + signs and the unknowns are vertically aligned:

    \documentclass[10pt]{amsart}

    \usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage[overload]{empheq}


    \begin{document}

    \begin{alignat*}{4}[left = \empheqlbrace]
    a_{1,1}&x_{1} + a_{1,2}& & x_{2} +\cdots + a_{1,n}& & x_{n} \mbox{}&=\mbox{} & b_1} \\
    a_{2,1}&x_{1} {}+ a_{2,2} & &x_{2} +\cdots + a_{2,n}& & x_{n}& \mbox{}=\mbox{} & b_2} \\[-7pt]
     & \vdots & &\vdots & & \vdots & &\vdots \\[-5pt]
    a_{m,1}&x_{1}{} + a_{m,2} & & x_{2} +\cdots + a_{m,n}& & x_{n}& \mbox{}= \mbox{} & b_{m}
    \end{alignat*}

    \end{document} 

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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