0

I am using package {algorithm2e} to write algorithm. Now I want to alter the algorithm title format with dash(-), for example, I am writing the first algorithm in chapter 3, so the title of this algorithm is 'Algorithm 3.1:', but I want a format like 'Algorithm 3-1:'. How to deal with it? Thanks for your help.

1 Answer 1

1
\documentclass{report}
\usepackage[algochapter]{algorithm2e}

\makeatletter
\renewcommand\thealgocf{\csname the\algocf@within\endcsname-\@arabic\c@algocf}% change dash to whatever you prefer
\makeatother

\begin{document}
\begin{algorithm}
\caption{Alg}
\end{algorithm}
\end{document}
1
  • Ah, \algocf@within is replaced by chapter to produce \thechapter. Apr 16, 2020 at 0:22

You must log in to answer this question.

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