【发布时间】:2020-04-26 03:15:06
【问题描述】:
是否可以在 pandoc 中处理列表标题的文本标记?
Pandoc 适用于图形标题并翻译 emphasis 和 inline code,但在列出标题时显然没有这样做。
例如,在下面的代码中,我在第二个清单和图形的标题中进行了一些格式设置和引用。
但是,只有图中的格式被正确转换为latex。
列表标题保持原样,这会在管道中破坏 tex 处理器。
是否可以像处理图片标题一样处理列表标题?
```{#lst:first .C caption="Hi"}
int hi() {
return ((int)'h'<<8) | 'i';
}
```
```{#lst:second .C caption="Code *using* the function `hi` from [@lst:first]"}
x = hi();
```
![Picture *with* `inline code` and reference [@lst:first]](picture.png)
pandoc example.so.md -o example.so.tex --listings --filter=pandoc-crossref
生产:
\begin{codelisting}
\caption{Hi}
\begin{lstlisting}[language=C, caption=Hi, label=lst:first]
int hi() {
return ((int)'h'<<8) | 'i';
}
\end{lstlisting}
\end{codelisting}
\begin{codelisting}
\caption{Code *using* the function `hi` from {[}@lst:first{]}}
\begin{lstlisting}[language=C, caption={Code *using* the function `hi` from [@lst:first]}, label=lst:second]
x = hi();
\end{lstlisting}
\end{codelisting}
\begin{figure}
\centering
\includegraphics{picture.png}
\caption{Picture \emph{with} \passthrough{\lstinline!inline code!} and
reference lst.~\ref{lst:first}}
\end{figure}
我使用 pandoc 2.7.3 和 pandoc-crossref v0.3.4.1
附:正如https://github.com/jgm/pandoc/issues/673 建议的那样,可能仍然没有对此的本机支持。有解决办法吗?
【问题讨论】:
标签: latex markdown pandoc cross-reference