我的 pandoc 目录在哪里? [英] Where in the world is my pandoc directory?
问题描述
我正在尝试为 pandoc 添加自定义乳胶模板
I am trying to add a custom latex template for pandoc
我知道 pandoc 模板在 ~/.pandoc/templates
I know that pandoc templates go in ~/.pandoc/templates
我通过输入 pandoc --v
确认了 pandoc 目录位置 - 它说 pandoc 在 ~/.pandoc
and I confirmed the pandoc directory location by typing pandoc --v
- it says pandoc is in ~/.pandoc
但是当我做 cd ~/.pandoc
时:
-bash: cd: /Users/[Name]/.pandoc: No such file or directory
根据 pandoc 手册页,我可以使用 --data-dir=DIRECTORY
为 pandoc 数据文件设置不同的路径,但是当我尝试以这种方式构建文件时,例如
According the pandoc man page I can set a different path for pandoc data files using --data-dir=DIRECTORY
, but when I try build a file this way, e.g.
pandoc file.md -o file.pdf --data-dir=~/Library/texmf/tex/latex --template=mytemplate.latex
它抛出错误
pandoc: Could not find data file templates/mytemplate.latex
我认为这意味着数据目录命令被忽略.
which I assume means the data directory command is ignored.
为什么我无法访问我的 pandoc 目录?
Why can't I access my pandoc directory?
推荐答案
如果 ~/.pandoc
目录尚不存在,您确实应该创建它.例如对于默认的乳胶模板:
You are indeed expected to create the ~/.pandoc
directory if it doesn't exist already. For example for a default latex template:
mkdir -p ~/.pandoc/templates
pandoc -D latex > ~/.pandoc/templates/default.latex
--template
选项查找相对于当前目录(pwd
)的文件,或者如果没有找到,pandoc 将在用户数据目录"(~/.pandoc/templates
for --data-dir=~/.pandoc
,这是默认值).
The --template
option looks for files relative to the current directory (pwd
), or "if not found, pandoc will search for it in the templates subdirectory of the user data directory" (~/.pandoc/templates
for --data-dir=~/.pandoc
, which is the default).
您的错误来自哪里,因为可能没有文件 /Library/texmf/tex/latex/templates/mytemplate.latex
.
Which is where your error comes from as there's probably no file /Library/texmf/tex/latex/templates/mytemplate.latex
.
这篇关于我的 pandoc 目录在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!