我正在使用以下序言输入一个算法
\usepackage{algorithm}
\usepackage{algpseudocode}
\algnewcommand{\LeftComment}[1]{\(\triangleright\) #1}%
\algrenewcommand\algorithmicindent{0.6em}%
整个算法左侧有一个缩进,如下图所示。如何删除这个缩进?
这是算法代码
{\begin{algorithm}[H]
\floatname{algorithm}{Alg.}
\caption{Projected SGD for Model A, Batch Size=1}\label{alg:tellmain}
\begin{algorithmic}%[1]
\State Given: $\cF, \cFc$. Hyperparameters: $\alpha, \eta, \rS$.
\For{each fact $f' \in \cF$}
\State Mark $f'$ as seen.
\For{$\rS$ steps}
\State Sample $\fc = (\bar{t}, \bar{r})$ from $\cFc$.
\State Set $f = f'$ with $p=0.5$,
\State $\qquad$or sample $f$ from seen facts.
\State Let $\vvv = \sigma(\ip{\rc}{\tc} - \ip{\r}{\t})$.
\State \LeftComment{Fix $\e$ and optimize ${J}$}.
\State {\small $\grad{\r}{\Jr} = {-\t}\vvv, \ \grad{\rc}{\Jr} = {\tc}\vvv$}
\State {\small$ (\r; \rc) = \proj((\r; \rc) - \eta ((\grad{\r}{\Jr}; \grad{\rc}{\Jr}) + 2\alpha (\r; \rc)))$}
\State \LeftComment{Fix $\r$ and optimize ${J}$}
\State {\small$\grad{\t}{\Je} = {-\r}\vvv, \ \grad{\tc}{\Je} = {\rc_1}\vvv$}
\State {\small $(\t; \tc) = \proj((\t; \tc) - \eta ((\grad{\t}{\Jr}; \grad{\tc}{\Jr}) + 2\alpha (\t; \tc)))$}
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}}
答案1
我不确定是否有简单的方法。这里有一个窍门:
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\algorithmic}
{\ALG@tlm\z@}{\leftmargin\z@\ALG@tlm\z@}
{}{}
\makeatother