Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How I can generate separator lines for captions as follows in algorithm2e?


Algorithm 1: Generate Separator Line


share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Use the ruled package option:

\documentclass{article}
\usepackage[ruled]{algorithm2e}

\begin{document}

\begin{algorithm}
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}

\end{document}

enter image description here

share|improve this answer
    
your explanation is way succincter and clearer than algorithm2e's documentation! Thanks –  pegausbupt Jun 19 '12 at 14:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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