IMHO your trick is fine, if you want to make it looking a little bit less weird you could use \DeclareCaptionOption
instead of \DeclareCaptionFont
:
\documentclass{article}
\usepackage{caption}[2012/02/19 v3.2f]
\usepackage{bicaption}[2011/10/30 v1.0a]
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
\DeclareCaptionOption{bi-first}[]{%
\def\tablename{Table}%
\def\figurename{Figure}}
\DeclareCaptionOption{bi-second}[]{%
\def\tablename{Alter-table}%
\def\figurename{Alter-figure}}
\begin{document}
\begin{figure}
\centering FIGURE
\bicaption{XXX}{YYY}
\end{figure}
\begin{table}
\centering TABLE
\bicaption{XXX}{YYY}
\end{table}
\end{document}
However, I think a dedicated interface for usage of bicaption
without babel/polyglossia
would be great, so I will design it in the next days... (Please stay tuned.)
(2012-04-09) ...done. I have added a small interface for using the lang=
option without babel/polyglossia
in the upcoming version 1.1 of the bicaption
package, so the example above could also be written as:
\documentclass{article}
\usepackage{caption}[2012/03/25 v3.3]
\usepackage{bicaption}[2012/04/09 v1.1]
\captionsetup[bi-first]{lang=first}
\captionsetup[bi-second]{lang=second}
\renewcommand\selectcaptionlanguage[2]{%
\csname select#2language\endcsname}
\newcommand\selectfirstlanguage{%
\def\tablename{Table}%
\def\figurename{Figure}}
\newcommand\selectsecondlanguage{%
\def\tablename{Alter-table}%
\def\figurename{Alter-figure}}
\begin{document}
\begin{figure}
\centering FIGURE
\bicaption{XXX}{YYY}
\end{figure}
\begin{table}
\centering TABLE
\bicaption{XXX}{YYY}
\end{table}
\end{document}
Furthermore I have implemented \captionsetup[figure][bi-first]{name=Foo}
in the upcoming version 3.3 of the caption
package, so an alternative implementation would be:
\documentclass{article}
\usepackage{caption}[2012/03/25 v3.3]
\usepackage{bicaption}[2012/04/09 v1.1]
\captionsetup[figure][bi-first]{name=Figure}
\captionsetup[figure][bi-second]{name=Alter-figure}
\captionsetup[table][bi-first]{name=Table}
\captionsetup[table][bi-second]{name=Alter-table}
\begin{document}
\begin{figure}
\centering FIGURE
\bicaption{XXX}{YYY}
\end{figure}
\begin{table}
\centering TABLE
\bicaption{XXX}{YYY}
\end{table}
\end{document}
I'll release both of them within the next weeks.
Regarding the figurename
option: This option was designed for usage with babel/polyglossia
, therefore it could have caused trouble when used within the document text. And since it was never documented for usage within the document text I have added the \@onlypreamble
stuff.
If you're willing to use \TitleOfAlgo
instead (which, for algorithms, is more flexible than \caption
in many ways), then see John Wickerson's answer.
Otherwise, if you really want to use \caption
but remove algorithm numbering, simply insert \renewcommand{\thealgocf}{}
in your preamble.
\documentclass[10pt]{report}
\usepackage{algorithm2e}
\renewcommand{\thealgocf}{}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{document}
Best Answer
The type is different from what is typically used in the naming. In that regard, the
algorithm
environment typically useAlgorithm
as its name.algorithm2e
is slightly different though; it usesalgocf
as the type, so you need to useMake sure the
\captionof
macro is used inside an environment (or group).