I am having trouble aligning my algorithm with the text outside of it. Here is an example:
\documentclass[11pt]{article}
\pagestyle{empty}
\oddsidemargin -0.25in
\textwidth 7.0in
\topmargin 0.0in
\headheight 0.0in
\headsep 0.0in
\topskip 0.0in
\footskip 0.4in
\textheight 8.8in
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{graphicx} %for including .jpeg files
\usepackage[algoruled,vlined,linesnumbered]{algorithm2e}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage{float}
\usepackage{amstext} % for \text macro
\usepackage{array} % for \newcolumntype macro
\begin{document}
\begin{enumerate}
\item
\begin{enumerate}
\item Some text describing the algorithm Some text describing the algorithm Some text describing the algorithm Some text describing the algorithm
\begin{figure}[h]
\centering
\begin{minipage}[h]{0.7\linewidth}
\begin{algorithm}[H]
\caption{\textsc{Some Algo}($I$)}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\SetCustomAlgoRuledWidth{1cm}
\SetAlgoLined
\DontPrintSemicolon
\SetArgSty{textnormal}
\Input{Some input description.}
\Output{Some output description.}
\For{$i \leftarrow 1$ to $n$} {
Do something \;
}
\end{algorithm}
\end{minipage}
\end{figure}
Some text describing the algorithm Some text describing the algorithm Some text describing the algorithm Some text describing the algorithm
\begin{figure}[h]
\centering
\begin{minipage}[h]{0.9\linewidth}
\begin{algorithm}[H]
\caption{\textsc{Some Algo}($I$)}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\SetCustomAlgoRuledWidth{1cm}
\SetAlgoLined
\DontPrintSemicolon
\SetArgSty{textnormal}
\Input{Some input description.}
\Output{Some output description.}
\For{$i \leftarrow 1$ to $n$} {
Do something \;
}
\end{algorithm}
\end{minipage}
\end{figure}
\end{enumerate}
\end{enumerate}
\end{document}
In both cases, the text outside of the algorithm is not aligned horizontally (to the left) with the start of the algorithm. Could someone give me some advice about this?
geometry
to set the page layout/geometry, instead of setting margin lengths manually.