Complex matrices column alignment on sign
If no further packages can be loaded you have to add the correct \medmuskip
around the binary operators by hand
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ % never use $$...$$ in LaTeX: https://tex.stackexchange.com/q/503/82917
\left[
\begin{array}{*{3}{r@{\mskip\medmuskip}c@{\mskip\medmuskip}l}}
64&+&2.828i & 1&+&1i & 36&+&2.449i \\
9&+&1.732i & 25&+&2.236i & 49&+&2.646i \\
16&+&2i & 81&+&3i & 4&+&1.414i
\end{array}
\right]
\]
\end{document}
Why not simply three aligned environment inside a
\bmatrix`?
Unrelated: for displayed equations, use the latex construct \[ ... \]
, note plain TeX $$ ... $$
.
\documentclass[11pt, titlepage, oneside, a4paper]{article}
\usepackage{amsmath}
\begin{document}
\[ \begin{bmatrix}
\, \begin{aligned}
64&+2.828i \\ 9&+1.732i \\ 16&+2i
\end{aligned}
& \begin{aligned}
1&+1i \\ 25&+2.236i \\ 81&+3i
\end{aligned}
& \begin{aligned}
36&+ 2.449i \\ 49&+ 2.646i \\ 4 & + 1.414i
\end{aligned}\,
\end{bmatrix} \]
\end{document}
If you're willing to work with some other packages, you can capture the argument of every cell in a newly-defined column (say) I
and then process (separating out the real/imaginary parts):
\documentclass{article}
\usepackage{amsmath,eqparbox,collcell,etoolbox}
\newcolumntype{I}{>{\collectcell\RpmI}c<{\endcollectcell}}
\makeatletter
\def\rplusi@#1+#2\relax{% R + Ii
\eqmakebox[R][r]{$#1$} + \eqmakebox[I][l]{$#2$}%
}
\def\rminusi@#1-#2\relax{% R - Ii
\eqmakebox[R][r]{$#1$} - \eqmakebox[I][l]{$#2$}%
}
\newcommand{\RpmI}[1]{%
\def\abc{#1}% Store argument R +/- Ii
\patchcmd{\abc}{+}{+}{%
\expandafter\rplusi@#1\relax% R + Ii
}{%
\expandafter\rminusi@#1\relax% R - Ii
}%
}
\makeatother
\begin{document}
\textbf{Works for real matrices:}
\[
\left[\begin{array}{ccc}
64 - 2.828i & 1 + 1i & 36 - 2.449i \\
9 + 1.732i & 25 - 2.236i & 49 + 2.646i \\
16 - 2i & 81 + 3i & 4 - 1.414i
\end{array}\right]
\]
\textbf{Workaround:}
\[
\left[\begin{array}{III}
64 - 2.828i & 1 + 1i & 36 - 2.449i \\
9 + 1.732i & 25 - 2.236i & 49 + 2.646i \\
16 - 2i & 81 + 3i & 4 - 1.414i
\end{array}\right]
\]
\end{document}