
答案1
LaTeX 輸出的預設pandoc
範本似乎強制包含shorthands=off
在babel
選項中。事實上,運行後pandoc -D latex >default.latex
,您應該會看到:
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
(...)
$if(lang)$
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
$if(babel-newcommands)$
$babel-newcommands$
$endif$
\else
(...)
\end{document}
這個shorthands=off
選項會殺死你想要的功能。您可以透過以下方式修復此問題:
在名為 的檔案中取得預設的 LaTeX 範本
mytemplate.latex
:pandoc -D latex >mytemplate.latex
在 中
mytemplate.latex
,使用您喜歡的文字編輯器刪除shorthands=off
傳遞給 的選項babel
。編譯:
pandoc -f markdown -t latex -M lang:fr-FR --template=mytemplate -o test.pdf test.md
如果mytemplate.latex
在目前目錄或在~/.pandoc/templates
.