[Tex/LaTex] Alignment in equations

alignequations

I want to write two simple equations one below the other, but it seems that aligned environment aligns to the right and I want to align them to the left. Here is the code:

\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}

which produces

enter image description here

but I want S_1''(x_0) to appear directly below S_1'(x_0), not to be moved to the left. Do you please know the solution?

Best Answer

If you want to left-align the material, you need to provide alignments points via & symbols.

enter image description here

\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}