LaTex 演算法排版

2021-07-10 14:11:40 字數 2182 閱讀 7186



排版可能需要的包:

\usepackage //format of the algorithm

\usepackage //format of the algorithm

\usepackage //multirow for format of table

\usepackage

\usepackage

\declaremathoperator* //argmin或argmax公式的排版

\enewcommand} //use input in the format of algorithm

\enewcommand} //useoutput in the format of algorithm

\usepackage

\usepackage

\usepackage

演算法的排版舉例:

\begin[htb] %演算法的開始

\caption %演算法的標題

\label %給演算法乙個標籤,這樣方便在文中對演算法的引用

\begin[1] %這個1 表示每一行都顯示數字

\require ~~\ %演算法的輸入引數:input

the set of positive samples for current batch, $p_n$;\

the set of unlabelled samples for current batch, $u_n$;\

ensemble of classifiers on former batches, $e_$;

\ensure ~~\ %演算法的輸出:output

\ensemble of classifiers on the current batch, $e_n$;

\state extracting the set of reliable negative and/or positive samples $t_n$ from $u_n$ with help of $p_n$; label %演算法的乙個陳述,對應演算法的乙個步驟或公式之類的; label對此行的標記,方便在文中引用演算法的某個步驟

\state training ensemble of classifiers $e$ on $t_n cup p_n$, with help of data in former batches; label

\state $e_n=e_cup e$; label

\state classifying samples in $u_n-t_n$ by $e_n$; label

\state deleting some weak classifiers in $e_n$ so as to keep the capacity of $e_n$; label

\return $e_n$; %演算法的返回值

\end

\end

排版效果圖:

在文中對演算法和演算法的某個步驟的引用:therefore, in step

ef of algorithm

ef, we extract $t_n$, a set of reliable negative samples

1、 for和while迴圈語句的排版舉例

(1) 排版效果圖

(2)排版**

\begin[h]

\caption

\begin[1]

\for

\state initialize a tree $t_$ with only a leaf (the root);\

\state $t=tigcup t_;$\

\endfor

\forall )$} label

\state $t=t cup possample(c)$; label

\endfor;

\for

\state $//$ your source here;

\endfor

\state $//$ reusing recent base classifiers. label

\while

\state selecting the most recent classifier $c_i$ from $d$;

\state $d=d-c_i$;

\state $e_n=e_n+c_i$;

\endwhile label

\end

\end

LaTex演算法排版

需要包含的巨集包 usepackage noend usepackage 示例 begin t caption 演算法的名字 hspace 演算法的輸入,hspace 用來控制位置,同時利用 進行換行 input parameters a,b,c hspace 演算法的結果輸出 output res...

LaTeX演算法排版 筆記

usepackage noend usepackage begin t caption 演算法的名字 hspace 演算法的輸入,hspace 用來控制位置,同時利用 進行換行 input parameters a,b,c hspace 演算法的結果輸出 output result begin 1 ...

LaTex 文字排版

一 對齊段落 or newline 另起一行,而不是另起一段 在強制斷行後,還禁止分頁 newpage 另起一頁 linebreak n nolinebreak n pagebreak n nopagebreak n sloppy 降低一點兒標準 fussy 恢復為預設狀態 二 斷詞 hyphena...