Math & ScienceAlignment of linear equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Alignment of linear equations

Post by Montag »

Hello,
I'd like to do a simple version of the solutions of here. It contains my problem 1:1 and I'd like to make it simpler than the proposed solution with the array-package shows. Although I read the amsmath manual, I can't see the forest for the trees.

So a "simpler" version would be appreciated, which I thought I found here. Thanks to Thorsten, I understand alignat* now, but the result doesn't even look "ok":

Code: Select all

\documentclass{scrartcl}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
k^{(1)}\cdot u_{1} &- k^{(1)}\cdot u_{2} &+ 0\cdot u_{3} &= P_{1}\\
-k^{(1)}\cdot u_{1} &+ \bigl( k^{(1)} + k^{(2)}\bigr)\cdot u_{2} &- k^{(2)}\cdot u_{3} &= P_{3}\\
0\cdot u_{1} &- k^{(2)}\cdot u_{2} &+ k^{(2)}\cdot u_{3} &= P_{3}
\end{alignat*}
\end{document}
is:
alignat-look.jpg
alignat-look.jpg (49.15 KiB) Viewed 2177 times
Last edited by Montag on Fri Jan 07, 2011 12:23 pm, edited 2 times in total.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Alignment of linear equations

Post by frabjous »

There are a lot of suggestions in that forum post. Do none of them work for you? What are you after in particular?
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Alignment of linear equations

Post by Montag »

Sorry, you are right. It's not that clear why I am looking for. I meant I'd like to achieve the alignments only with amsmath's tools.
About the picture/my request: I'd like the summands to be written in a way so that it's immediately clear how the equation system evolves, meaning it's easy to see which summands are going to be omitted. Right now, they aren't really centered and especially

Code: Select all

0\cdot u_{3}
(upper right)
has a strange position.

edit:

Code: Select all

\begin{equation*}\begin{matrix}
k^{(1)}\cdot u_{1} &- &k^{(1)}\cdot u_{2} &+ &0\cdot u_{3} &= P_{1}\\
-k^{(1)}\cdot u_{1} &+ &\bigl( k^{(1)} + k^{(2)}\bigr)\cdot u_{2} &- &k^{(2)}\cdot u_{3} &= P_{3}\\
0\cdot u_{1} &- &k^{(2)}\cdot u_{2} &+ &k^{(2)}\cdot u_{3} &= P_{3}
\end{matrix}\end{equation*}
gives a nice result. It's easier to achieve than any other code.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
Post Reply