在word中插入latex伪代码

使用word时,需要插入latex样式的伪代码,如下所示:


word中插入latex伪代码

安装后打开word,如果有插件直接在插件里打开,没有的话就在插入-对象-Aurora equation打开。

image.png

导入包:Properties→packages粘贴一下的包:

\usepackage{amsmath}
\usepackage{amssymb}
% \usepackage{euler}
\usepackage{amsfonts}
\usepackage{mathrsfs}

\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}

\usepackage{multirow}
\usepackage{CJK}
\usepackage{algorithm}
\usepackage{algorithmic}

\providecommand{\abs}[1]{\left\lvert#1\right\rvert}
\providecommand{\norm}[1]{\left\lVert#1\right\rVert}

正文可以复制代码(以下为参考示例)

\renewcommand{\thealgorithm}{1}   %定义算法的编号
\begin{algorithm}[H]
    \caption{Doppler Profile Extraction}
\begin{algorithmic}[1]
    \REQUIRE{Spectrogram matrix $P$, centre frequency bin $cf$}
    \ENSURE{Doppler shift profile $DopShift$}\\
    \STATE{colNum=getColumNum($P$);} \\
    \STATE{$DopShift$(1:colNum)=$cf$;}  //initialization \\
    \FOR{i=1:colNum}
        \STATE row=getNonNullRows(col(i)); // get non-null rows of the $i$th col\\
    \IF{isNotEmpty(row)}
        \STATE{meanValue=mean(row);}\\
       \ElSE
              \STATE{meanValue\textgreater cf}\\
              \STATE{$DopShift$(i)=max(row);}\\
              \STATE{$DopShift$(i)=min(row);}\\
       \ENDIF
    \ENDFOR
    \STATE{$DopShift$ = SMA($DopShift$);} // SMA represents smoothed moving average filter\\
       \STATE{Return $DopShift$;}
\end{algorithmic}
\end{algorithm}

你可能感兴趣的:(在word中插入latex伪代码)