乳胶新环境标签
我有以下 newenvironment
命令:
\newcounter{algoctr}[chapter] \setcounter{algoctr}{0}
\newenvironment{algo}[1] {
\refstepcounter{algoctr}\vspace{0.2cm}\noindent{\bf Algorithm
\arabic{chapter}.\arabic{algoctr}: #1}}{\par}
并且我因此使用它
\begin{algo}{blabbing a blah}
blah
blah
\label{eq:blabbing}
\end{algo}
但是,每次我引用标签 (\ref{eq:blabbing}) 时,我都会得到一个“1”,而不是“1.1” 。
有人可以让我知道我做错了什么吗?
谢谢
I have the following newenvironment
command:
\newcounter{algoctr}[chapter] \setcounter{algoctr}{0}
\newenvironment{algo}[1] {
\refstepcounter{algoctr}\vspace{0.2cm}\noindent{\bf Algorithm
\arabic{chapter}.\arabic{algoctr}: #1}}{\par}
and I use it thusly
\begin{algo}{blabbing a blah}
blah
blah
\label{eq:blabbing}
\end{algo}
However, every time I reference the label (\ref{eq:blabbing}), I get a "1", instead of a "1.1".
Could someone kindly let me know what I'm doing wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你就快到了,你只需要重新定义
\thealgoctr
,就像:(未经测试。)
然后在您的环境中使用
\thealgoctr
而不是显式引用计数器。You're almost there, you just need to redefine
\thealgoctr
as well, something like:(Untested.)
And then use
\thealgoctr
in your environment rather than explicitly referring to the counters.我不知道你的计数器,但我可以推荐另一种可行的可能性:
I don't know about your counter, but I can recommend another possibility in which this works: