\usepackage[linkbordercolor={0 0 1}]{hyperref}



    \textbf{Input} : An a $p^t$, prime $p$, 
     integer $t$ and data s above\;
    \textbf{Find} : A swq $G$\;

    \hspace{0.5cm} $L =\phi;B=\phi$\;
    \hspace{0.5cm} repeat\;
    \hspace{1cm} select largest ord$_G(a)$\;
    \hspace{1cm} $B=B\cup \{a\}$\;
    \hspace{1cm} $L^{'} $\;
   \hspace{1cm} \textbf{for} (each $b \in L^{'}$) remove all elements in 
   $U(b)$ from $M$\;
  \hspace{1cm} $L=L\cup L^{'}$\;
  \hspace{0.5cm} until $(\sum_{a_j \in B}R(a_j) =t)$\;



Question : How to design a vertical line between begin and end statement of the algorithm?

See the output:

enter image description here

  • For the future: Please format pasted code with the respective markdown. This increases readability ba a LOT :) – Raven Mar 21 '19 at 17:14
  • For Ravens comment: Hint if using a browser, you can highlight the code and hit Ctrl-k to get it formatted this way. – daleif Mar 21 '19 at 17:24
  • @daleif I do Ctrl-k but it works only for the first line of the code. – nice guy Mar 21 '19 at 17:45
  • @regarding the formatting of code in questions: Select the block of code first and then press Ctrl+k or the {} button. Regarding your question: You might want to use \Begin, \End , \Input,... instead of \textbf{...} – leandriis Mar 21 '19 at 18:32

You need to use the keywords defined by algorithm2e. Here's a better markup that does just that:

enter image description here





  \KwInput{An a $p^t$, prime $p$, integer $t$ and data s above}
  \KwFind{A swq $G$}
    $L = \phi$; $B = \phi$\;
    \Repeat{$\sum_{a_j \in B} R(a_j) = t$}{
      select largest $\mathrm{ord}_G(a)$\;
      $B = B \cup \{a\}$\;
      \For{each $b \in L'$}{
        remove all elements in $U(b)$ from $M$\;
      $L = L \cup L'$\;
  \caption{Algorithm caption}

| improve this answer | |

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.