LaTeX学习摘记(七):算法

\usepackage[linesnumbered,ruled]{algorithm2e}

\usepackage[linesnumbered,ruled,vlined(去除end,竖线变为竖横线)]{algorithm2e}

\let\chapter\undefined   ç 去除错误的不知道原因

增大行距:

\DontPrintSemicolon 行末尾的分号不显示

\SetKwBlock{Function}{function}{end} 设置子模块

调整算法字体:

\SetAlFnt{\normalsize} 算法正文

\SetAlCapFnt{\large} 算法帽

\SetAlCapNameFnt{\large} 算法名字

* 放在算法外面

注释:

There are two ways to do comments inalgorithm :

1. by using a comment macro defined by\SetKwComment{command}{right mark}{left mark}

(see below) like \tcc;

2. by using side comment, it means commentput in between ( ) after control command like

if-then-else, for, ... macros.

At section 9.3, you can see how \tcc isdefined and at section 9.4 you can look at some examples

how to use it with if then else likecommands and finally you can look at section 10.4 how to

define comments and explanations on thedifferent macros and ways of printing comments. Note

also that comments are not numbered bydefault when using linesnumbered option. You have to

set commentsnumbered to number them also.

The following macro control how comment aretypeseted.

\SetSideCommentLeft right justified sidecomments (side comments are flushed to the right),

equivalent to scleft option.

\SetSideCommentRight left justified sidecomments (side comments are put right after the code

line) , equivalent to scright option.

\SetFillComment end mark of comment isflushed to the right so comments fill all the width of

text, equivalent to fillcomment option.

\SetNoFillComment end mark of comment isput right after the comment, equivalent to nofillcomment

option.

预定义的

• \tcc{line(s) of comment}: comment “la” C

• \tcc*{right justified side comment}: comment “la” C

• \tcc*[r]{right justified side comment, ends the line (default)}: comment “la” C

• \tcc*[l]{left justified side comment, ends the line}: comment “la” C

• \tcc*[h]{left justified comment, without end line; useful with”if-then-else” macros for example}:

comment “ la” C

• \tcc*[f]{right justified comment, without end line; useful with”if-then-else” macros for example}:

comment “ la” C

• \tcp{line(s) of comment}: comment “la” C++

• \tcp*{right justified side comment}: comment “la” C++

• \tcp*[r]{right justified side comment, ends the line (default)}: comment “la” C++

• \tcp*[l]{left justified side comment, ends the line}: comment “la” C++

• \tcp*[h]{left justified comment, without end line; useful with”if-then-else” macros for example}:

comment“ la” C++

• \tcp*[f]{right justified comment, without end line; useful with”if-then-else” macros for

example}: comment “la” C++


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值