# Problems with centering a border matrix

I have the following code:

\begin{figure}[h!]
\centering
\bordermatrix{~& \ket{\Phi_{0}} & \ket{S} & \ket{D} & \ket{T} & \ket{Q} & \dots \cr
\bra{\Phi_{0}} & E_{0} & \textbf{0} & \dirint{\Phi_{0}}{\hat{H}}{D} & \textbf{0} & \textbf{0} & \dots \cr
\bra{S} &  & \dirint{S}{\hat{H}}{S} & \dirint{S}{\hat{H}}{D} & \dirint{S}{\hat{H}}{T} & \textbf{0} & \dots \cr
\bra{D} &  &  & \dirint{D}{\hat{H}}{D} & \dirint{D}{\hat{H}}{T} & \dirint{D}{\hat{H}}{Q} & \dots \cr
\bra{T} &  &  &  & \dirint{T}{\hat{H}}{T} & \dirint{T}{\hat{H}}{Q} & \dots \cr
\bra{Q} &  &  &  &  & \dirint{Q}{\hat{H}}{Q} & \dots \cr
\vdots  &  &  &  &  &  & \ddots \cr}
\caption{Structure of the full-CI matrix. The matrix is hermitian, therefore, only the
upper triangle is shown. The multitudes of singly, doubly, triply, etc. excited determinants
are denoted as \ket{S}, \ket{D}, \ket{T}, etc.}
\label{fig:FCI_mat}
\end{figure}


It compiles, but the matrix is not centered. Actually, removing \centering does not change the position of the matrix - it remains left aligned. Does anyone know how to put it in the centre?

Thanks!

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jan 22 '15 at 12:53
• You say "it compiles" but it must generate multiple error messages. – David Carlisle Jan 22 '15 at 17:12

Put \bordermatrix inside




and make it a display equation.

\documentclass{article}
\usepackage{amsmath,braket}
\newcommand{\dirint}{\int}    %% just for compiling, change it in your file
\begin{document}
\begin{figure}[h!]
$\bordermatrix{~& \ket{\Phi_{0}} & \ket{S} & \ket{D} & \ket{T} & \ket{Q} & \dots \cr \bra{\Phi_{0}} & E_{0} & \textbf{0} & \dirint{\Phi_{0}}{\hat{H}}{D} & \textbf{0} & \textbf{0} & \dots \cr \bra{S} & & \dirint{S}{\hat{H}}{S} & \dirint{S}{\hat{H}}{D} & \dirint{S}{\hat{H}}{T} & \textbf{0} & \dots \cr \bra{D} & & & \dirint{D}{\hat{H}}{D} & \dirint{D}{\hat{H}}{T} & \dirint{D}{\hat{H}}{Q} & \dots \cr \bra{T} & & & & \dirint{T}{\hat{H}}{T} & \dirint{T}{\hat{H}}{Q} & \dots \cr \bra{Q} & & & & & \dirint{Q}{\hat{H}}{Q} & \dots \cr \vdots & & & & & & \ddots \cr}$
\caption{Structure of the full-CI matrix. The matrix is hermitian, therefore, only the
upper triangle is shown. The multitudes of singly, doubly, triply, etc. excited determinants
are denoted as $\ket{S}$, $\ket{D}$, $\ket{T}$, etc.}
\label{fig:FCI_mat}
\end{figure}
\end{document}


• I don't know why you need to use figure environment but if your intention is to add the caption, remove figure environment and usr \captionof{figure}{caption here} with \usepackage{capt-of} in the preamble. – user11232 Jan 22 '15 at 12:59