I have a matrix that I would like to be centered in the middle of the page, however it is showing up left-aligned.
\begin{figure}[ht]$
\centering
\begin{bmatrix}
0 & C_l & 0 & 0 & \dots & \dots & \dots & 0 \\
0 & 0 & C_l & 0 & \dots & \dots & \dots & \vdots \\
0 & C_r & 0 & C_l & \dots & \dots & \dots & \vdots \\
0 & 0 & C_r & 0 & \ddots & \dots & \dots & \vdots \\
\vdots & \hdots & \hdots & \ddots & \ddots & \ddots & \hdots & \vdots \\
\vdots & \hdots & \hdots & \hdots & \ddots & \ddots & C_l & 0 \\
\vdots & \hdots & \hdots & \hdots & \hdots & \ddots & \ddots & 0 \\
0 & \hdots & \hdots & \hdots & \hdots & \hdots & C_r & 0 \\
\end{bmatrix}$
\caption{$n \times n$ transition matrix for a classical random walk.}
\end{figure}
How can I center this matrix?
figure
environment and use \usepackage{caption} if you need to make legend for that matrix. Change tocaptionof
also. Please post a MWE also.\begin{figure}[ht]\centering $\begin{bmatrix}
...