![在 LaTeX 中编写算法时不显示 {Begin End}](https://linux22.com/image/306970/%E5%9C%A8%20LaTeX%20%E4%B8%AD%E7%BC%96%E5%86%99%E7%AE%97%E6%B3%95%E6%97%B6%E4%B8%8D%E6%98%BE%E7%A4%BA%20%7BBegin%20End%7D.png)
我正在使用 LaTeX 编写算法
\usepackage[ruled,vlined]{algorithm2e}
运行代码时,生成的文件不会显示在使用时应该自动出现的单词“end”
\Begin{ %my Code}
生成的文本仅显示“开始”
代码:
%&latex
\documentclass[onecolumn]{IEEEtran}
%\usepackage{subfigure}
\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png,.eps}
\else
\usepackage[dvips]{graphicx}
\DeclareGraphicsExtensions{.eps}
\fi
\setlength{\pdfpagewidth}{8in}
\setlength{\pdfpageheight}{11in}
%\usepackage{graphicx}
\usepackage{pifont}
\usepackage{cite}
\usepackage{caption}
%\usepackage{subcaption}
\usepackage{url}
\usepackage{multirow}
\usepackage[cmex10]{amsmath}
\usepackage{amsmath,amssymb}
%\usepackage{algorithmic}
\usepackage{mdwmath}
\usepackage{float}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{varwidth,xcolor}
%\usepackage[ruled,noresetcount,noend]{algorithm2e}
%\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}
\usepackage{float}
\usepackage[caption = false]{subfig}
%\usepackage[titlenumbered,ruled]{algorithm2e}
\usepackage[ruled,vlined]{algorithm2e}
%today
%\usepackage{algcompatible}
%\usepackage[table,xcdraw]{xcolor}
%\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}
\hyphenation{op-tical net-works semi- conduc-tor}
%phases
\newcommand{\var}[1]{\text{\texttt{#1}}}
\newcommand{\func}[1]{\text{\textsl{#1}}}
\begin{document}
\begin{algorithm}
\caption{Arabic reCAPTCHA Control Word Classification}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{User inputs: control text, suspicious text}
\Output{Update database tables}
\SetKwBlock{Beginn}{beginn}{ende}
\Begin{
}
\end{algorithm}
\end{document}
什么地方出了错?
谢谢
答案1
您只需要在加载时使用该选项lined
而不是。vlined
algorithm2e
梅威瑟:
%&latex
\documentclass[onecolumn]{IEEEtran}
%\usepackage{subfigure}
\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png,.eps}
\else
\usepackage[dvips]{graphicx}
\DeclareGraphicsExtensions{.eps}
\fi
\setlength{\pdfpagewidth}{8in}
\setlength{\pdfpageheight}{11in}
%\usepackage{graphicx}
\usepackage{pifont}
\usepackage{cite}
\usepackage{caption}
%\usepackage{subcaption}
\usepackage{url}
\usepackage{multirow}
\usepackage[cmex10]{amsmath}
\usepackage{amsmath,amssymb}
%\usepackage{algorithmic}
\usepackage{mdwmath}
\usepackage{float}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{varwidth,xcolor}
%\usepackage[ruled,noresetcount,noend]{algorithm2e}
%\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}
\usepackage{float}
\usepackage[caption = false]{subfig}
%\usepackage[titlenumbered,ruled]{algorithm2e}
\usepackage[ruled,lined]{algorithm2e}
%today
%\usepackage{algcompatible}
%\usepackage[table,xcdraw]{xcolor}
%\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}
\hyphenation{op-tical net-works semi- conduc-tor}
%phases
\newcommand{\var}[1]{\text{\texttt{#1}}}
\newcommand{\func}[1]{\text{\textsl{#1}}}
\begin{document}
\begin{algorithm}
\caption{Arabic reCAPTCHA Control Word Classification}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}
\Input{User inputs: control text, suspicious text}
\Output{Update database tables}
\SetKwBlock{Beginn}{beginn}{ende}
\Begin{
}% end for begin
\end{algorithm}
\end{document}
输出:
如果您只希望此算法有此行为,请保留vlined
选项并发出
\SetAlgoLined
在算法的开始处。