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.

I've got a system of equations, each of them doesn't fit the page width, so I'm searching the way to align them so that:

  • the brace should appear to the left with no indentation
  • the first line of each equation should be left-aligned
  • the last line of each equation should be right-aligned

I reached the following: enter image description here but I don't like the huge spacing between the brace and the 1-st letter of each equation.

The code I used is the following:

\[
\setlength{\multlinegap}{0pt}
\left\{
\begin{array}{c}
\shoveleft{A_{PP}\sin\alpha_{P1} - A_{PS}\cos\alpha_{S1} +B_{PP} \sin\alpha_{P2} +B_{PS} \cos\alpha_{S2} =} \\ \shoveright{=\sin\alpha_{P1},} \\
% 2-nd equation
\shoveleft{ A_{PP}\cos\alpha_{P1}  +A_{PS} \sin\alpha_{S1} -B_{PP}\cos\alpha_{P2} + B_{PS} \sin\alpha_{S2} = } \\
\shoveright{ =\cos\alpha_{P1},} \\
% 3-rd equation
\shoveleft{ A_{PP}\gamma_{P1} \cos 2\alpha_{S1} +A_{PS}  \gamma_{S1} \sin 2\alpha_{S1} +B_{PP}  \gamma_{P2} \cos 2\alpha_{S2} -} \\
\shoveright{- B_{PS}   \gamma_{S2} \sin 2\alpha_{S2} = \gamma_{P1} \cos 2\alpha_{S1},} \\
% 4-th equation
\shoveleft{ -A_{PP}n_1 \gamma_{S1} \sin 2\alpha_{P1} +A_{PS}  \gamma_{S1} \cos 2\alpha_{S1} +B_{PP} n_2 \gamma_{S2} \sin 2\alpha_{P2} +} \\
\shoveright{+ B_{PS} \gamma_{S2} \cos 2\alpha_{S2} = n_1 \gamma_{S1} \sin 2\alpha_{P1}.}\end{array}
\right.
\] 

Any help will be appreciated. Thanks!

share|improve this question
    
You can use \begin{array}{@{}c@{}} –  Marco Daniel Jun 4 '12 at 18:20
    
Marco Daniel, that doesn't seem to help if this line is directly pasted into my code instead of the 4-th line \begin{array}{c}. I observe 2 negative effects: (1) the spacing is still there; (2) the equations do not occupy the full text width, the gap appears to the right, which is undesirable. –  Alexandre Jun 4 '12 at 18:23
    
The space is removed I tested it. –  Marco Daniel Jun 4 '12 at 18:26
add comment

4 Answers

up vote 5 down vote accepted

the multlined environment from mathtools is your friend. (it loads amsmath, so there's no need to do that).

two things to note about this example:

  • \mathindent is set to zero width within a group so it will disappear after the display ends.
  • since multlined (like multline) automatically sets the first line flush left and the last line flush right, you don't want the \shove... commands on those lines. in fact, the spacing will be compromised if you do wrap those lines in \shove... arguments.

here's the code:

\documentclass{article}
\usepackage[fleqn]{mathtools}

\begin{document}

\noindent some text here
{\mathindent=0pt
\[
\setlength{\multlinegap}{0pt}
\left\{
\begin{multlined}
A_{PP}\sin\alpha_{P1} - A_{PS}\cos\alpha_{S1} +B_{PP} \sin\alpha_{P2} +B_{PS} \cos\alpha_{S2} = \\
\shoveright{=\sin\alpha_{P1},} \\
% 2-nd equation
\shoveleft{ A_{PP}\cos\alpha_{P1}  +A_{PS} \sin\alpha_{S1} -B_{PP}\cos\alpha_{P2} + B_{PS} \sin\alpha_{S2} = } \\
\shoveright{ =\cos\alpha_{P1},} \\
% 3-rd equation
\shoveleft{ A_{PP}\gamma_{P1} \cos 2\alpha_{S1} +A_{PS}  \gamma_{S1} \sin 2\alpha_{S1} +B_{PP}  \gamma_{P2} \cos 2\alpha_{S2} -} \\
\shoveright{- B_{PS}   \gamma_{S2} \sin 2\alpha_{S2} = \gamma_{P1} \cos 2\alpha_{S1},} \\
% 4-th equation
\shoveleft{ -A_{PP}n_1 \gamma_{S1} \sin 2\alpha_{P1} +A_{PS}  \gamma_{S1} \cos 2\alpha_{S1} +B_{PP} n_2 \gamma_{S2} \sin 2\alpha_{P2} +} \\
+ B_{PS} \gamma_{S2} \cos 2\alpha_{S2} = n_1 \gamma_{S1} \sin 2\alpha_{P1}.
\end{multlined}
\right.
\] }

\end{document}

enter image description here

share|improve this answer
    
Thanks! That did the trick for me –  Alexandre Jun 4 '12 at 18:56
    
@azetina -- thanks for adding the image. (i didn't have time.) –  barbara beeton Jun 4 '12 at 20:44
    
@barbarabeeton Sure you are most welcome. I actually like answers and questions with resulting output. So whenever I see one I try to put in the images. –  azetina Jun 4 '12 at 23:37
add comment

This is not directly addressing your question, but more about making the information easier to parse. I would suggest the following changes to make the pattern easier to see:

  • Eliminate the double equal signs
  • align the terms across multiple lines

enter image description here

Notes:

  • The leading minus sign on the last equation has non-standard spacing but I think it looks better in this case
  • You could also consider aligning the middle +/- signs (and perhaps even the equal signs) to make the pattern ever more obvious.

There are many ways to achieve this, so this is just to show one method.

Code:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Phantom}{\phantom{{}+{}}}%
\newcommand{\Plus}{{}+{}}%
\newcommand{\Minus}{{}-{}}%

\begin{document}
\[\begin{cases}
\Phantom A_{PP}\sin\alpha_{P1} - A_{PS}\cos\alpha_{S1} \\
        \Plus B_{PP}\sin\alpha_{P2} + B_{PS}\cos\alpha_{S2} =
         \sin\alpha_{P1}, \\[7pt]
% 2-nd equation
\Phantom A_{PP}\cos\alpha_{P1}  +A_{PS} \sin\alpha_{S1} \\
\Minus B_{PP}\cos\alpha_{P2} + B_{PS} \sin\alpha_{S2} = \cos\alpha_{P1}, \\[7pt]
% 3-rd equation
\Phantom A_{PP}\gamma_{P1} \cos 2\alpha_{S1} +A_{PS}  \gamma_{S1} \sin 2\alpha_{S1} \\
\Plus B_{PP}  \gamma_{P2} \cos 2\alpha_{S2}
- B_{PS}   \gamma_{S2} \sin 2\alpha_{S2} = \gamma_{P1} \cos 2\alpha_{S1}, \\[7pt]
% 4-th equation
\Minus A_{PP}n_1 \gamma_{S1} \sin 2\alpha_{P1} +A_{PS}  \gamma_{S1} \cos 2\alpha_{S1} \\
\Plus B_{PP} n_2 \gamma_{S2} \sin 2\alpha_{P2} +
       B_{PS} \gamma_{S2} \cos 2\alpha_{S2} = n_1 \gamma_{S1} \sin 2\alpha_{P1}.
\end{cases}\]
\end{document}
share|improve this answer
    
Thank you for the comment. I can't eliminate the double signs because the Russian typographical tradition requires the sign to be repeated if the equation is split at this sign (1st time - at the end of the line; 2nd - in the beginning of the new line). I agree that the equations are more readable if using your way :), but currently I've got to follow the publisher's requirements (most of them on the alignment are specified in the question) –  Alexandre Jun 4 '12 at 19:09
add comment

To remove the space between the row and the brace you can use the declaration @{}. The declaration @{} is described here:

Spaces between rows and cols in a table - Better ways than mine?

To provide an equation about the whole contents you can use the command \resizebox. Note this results in an unwanted size of the equation.

\documentclass{article}
\usepackage{showframe}
\usepackage{array}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\[
\setlength{\multlinegap}{0pt}
\left\{
\begin{array}{c}
\shoveleft{A_{PP}\sin\alpha_{P1} - A_{PS}\cos\alpha_{S1} +B_{PP} \sin\alpha_{P2} +B_{PS} \cos\alpha_{S2} =} \\ \shoveright{=\sin\alpha_{P1},} \\
% 2-nd equation
\shoveleft{ A_{PP}\cos\alpha_{P1}  +A_{PS} \sin\alpha_{S1} -B_{PP}\cos\alpha_{P2} + B_{PS} \sin\alpha_{S2} = } \\
\shoveright{ =\cos\alpha_{P1},} \\
% 3-rd equation
\shoveleft{ A_{PP}\gamma_{P1} \cos 2\alpha_{S1} +A_{PS}  \gamma_{S1} \sin 2\alpha_{S1} +B_{PP}  \gamma_{P2} \cos 2\alpha_{S2} -} \\
\shoveright{- B_{PS}   \gamma_{S2} \sin 2\alpha_{S2} = \gamma_{P1} \cos 2\alpha_{S1},} \\
% 4-th equation
\shoveleft{ -A_{PP}n_1 \gamma_{S1} \sin 2\alpha_{P1} +A_{PS}  \gamma_{S1} \cos 2\alpha_{S1} +B_{PP} n_2 \gamma_{S2} \sin 2\alpha_{P2} +} \\
\shoveright{+ B_{PS} \gamma_{S2} \cos 2\alpha_{S2} = n_1 \gamma_{S1} \sin 2\alpha_{P1}.}\end{array}
\right.
\] 


\noindent\resizebox{\linewidth}{!}{%
$\setlength{\multlinegap}{0pt}
\left\{
\begin{array}{@{}c@{}}
\shoveleft{A_{PP}\sin\alpha_{P1} - A_{PS}\cos\alpha_{S1} +B_{PP} \sin\alpha_{P2} +B_{PS} \cos\alpha_{S2} =} \\ \shoveright{=\sin\alpha_{P1},} \\
% 2-nd equation
\shoveleft{ A_{PP}\cos\alpha_{P1}  +A_{PS} \sin\alpha_{S1} -B_{PP}\cos\alpha_{P2} + B_{PS} \sin\alpha_{S2} = } \\
\shoveright{ =\cos\alpha_{P1},} \\
% 3-rd equation
\shoveleft{ A_{PP}\gamma_{P1} \cos 2\alpha_{S1} +A_{PS}  \gamma_{S1} \sin 2\alpha_{S1} +B_{PP}  \gamma_{P2} \cos 2\alpha_{S2} -} \\
\shoveright{- B_{PS}   \gamma_{S2} \sin 2\alpha_{S2} = \gamma_{P1} \cos 2\alpha_{S1},} \\
% 4-th equation
\shoveleft{ -A_{PP}n_1 \gamma_{S1} \sin 2\alpha_{P1} +A_{PS}  \gamma_{S1} \cos 2\alpha_{S1} +B_{PP} n_2 \gamma_{S2} \sin 2\alpha_{P2} +} \\
\shoveright{+ B_{PS} \gamma_{S2} \cos 2\alpha_{S2} = n_1 \gamma_{S1} \sin 2\alpha_{P1}.}\end{array}
\right.
$} 
\end{document}

enter image description here

share|improve this answer
    
maybe some options in the document preamble prevent the space from disappearing? I tried your code, and I see that the letters are increased, the width is ok, but the spacing is still there. –  Alexandre Jun 4 '12 at 18:43
    
@Alexandre: Did you try my example. As you can see in the picture I got no space. –  Marco Daniel Jun 4 '12 at 18:45
    
yep, I tried it. That's what I get: img542.imageshack.us/img542/2811/70308726.png . –  Alexandre Jun 4 '12 at 18:52
add comment
\documentclass[a4paper]{article}
\usepackage{amsmath,tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}

\noindent
\begin{tabularx}{\linewidth}{@{}l@{\kern-10pt}X@{}}
$\left\{\rule{0pt}{4\normalbaselineskip}\right.$
&
\begin{multline}
A_{PP}\sin\alpha_{P1} - A_{PS}\cos\alpha_{S1} +B_{PP} \sin\alpha_{P2} 
           +B_{PS} \cos\alpha_{S2} = \sin\alpha_{P1}, \\
% 2-nd equation
\shoveleft A_{PP}\cos\alpha_{P1}  +A_{PS} \sin\alpha_{S1} -B_{PP}\cos\alpha_{P2} 
           + B_{PS} \sin\alpha_{S2} =\cos\alpha_{P1}, \\
% 3-rd equation
\shoveleft A_{PP}\gamma_{P1} \cos 2\alpha_{S1} +A_{PS}  \gamma_{S1} \sin 2\alpha_{S1} +B_{PP}  \gamma_{P2} \cos 2\alpha_{S2} - \\
\shoveright{-B_{PS}   \gamma_{S2} \sin 2\alpha_{S2} = \gamma_{P1} \cos 2\alpha_{S1},} \\
% 4-th equation
\shoveleft -A_{PP}n_1 \gamma_{S1} \sin 2\alpha_{P1} +A_{PS}  \gamma_{S1} \cos 2\alpha_{S1} +B_{PP} n_2 \gamma_{S2} \sin 2\alpha_{P2} + \\
+ B_{PS} \gamma_{S2} \cos 2\alpha_{S2} = n_1 \gamma_{S1} \sin 2\alpha_{P1}.
\end{multline}
\end{tabularx}

\end{document}

enter image description here

share|improve this answer
    
Thanks, but with my doc properties the alignment is messed with this solution (the equations cross the brace). I finally used the multlined variant proposed. Thanks again for the help –  Alexandre Jun 4 '12 at 18:58
add comment

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.