Pandoc转换成LaTeX未完成。

3
我一直在使用Markdown写论文,并成功地使用pandoc转换为pdf。现在我需要输出到一个latex文件。当我这样做时,pandoc没有输出完整的latex文件。
我已经在一个较小的文档中重新创建了这个问题。
---                                                                                       
title: Test Document                                                                      
author: Rusty                                                                             
date: 2022 Jul 26                                                                         
---                                                                                                                                                                                                                                             
                                                                                          
# Body #                                                                                  
                                                                                          
This is the body.                                                                         
                                                                                          

使用命令pandoc --read=markdown --write=latex --output=testdoc.pdf testdoc.md会生成完美的文档,如下图所示:screenshot of pdf output但是,如果我尝试输出到latex而不转换为pdf,则会丢失大量文档。我使用类似的命令pandoc --read=markdown --write=latex --output=testdoc.tex testdoc.md。这是整个文档。
\hypertarget{body}{%                                                                      
\section{Body}\label{body}}                                                               
                                                                                          
This is the body.                                                                         

我该如何让latex输出包含所有内容并作为一个完整的latex文档呢?

1个回答

3
您可以添加--standalone选项:
pandoc --read=markdown --write=latex --output=testdoc.tex --standalone      test.md

但请注意,这将会把所有的包都倒入您的文档中-其中许多包是不必要的,会引起很多“有趣”的问题。


太好了!非常感谢。在我的情况下,它似乎不会导致任何奇怪的问题或出现任何疯狂的东西。 - Rusty
1
@Rusty 当像 https://dev59.com/Z3QOtIcB2Jgan1znkYQr#72226818 这样的问题困扰你时,我们会再次进行讨论 :) - samcarter_is_at_topanswers.xyz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接