Alignment in equations
The alignment points are marked with an &
. If there are several groups (columns of alignments), a further &
is used to introduce each new group (except the first group), so that n columns of alignment require 2n-1 ampersands.
Here you can use this code for instance:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
S_1' (x_0) &= S_n' (x_n) = 0 &&\text{(clamped boundary conditions),} \quad \text{or} \\
S_1'' (x_0) &= S_n'' (x_n) = 0 && \text{(natural boundary conditions)}
\end{align*}
\end{document}
I also suggest these solutions based on alignat*
, using the \ArrowBetweenLines
command from mathtools
(needless to load amsmath
in this case), or flalign*
:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{alignat*}{3}
& & S_1' (x_0) &= S_n' (x_n) = 0 &\quad & \text{(clamped boundary conditions),} \\
\ArrowBetweenLines[\text{or}]%
& & S_1'' (x_0) &= S_n'' (x_n) = 0 & & \text{(natural boundary conditions)}
\end{alignat*}
\begin{flalign*}
& & S_1' (x_0) &= S_n' (x_n) = 0 &&\text{(clamped boundary conditions),} \\
& \text{or} & S_1'' (x_0) &= S_n'' (x_n) = 0 && \text{(natural boundary conditions)}
\end{flalign*}
\end{document}
If you want to left-align the material, you need to provide alignments points via &
symbols.
\documentclass{article}
\usepackage{amsmath} % for 'align*' environment
\begin{document}
\begin{align*}
&S_1' (x_0) = S_n' (x_n) = 0 \quad \text{(clamped boundary conditions), or} \\
&S_1'' (x_0) = S_n'' (x_n) = 0 \quad \text{(natural boundary conditions)}
\end{align*}
\end{document}
you forgot on anchors for align (ampersands) :
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{aligned}
S_1' (x_0) & = S_n' (x_n) = 0 \quad \text{(clamped boundary conditions),} \quad \text{or} \\
S_1'' (x_0) & = S_n'' (x_n) = 0 \quad \text{(natural boundary conditions)}
\end{aligned}
\end{equation*}
\end{document}