admin管理员组

文章数量:1794759

如何在word中写伪代码

如何在word中写伪代码

如何在word中写伪代码 1.下载texlive

参考

2.下载Aurora

链接:pan.baidu/s/1A_IFxdJ6rrpuWUY1DN-YOQ 提取码:ylmo 复制这段内容后打开百度网盘手机App,操作更方便哦

3.设置

打开Aurora的输入界面,在Properties的Packages选项卡中输入:

\\documentclass{article} \\usepackage{multirow} \\usepackage{algorithm} \\usepackage{algpseudocode} \\usepackage{amsmath} \\usepackage{geometry} \\usepackage{algorithmicx} \\usepackage{algpseudocode} \\renewcommand{\\algorithmicrequire}{\\textbf{Input:}} % Use Input in the format of Algorithm \\renewcommand{\\algorithmicensure}{\\textbf{Output:}} 4.伪代码使用介绍 1.模版 \\renewcommand{\\thealgorithm}{1} \\begin{algorithm}[H] \\caption{example} \\begin{algorithmic}[1] \\Require {F,P,l} \\Ensure {P} \\state $sss$ \\end{algorithmic} \\end{algorithm}

这就是一个基础模版,第一行的1是算法1 caption是题目 Require是输入参数 Ensure是输出参数 中间可以写自己要输出的代码 然后点击Refresh就可以更新伪代码

2.使用技巧

文字写$$外边,表达式写里面 在一起连着的字母或者表达式要用{}来表示这是一个整体 f_i i为下标 f_{i+1} i+1为下标 \\gets 左赋值 \\leq 小于等于 \\geq大于等于 \\neq不等于 \\textbf{and} 会把and变成黑色字体 \\mod 取余

for循环

\\For{$i=1;i<l-1;i++$} \\State $ f_i \\gets f_(i+1) ;$ \\EndFor

while循环

\\While{(a$>$b)} \\State state4...... \\If { c$<$d} \\State state5...... \\Else \\State state6...... \\EndIf \\State state7...... \\EndWhile 3.代码示例 \\renewcommand{\\thealgorithm}{1} \\begin{algorithm}[H] \\caption{example} \\begin{algorithmic}[1] \\Require {F,l} \\Ensure {P} \\For{$i=0;i<l;i++$} \\If {$f_i > f_{i+1}$} \\State return $f_{i+1}$; \\Else \\If {$f_i \\neq 0$} \\State return $f_i$; \\EndIf \\EndIf \\State $P[i] \\gets f_i;//$xxxxxxxxxxxxxxxxx \\EndFor \\State Return P; \\end{algorithmic} \\end{algorithm} 5.插入表格 \\begin{table} \\centering \\begin{tabular}{|l|c|c|}\\hline Setting&\\multicolumn{2}{c|}{A4 size paper}\\\\\\hline &mm&inches\\\\ Top&25&1.0\\\\ Bottom&25&1.0\\\\ Left&20&0.8\\\\ Right&20&0.8\\\\ Column Width&82&3.2\\\\ Column Spacing&6&0.25\\\\\\hline \\end{tabular} \\caption{Margin settings for A4 size paper} \\end{table}

将上面代码复制,然后点Paste from Tex

本文标签: 代码如何在word中写伪