LaTeX 排版問題之演算法設計

2021-07-04 18:00:02 字數 1798 閱讀 8702

自己寫的乙個演算法,可能用到的包

\usepackage %format of the algorithm

\usepackage %format of the algorithm

\usepackage %multirow for format of table

\usepackage

\usepackage

用到的命令

\renewcommand}

\renewcommand}

\renewcommand}

注:使用第三個需要修改\ctex\miktex\tex\latex\algorithms目錄下的algorithmc檔案,首先找到

% algorithmic

\newcommand}

\newcommand}

下面加入一句:

\newcommand}

再找到\newcommand

\newcommand

在後面加入一句

\newcommand

就可以使用了。

另外還有一些特殊符號的使用。完整**如下

\documentclass[11pt]

\usepackage %format of the algorithm

\usepackage %format of the algorithm

\usepackage %multirow for format of table

\usepackage

\usepackage

\renewcommand}

\renewcommand}

\renewcommand}

\begin

\begin

\caption

\label

\begin

\require ~~\\

\ensure ~~\\

$\widehat$=\_1$,$\hat_2$,...,$\hat_m$\}: set of clusters\\

$n_t$=$\vert t \vert$: number of trajectories\\

p($f$$\vert t$): conditional probability distrution\\

create $\widehat$=$t$;\\

_a$,$\hat_b$} is candidate clusters\\

break\\

\initial ~~\\

create $\widehat$=$t$:\\

\if_a$,$\hat_b$)$>$ max\_a$),r($\hat_b$)\}}

\state \_a$,$\hat_b$\} is not candidate clusters,create $\delta i$ matrix:\\

\else

\state \_a$,$\hat_b$\} is candidate clusters\\

break\\

\endif

\for \vert$}

%\state

\forall

\state

calculate $\delta i$($\hat_i$,$\hat_j$) by [ ]

\endfor

\endfor

\end

\end

\end

效果圖如下:

LaTex 演算法排版

排版可能需要的包 usepackage format of the algorithm usepackage format of the algorithm usepackage multirow for format of table usepackage usepackage declarema...

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 ...