6

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[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}

What went wrong?

Thanks

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Mar 8 '15 at 7:01
  • 1
    Show us "the code" in the form of a minimal example that we can copy-and-paste-and-compile and replicate your output. – Werner Mar 8 '15 at 7:03
  • Thanks for your replies. I have edited the post and added the code to compile – Hanin Abubaker Mar 8 '15 at 7:54
8

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.

  • @HaninAbubaker You're welcome – karlkoeller Mar 8 '15 at 10:02
  • @HaninAbubaker Your old algorithm has been removed from my answer ;-) – karlkoeller Mar 18 '15 at 6:03
  • Yes I know, I did that to remove my work and leave your answer for future viewers. Hope you did not feel bad about that. Thax for understanding :) – Hanin Abubaker Mar 19 '15 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.