latex语法学习笔记2

1 算法加入

在tex 文件开头引用以下包:
algorithm、algorithmics、algpseudocode、amsmath

\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}

如果算法中包含输入输出模块,还应加入如下代码:

\renewcommand{\algorithmicrequire}{\textbf{Input:}}  % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm

算法主体

\begin{algorithm}[thpb]
	\caption{algorithm name}
	\label{algorithmlabel}
	\begin{algorithmic}[1]
		\Require
		algorithm input
		\Ensure
		algorithm output 
	    \State algorithm content1;
		\While{while loop}
		\State algorithm content2;\EndWhile \\
		\Return algorithm output.
	\end{algorithmic}
\end{algorithm}

完成之后呈现为这种状态
在这里插入图片描述

注意:在while之后不要忘记endwhile
while内部的代码会自动缩近

2 各种文件

.bib 存放参考文献
.tex 文献源码
.bst 参考文献风格,与.bib组合使用
.sty 风格文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值