关于latex伪代码

\documentclass{
    
    ctexart}
\usepackage{
    
    algorithm}
\usepackage{
    
    algpseudocodex}
\makeatletter
\algnewcommand\algorithmicinit{
    
    \textbf{
    
    Init:}}
\algnewcommand\Init{
    
    %
\algpx@endCodeCommand%
\ifnumcomp{
    
    0}{
    
    <}{
    
    \FSSize{
    
    algpx@startNewCodeBoxQueue}}{
    
    \setbool{
    
    algpx@setNorth}{
    
    true}}{
    
    }%
\algpx@drawInItem{
    
    \algorithmicinit}%
}
\makeatother
\begin{
    
    document}
\begin{
    
    algorithm}
\caption{
    
    title}
\begin{
    
    algorithmic}[1]
\Require $x \in \{
    
    0,1\}$
\Ensure $y \in \{
    
    1,2\}$
\Init $y \in \{
    
    1,2\}$
\end{
    
    algorithmic}
\end{
    
    algorithm}
\end{
    
    document}

在这里插入图片描述


\usepackage{
    
    algpseudocodex}
\makeatletter
\algnewcommand\algorithmicinit{
    
    \textbf{
    
    初始化:}}
\algnewcommand\Init{
    
    %
\algpx@endCodeCommand%
\ifnumcomp{
    
    0}{
    
    <}{
    
    \FSSize{
    
    algpx@startNewCodeBoxQueue}}{
    
    \setbool{
    
    algpx@setNorth}{
    
    true}}{
    
    }%
\algpx@drawInItem{
    
    \algorithmicinit}%
}
\makeatother
\def\gobbletwo#1#2{
    
    }
\expandafter\gobbletwo

猜你喜欢

转载自blog.csdn.net/qq_45542321/article/details/129093068