【发布时间】:2015-05-19 03:51:36
【问题描述】:
简介
我想在 Latex 中创建源代码,以便通过 pdflatex 生成 pdf 并通过 pandoc 生成 html 页面。我使用以下来源
\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}
\usepackage{hyperref}
\begin{document}
\begin{enumerate}
\item \label{itm:thefirst}
First example point
\end{enumerate}
This is an example to demonstrate how \textbackslash label\{\} and \textbackslash ref\{\} are not working with pandoc. Here should be a reference to the first example: \ref{itm:thefirst}
\end{document}
这可以用 pdflatex 编译,没有任何错误或警告。
问题
我使用以下代码通过 pandoc 创建 html 页面:
pandoc -f latex sample.tex -t html5 -o sample.html -S --toc -s
但它会在标签和引用周围产生不令人满意的结果:
<body>
<ol>
<li><p>[itm:thefirst] First example point</p></li>
</ol>
<p>This is an example to demonstrate how \label{} and \ref{} are not working with pandoc. Here should be a reference to the first example: [itm:thefirst]</p>
</body>
问题
为了得到这样的东西,我应该在乳胶源代码中修改什么:
<body>
<ol>
<li><p id="itm:thefirst">First example point</p></li>
</ol>
<p>This is an example to demonstrate how \label{} and \ref{} are not working with pandoc. Here should be a reference to the first example: <a href="#itm:thefirst">(1)</a></p>
</body>
【问题讨论】:
-
这可能是一个普遍问题,因为另一个 SO 问题问how to label and ref images
标签: html latex pandoc cross-reference