if语句换行之后,没有缩进对齐

2020-02-12 15:20发布

```tex \documentclass[11pt]{article} \usepackage{CJK} \usepackage[top=1cm, bottom=1cm, left=1.5cm, r...

```tex \documentclass[11pt]{article} \usepackage{CJK} \usepackage[top=1cm, bottom=1cm, left=1.5cm, right=1.5cm]{geometry} \usepackage{algorithm} \usepackage{algorithmicx} \usepackage{algpseudocode} \usepackage{amsmath} \usepackage{tabularx} \usepackage{algpseudocode} \usepackage{geometry} \geometry{paperheight=297mm, paperwidth=150mm} \floatname{algorithm}{Algorithm} \makeatletter \newcommand{\multiline}[1]{% \begin{tabularx}{\dimexpr\linewidth-\ALG@thistlm}[t]{@{}X@{}} #1 \end{tabularx} } \makeatother \begin{document} \begin{CJK*}{UTF8}{gkai} \begin{algorithm} \caption{:Intelligent CATG Algorithm} \begin{algorithmic}[1]%每行显示行号 %for loop % \begin{minipage}[t]{0.9\linewidth} \For {every time step {$T_C$}} \If {% the traffic is to be groomed, calculate the allocated bandwidth for each ONU in the cluster} \EndIf \EndFor % \end{minipage} \end{algorithmic} \end{algorithm} \end{CJK*} \end{document} ``` \multiline{} ![](https://pics.latexstudio.net/data/images/202002/1c5e8b75721944f.png)
1条回答
```tex \documentclass[11pt]{article} \usepackage[a4paper]{geometry} \usepackage{algorithm} \usepackage{algorithmicx} \usepackage{algpseudocode} \usepackage{amsmath} \usepackage{tabularx} \usepackage{algpseudocode} \floatname{algorithm}{Algorithm} \begin{document} \begin{algorithm} \caption{:Intelligent CATG Algorithm} \begin{algorithmic}[1] \For {every time step {$T_C$}} \If{the traffic is to be groomed, calculate the allocated bandwidth for each ONU \hspace*{0.8\dimexpr\algorithmicindent} in the cluster} \EndIf \EndFor \end{algorithmic} \end{algorithm} \end{document} ``` 要求不高就手动调

一周热门 更多>