我的 pandoc 目录在世界的哪个地方?
Where in the world is my pandoc directory?
我正在尝试为 pandoc 添加自定义乳胶模板
我知道 pandoc 模板进入 ~/.pandoc/templates
我通过输入 pandoc --v
确认了 pandoc 目录位置 - 它说 pandoc 在 ~/.pandoc
但是当我这样做时 cd ~/.pandoc
:
-bash: cd: /Users/[Name]/.pandoc: No such file or directory
根据 pandoc 手册页,我可以使用 --data-dir=DIRECTORY
为 pandoc 数据文件设置不同的路径,但是当我尝试以这种方式构建文件时,例如
pandoc file.md -o file.pdf --data-dir=~/Library/texmf/tex/latex --template=mytemplate.latex
它抛出错误
pandoc: Could not find data file templates/mytemplate.latex
我假设这意味着数据目录命令被忽略了。
为什么我无法访问我的 pandoc 目录?
如果 ~/.pandoc
目录不存在,您确实需要创建它。例如对于默认乳胶模板:
mkdir -p ~/.pandoc/templates
pandoc -D latex > ~/.pandoc/templates/default.latex
--template
选项查找相对于当前目录 (pwd
) 的文件,或 "if not found, pandoc will search for it in the templates subdirectory of the user data directory"(~/.pandoc/templates
for --data-dir=~/.pandoc
,这是默认)。
这就是您的错误来源,因为可能没有文件 /Library/texmf/tex/latex/templates/mytemplate.latex
。
我正在尝试为 pandoc 添加自定义乳胶模板
我知道 pandoc 模板进入 ~/.pandoc/templates
我通过输入 pandoc --v
确认了 pandoc 目录位置 - 它说 pandoc 在 ~/.pandoc
但是当我这样做时 cd ~/.pandoc
:
-bash: cd: /Users/[Name]/.pandoc: No such file or directory
根据 pandoc 手册页,我可以使用 --data-dir=DIRECTORY
为 pandoc 数据文件设置不同的路径,但是当我尝试以这种方式构建文件时,例如
pandoc file.md -o file.pdf --data-dir=~/Library/texmf/tex/latex --template=mytemplate.latex
它抛出错误
pandoc: Could not find data file templates/mytemplate.latex
我假设这意味着数据目录命令被忽略了。
为什么我无法访问我的 pandoc 目录?
如果 ~/.pandoc
目录不存在,您确实需要创建它。例如对于默认乳胶模板:
mkdir -p ~/.pandoc/templates
pandoc -D latex > ~/.pandoc/templates/default.latex
--template
选项查找相对于当前目录 (pwd
) 的文件,或 "if not found, pandoc will search for it in the templates subdirectory of the user data directory"(~/.pandoc/templates
for --data-dir=~/.pandoc
,这是默认)。
这就是您的错误来源,因为可能没有文件 /Library/texmf/tex/latex/templates/mytemplate.latex
。