# Centered LaTeX program written

I have a somewhat working LaTeX program written. One thing I would like to be better is the centering of the \begin{align*}...\end{align*}.

I tried \begin{gather*}...\end{gather*} but I can not get it to work with heavy math Latex code just text.

I would also like to know the Latex code for a single space.

Here is my code:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\centering
\begin{gather*}
Given:\\
3 consecutive R vectors.\\
\\
Find:\\
Middle Velocity vector and Keplerian Elements.\\
\\
Solution:\\
\end{gather*}
\begin{align*}
R1=(X1,Y1,Z1)\\
R2=(X2,Y2,Z2)\\
R3=(X3,Y3,Z3)\\
C_{12} &= R1 \times R2 = \begin{vmatrix}%
\hat{x}& \hat{y}& \hat{z}\\
X1&Y1&Z1\\
X2&Y2&Z2\\
\end{vmatrix}\\
C_{12}x &= (Y1 * Z2 - Z1 * Y2)\\
C_{12}y &= (Z1 * X2 - X1 * Z2)\\
C_{12}z &= (X1 * Y2 - Y1 * X2)
\end{align*}
\end{document}

• gather* works if you remove those & before =, for example, C_{12}x = (Y1 * Z2 - Z1 * Y2)\\  – user11232 Mar 27 '15 at 0:21
• Should the text be centered as well, or just the math material? – Mico Mar 27 '15 at 1:21
• this appears to be a follow-on to How do you center everything. it's usually appreciated if that is noted in the newer question. – barbara beeton Mar 27 '15 at 13:13

You have to use gather* without the alignment point, i.e., remove those & before =. There is no point in aligning when you want every thing to be centered.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\centering
Given:

3 consecutive R vectors.

Find:

Middle Velocity vector and Keplerian Elements.

Solution:
\begin{gather*}
R1=(X1,Y1,Z1)\\
R2=(X2,Y2,Z2)\\
R3=(X3,Y3,Z3)\\
C_{12} = R1 \times R2 = \begin{vmatrix}%
\hat{x}& \hat{y}& \hat{z}\\
X1&Y1&Z1\\
X2&Y2&Z2\\
\end{vmatrix}\\
C_{12}x = (Y1 * Z2 - Z1 * Y2)\\
C_{12}y = (Z1 * X2 - X1 * Z2)\\
C_{12}z = (X1 * Y2 - Y1 * X2)
\end{gather*}
\end{document}