常用
记得在两边加上$
和$
(好像只有在Word插件Aurora中需要这么做)
符号 | LaTeX代码 | 符号表示 |
---|---|---|
小于号 | \textless | < |
分数 | \frac{}{} | $\frac{}{}$ |
根号 | \sqrt{} | $$\sqrt{}$$ |
小空格 | \+空格 | -$$\ $$- |
长空格 | \quad | -$$\quad$$- |
章节符号 | \S3.1 | $$\S3.1$$ |
在Latex中使用algorithm2e显示if-elseif-else-endif
例子
算法伪代码:
使用Aurora+Algorithm2e在word中输入伪代码
效果:
实例代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22\begin{algorithm}[H]
\KwData{cWnd, sSthresh}
\KwResult{How does the Congestion Window of sender change}
initialization of cWnd and sSthresh\;
\While{running}{
\If{Receivied an ACK}{
\eIf{cWnd \textless sSthresh}{
cWnd+=MSS; (Slow Start)
}{
cWnd+=$\frac{MSS}{cWnd}$; (Congestion Avoidance)
}
}
\If{Encountered a loss}{
\eIf{cWnd \textless sSthresh}{
cWnd+=MSS; (Slow Start)
}{
cWnd+=$\frac{MSS}{cWnd}$; (Congestion Avoidance)
}
}
}
\caption{TCP Tahoe}
\end{algorithm}效果:
实例代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19\begin{algorithm}[H]
\KwData{cWnd, RTT, $\alpha$, $\beta$}
\KwResult{How does the Congestion Window of sender change}
initialization of cWnd and estimation of baseRTT\;
\While{running}{
\If{A RTT passed}{
\uIf{$ (\frac{cWnd}{RTT_{min}} -\frac{cWnd}{RTT} )\times RTT_{min}\textless \alpha $}{
cWnd+=MSS;
}
\ElseIf{$(\frac{cWnd}{RTT_{min}} -\frac{cWnd}{RTT} )\times RTT_{min}\textgreater \beta$}{
cWnd-=MSS;
}
}
\If{Encountered a loss}{
cWnd = $\frac{7}{8}$ cWnd;
}
}
\caption{TCP Vegas}
\end{algorithm}
- 本文链接:https://wan-nan.github.io/2023/04/23/LaTeX%E5%AD%A6%E4%B9%A0/
- 版权声明:本博客所有文章除特别声明外,均默认采用 许可协议。