[Tex/LaTex] {Begin End} does not show when writing algorithm in LaTeX

algorithm2ealgorithms

I am writing an algorithm in LaTeX using

\usepackage[ruled,vlined]{algorithm2e}

When running the code, the produced file does not show the word "end" that should appear automatically when using

\Begin{ %my Code}

The produced text shows only "begin"

The 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{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}

What went wrong?

Thanks

Best Answer

You simply have to use the option lined and not vlined when loading algorithm2e.

MWE:

%&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} 

Output:

enter image description here

If you want this behavior only for this algorithm, keep the vlined option and issue

\SetAlgoLined

at the beginning of your algorithm.

Related Question