Page 1 of 1

LaTeX - zarovnanie

Posted: Wed Feb 22, 2012 9:30 pm
by Martin Sleziak
Pri pouziti dlhsej rovnice alebo viacerych rovnic je obcas prehladnejsie, ked su rovnice pekne zarovnane.
Mozete pouzit napriklad environment align* a miesta, ktore chcete zarovnat, oznacit &. Novy riadok je oznaceny \\.
Vela dalsich podobnych (a uzitocnych) environmentov mozete najst v Chapter 8 z LaTeX Companion.

Code: Select all

\begin{align*}
2(r^2+4rR) &= 2(ab+bc+ca-s^2) \\
 &= 2(ab+bc+ca)-\frac{(a+b+c)^2}2 \\
 &= ab+bc+ca-\frac{a^2+b^2+c^2}2.
\end{align*}
$$
\begin{align*}
2(r^2+4rR) &= 2(ab+bc+ca-s^2) \\
&= 2(ab+bc+ca)-\frac{(a+b+c)^2}2 \\
&= ab+bc+ca-\frac{a^2+b^2+c^2}2.
\end{align*}$$

Pozicii, ktore chcem zarovnat, mozem mat i viac:

Code: Select all

\begin{align*}
89&=5.16+9 &\qquad 9&=89-5.16\\
16&=1.9+7 &\qquad 7=16-9 &= 6.16-89 \\
9&=1.7+2  &\qquad 2=9-7&=2.89-11.16\\
7&=3.2+1 &\qquad 1=7-3.2&=39.16-7.89
\end{align*}
$$
\begin{align*}
89&=5.16+9 &\qquad 9&=89-5.16\\
16&=1.9+7 &\qquad 7=16-9 &= 6.16-89 \\
9&=1.7+2 &\qquad 2=9-7&=2.89-11.16\\
7&=3.2+1 &\qquad 1=7-3.2&=39.16-7.89
\end{align*}
$$

Re: LaTeX - zarovnanie

Posted: Tue Sep 25, 2012 8:54 pm
by Martin Sleziak
Asi sa niekde hodi spomenut aj ako sa da napisat funkcia definovana pomocou jednotlivych pripadov - nevedel som celkom, kam to dat, snad to moze byt tu pri zarovnavani.

Code: Select all

\chi_A(x)=
  \begin{cases}
    1 & x\in A, \\
    0 & x\notin A.
  \end{cases}
$\chi_A(x)=
\begin{cases}
1 & x\in A, \\
0 & x\notin A.
\end{cases}
$

Code: Select all

x_n=
  \begin{cases}
    1 & n=k^2 \text{ pre nejaké $k$}, \\
    0 & \text{inak}.
  \end{cases}
$x_n=
\begin{cases}
1 & n=k^2 \text{ pre nejaké $k$}, \\
0 & \text{inak}.
\end{cases}
$

Code: Select all

$\operatorname{sgn}(x)=
  \begin{cases}
    -1 & x<0, \\
    0 & x=0, \\
    1 & x>0
  \end{cases}$
$\operatorname{sgn}(x)=
\begin{cases}
-1 & x<0, \\
0 & x=0, \\
1 & x>0
\end{cases}$