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
\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}
-
Ah,
\algocf@within
is replaced bychapter
to produce\thechapter
. Apr 16, 2020 at 0:22