I have a for loop in my algorithm and I can't get latex to properly indent the pseudocode inside it. It's just a mess at the moment, it won't even put the code in the for loop on separate lines.
\documentclass[a4paper,12pt,times,numbered,print,index]{Classes/PhDThesisPSnPDF}
\RequirePackage[left=37mm,right=30mm,top=35mm,bottom=30mm]{geometry}
\RequirePackage{libertine}
\RequirePackage[small,bf]{caption}
\RequirePackage[labelsep=space,tableposition=top]{caption}
\usepackage{subfig}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{braket}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\begin{document}
\begin{algorithm}
\caption{Generate transition matrix for one-dimensional quantum walk}\label{tran_mat_1d_qw}
\begin{algorithmic}[1]
\Procedure{generateTransitionMatrix}{$steps$}
\State $numElements \gets steps * 4 + 2$
\State $transitionMat \gets numElements \times numElements$ MATRIX
\BlankLine
\State $col \gets 0$
\For {$i = 1 \to (steps * 2) - 1$}
\State row \gets i * 2$
\STATE\hspace{\algorithmicindent} transitionMat[row, col] \gets $1$
\STATE\hspace{\algorithmicindent} transitionMat[row, col + 1] \gets $1$
\STATE\hspace{\algorithmicindent} transitionMat[row + 5, col] \gets $1$
\STATE\hspace{\algorithmicindent} transitionMat[row + 5, col + 1] \gets $-1$
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}

\documentclassand includes all your packages and definitions so that it can be compiled readily by those trying to help you. – Steven B. Segletes Apr 04 '14 at 19:34\begin{document}must follow the\usepackagedeclarations). Also, since the document class is not standard, the rest of us can't access it. Are you able to recreate the problem using a standard document class likearticle? If so, that makes for a much more useful MWE. Additionally, things like\BlankLineare not defined by the standard document classes. While I can guess what it might mean, it makes for a lot of work for those trying to help. – Steven B. Segletes Apr 04 '14 at 19:44