我找到了解决我的问题的部分方法。我发现使用 CSS 的 counter-increment 属性可以帮助自动编号图像,如下所示:http ://www.w3schools.com/cssref/pr_gen_counter-reset.asp
但是,问题仍然存在,每次调用我的 gpp 标签时,我都使用 gpp 来复制同一段代码。因此,计数器永远不会增加。例如:我的 gpp 代码是:
\define{\image{src}{width}{caption}{tag}}{
<div style=" margin:50px auto; text-align:center;" class="figures">
<a href="\src" id="\tag" style="margin:0px 20px; display:inline-block;
text-decoration:none; color:black; "><img src="\src" width="\width px"
alt="\caption" style="padding-bottom:0.5em;"> <div> \caption </div></a></div>}
\define{\imageref{label}}{
<span style="white-space:nowrap;"><a href="#\label" style="display:inline-block">\label</a></span>
}
我的 style.css 看起来像这样:
div .figures{
counter-reset:figure;
}
a.figure-caption:before{
counter-increment:figure;
content: "Figure" counter(figure) ":";
}
因此,每次我在标签中包含图片时\image
,它总是会得到计数器Figure1