12

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.

1
  • Hi Student, welcome to TeX.sx! I removed the sign-off as this is provided automatically with your user badge.
    – qubyte
    Commented Feb 21, 2012 at 12:47

1 Answer 1

8

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)
5
  • @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:-).
    – user10274
    Commented Feb 21, 2012 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
    Commented Feb 21, 2012 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.)
    – user10274
    Commented Feb 21, 2012 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....
    – user10274
    Commented Feb 21, 2012 at 19:38
  • @MarcvanDongen I've added the excerpt from the .sty file, where it's said that the parameters can be customized by the user. Thanks for the remark: I agree that relying on undocumented features can be very dangerous.
    – egreg
    Commented Feb 21, 2012 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .