8

In the caption of an algorithm created with algorithm2e,

\documentclass{article}

\usepackage[ruled]{algorithm2e}

\begin{document}

\begin{algorithm}[H]
\caption{Caption.}
pseudocode
\end{algorithm}

\end{document}

"Algorithm 1:" comes out bold. How could I change its font, say, to small caps?

Also, how could I make "Algorithm 1." appear instead?

1 Answer 1

7

The algorithm2e package offers \SetAlgoCaptionSeparator to change the caption separator and \AlCapFnt to control the font for the label of the caption:

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

\SetAlgoCaptionSeparator{.}
\renewcommand\AlCapFnt{\normalfont\scshape}

\begin{document}

\begin{algorithm}[H]
\caption{Caption.}
pseudocode
\end{algorithm}

\end{document}

enter image description here

2
  • 1
    Thanks. I've seen \renewcommand{\AlCapSty}{\textsc} used instead of \renewcommand\AlCapFnt{\normalfont\scshape} (in this example). Do they do the same thing? Is one safer to use than the other?
    – MSC
    May 14, 2013 at 15:49
  • 2
    @MSC \renewcommand{\AlCapSty}{\textsc} is wrong and it will produce errors, since \textsc expects an argument. Using the font switch \scshape, as in my answer, is the right way to do the redefinition. May 14, 2013 at 15:51

You must log in to answer this question.

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