Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Pandoc中的图像编号和引用_Html_Latex_Preprocessor_Pandoc - Fatal编程技术网

Html Pandoc中的图像编号和引用

Html Pandoc中的图像编号和引用,html,latex,preprocessor,pandoc,Html,Latex,Preprocessor,Pandoc,我想在Pandoc中为我的图像添加标题,如“图1:Blah-Blah”,并能够像查看@Figure1一样引用它们。我正在使用gpp(一个预处理器)为我的图像添加标题,并做各种各样的奇特的事情,如更改大小、格式等。然而,我无法为图1、图2等图像实现计数器 我在gpp脚本中定义了以下函数: \define{\counter}{0} \defeval{count}{\eval{\counter+ 1} 我在脚本中这样称呼它:\count 但是,\counter在我的gpp脚本中没有得到计算,我看到

我想在Pandoc中为我的图像添加标题,如“图1:Blah-Blah”,并能够像查看@Figure1一样引用它们。我正在使用gpp(一个预处理器)为我的图像添加标题,并做各种各样的奇特的事情,如更改大小、格式等。然而,我无法为图1、图2等图像实现计数器

我在gpp脚本中定义了以下函数:

\define{\counter}{0}

\defeval{count}{\eval{\counter+ 1}
我在脚本中这样称呼它:
\count

但是,
\counter
在我的gpp脚本中没有得到计算,我看到以下
错误:未完成的宏


我应该如何实现这个计数器?我在gpp中使用-T(tex)模式,我找到了一个部分解决问题的方法。我发现使用CSS的计数器增量属性有助于自动为图像编号,如下所示:

但是,问题仍然是每次调用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>
}
因此,每次我在图片中添加标签
\image
,它都会得到计数器
图1

您可以尝试使用过滤器:它会自动创建图号,并启用图参考

简而言之,您可以向图像添加标签,如下所示:

div .figures{
counter-reset:figure;
}

a.figure-caption:before{
counter-increment:figure;
content: "Figure" counter(figure) ":";
}
![Caption.](image.png) {#fig:description}
@fig:description
。。。然后像这样引用它:

div .figures{
counter-reset:figure;
}

a.figure-caption:before{
counter-increment:figure;
content: "Figure" counter(figure) ":";
}
![Caption.](image.png) {#fig:description}
@fig:description
有关安装和使用说明,请参阅github上的页面。还有一个pandoc eqnos过滤器,用于对方程执行相同的操作。

无需交叉引用的多语言CSS编号 这里有一个简单的CSS自动编号方法,标签依赖于文档语言。这个简单的CSS方法不允许引用

用于通过引用自动编号,而不是使用套件


您的CSS计数问题已在中解决。