我想要访问浮点数的当前名称。
在里面浮动包手册中,我读到该命令\floatname{<float name>}{<new name>}
通过重新定义来工作\fname@<float name>
。然而,我无法让它工作
下面是我想要实现的一个例子:
\documentclass{article}
\usepackage{float}
\usepackage{algorithm}
\floatname{algorithm}{New name for algorithm}
\begin{document}
\begin{algorithm}
Some algorithm here.
\caption{This is a caption where I would like to reference the float name (i.e. ``New name for algorithm'').}
\end{algorithm}
\end{document}
有任何想法吗?
答案1
名称存储在中\fname@algorithm
,因此很容易获取用户级命令:
\documentclass{article}
\usepackage{float}
\usepackage{algorithm}
\floatname{algorithm}{New name for algorithm}
\makeatletter
\let\algorithmname\fname@algorithm
\makeatother
\begin{document}
\begin{algorithm}
Some algorithm here.
\caption{This is a caption where I would like to reference the float name
which is ``\algorithmname''}
\end{algorithm}
\end{document}