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.

I would like to present an algorithm in my work and I used the package algorithm2e. I wonder if there is a way to control hrule thickness with ruled option, so one can use thicker line pre-caption or post of it.

Any help is much appreciated.

share|improve this question
Hi Student, welcome to TeX.sx! I removed the sign-off as this is provided automatically with your user badge. –  qubyte Feb 21 '12 at 12:47

1 Answer 1

It's undocumented, but doable: these should be equivalent to the default setting

\setlength{\algoheightrule}{0.8pt} % thickness of the rules above and below
\setlength{\algotitleheightrule}{0.8pt} % thicknes of the rule below the title

Change as you wish.

From algorithm2e.sty:

%   - november 17 2009  - revision 4.00 -
% * ADD/FIX: rules of ruled, algoruled, tworuled styles used rules of different sizes! This
%            is now fixed. Moreover size of the rules is now controlled by a length and so
%            can be customized by the user.
%            \algoheightrule is the height of the rules and can be changed via \setlength
%            \algoheightruledefault is the default height of he rules (0.8pt)
%            \algotitleheightrule is the height of the rule that comes just after the
%            caption in ruled and algoruled style; it can be changed via \setlength
%            \algotitleheightruledefault is the default height of this rules (0.8pt)
share|improve this answer
It works, Thank you very much. –  Student Feb 21 '12 at 12:58
@egreg No offence, I'm sure you understand. I want to make a general statement that applies to any solution. If it's not documented, it's better not to rely on the implementation. Lots of "solutions" that work now will break if the implementation changes. Looking at the implementation and using the implementation details completely defeats the purpose of the implementor's effort to hide the implementation details (encapsulation). Trying to solve a problem with the existing API is more fun and teaches you more about the package philosophy:-). –  Marc van Dongen Feb 21 '12 at 19:09
@MarcvanDongen You're right, in general. In this case there's no other way. Looking at the notes in the package, the parameters have been added just in order to be customizable and probably the author forgot to document them. –  egreg Feb 21 '12 at 19:13
@egreg Thanks for letting me know. (I just wanted to make the point somewhere because lots of "solutions" rely on techniques that aren't documented.) –  Marc van Dongen Feb 21 '12 at 19:15
@egreg Just one final comment. The only reason why I made my comment to your solution (as opposed to any solution) is because you actually mentioned undocumented.... –  Marc van Dongen Feb 21 '12 at 19:38

Your Answer


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.