1

I am preparing a presentation, and I want the title of the algorithm without any numbering, and without any colons.

I use the commands

\renewcommand{\algorithmcfname}{}
\renewcommand{\thealgocf}{}

but now the colon still remains.

How can I get rid of the colon before the title of the algorithm?

MWE:

\documentclass[aspectratio=169]{beamer}
\usepackage[ruled,linesnumbered,noend]{algorithm2e}
\renewcommand{\algorithmcfname}{}
\renewcommand{\thealgocf}{}
\usecolortheme{frigatebird}
\begin{document}

\begin{frame}{Pseudocode template}
\begin{algorithm}[H]
    \caption[labelformat=empty]{\sc{TitleOfTheAlgorithm}}
    \KwIn{What is given to the algorithm}
    \KwOut{What the algorithm gives back}
    the commands\;
    executed\;
    by\;
    the algorithm\;

\end{algorithm}
\end{frame}
\end{document}

enter image description here

padawan
  • 1,532

2 Answers2

2

Here is a algorithm2e-fashion solution :

  1. Use \SetAlgoCaptionSeparator{} to remove the ":" in the algorithm caption see §9.2.2 of algorithm2e documentation
  2. Use \SetAlCapNameFnt{\scshape} to change the caption text font with small caps see §9.5.4 of algorithm2e documentation
% arara: lwpdflatex
\documentclass[aspectratio=169]{beamer}
\usepackage[ruled,linesnumbered,noend]{algorithm2e}
\renewcommand{\algorithmcfname}{}
\renewcommand{\thealgocf}{}
\usecolortheme{frigatebird}

% Removes the ":" in algorithm caption see §9.2.2 of algorithm2e documentation
\SetAlgoCaptionSeparator{}
% Styles the caption text with small caps see §9.5.4 of algorithm2e documentation
\SetAlCapNameFnt{\scshape}
\begin{document}

\begin{frame}{Pseudocode template}
\begin{algorithm}[H]
    \caption{TitleOfTheAlgorithm}
    \KwIn{What is given to the algorithm}
    \KwOut{What the algorithm gives back}
    the commands\;
    executed\;
    by\;
    the algorithm\;

\end{algorithm}
\end{frame}
\end{document}

enter image description here

BambOo
  • 8,801
  • 2
  • 20
  • 47
1

There is probably a better answer coming along the lines of \captionsetup{labelformat=empty}, but I don't know what circumstances that applies to. Here is a dirty answer

\makeatletter \def\algocf@capseparator{}\makeatother
\renewcommand\AlCapNameSty[1]{\unskip\strut\textnormal {#1}\unskip}

The first line eliminates the : separator. The second line eliminates the space that normally comes after :. I've also inserted \strut because layout with rules was too ugly.