简体   繁体   English

Pandoc,降价到pdf不会在段落中包含长词

[英]Pandoc, markdown to pdf doesn't wrap long words in paragraphs

I'm trying to generate a clean PDF from markdown using Pandoc and xelatex. 我正在尝试使用Pandoc和xelatex从markdown生成干净的PDF。

When I convert : 当我转换时:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

I end up having : 我最终有:

文字溢出

Here is the command I use to generate the PDF : 这是我用来生成PDF的命令:

/usr/local/bin/pandoc --verbose \
--chapters --from=markdown+yaml_metadata_block -S \
--latex-engine=xelatex \
--listings -H listings-setup.tex \
--template template.pdf \
--toc --chapters \
-o test.pdf \
metadata.yml \
test.md

I use the document class : report 我使用文档类: 报告

I have tried different things from inside the template and the extra header I'm using but I have now idea what template is Pandoc using when generating paragraphs. 我从模板内部和正在使用的额外标题中尝试了不同的方法,但是现在我已经知道生成段落时Pandoc使用的模板是什么。

I see under my template.pdf (extracted from Pandoc), but doesn't seem to apply here : 我在我的template.pdf(从Pandoc中提取)下看到了,但是似乎不适用于这里:

\setlength{\emergencystretch}{3em}  % prevent overfull lines

You've a few possibilities. 您有几种可能。 Since pandoc uses LaTeX for PDF generation, these are adapted from this LaTeX answer : 由于pandoc使用LaTeX进行PDF生成,因此可以根据以下LaTeX答案进行改编

  1. Annotate the proper language: 注释正确的语言:

     --- lang: en-GB --- rest of document 
  2. use soft hyphens inside a word to explicitly denote the allowed places to break. 在单词中使用软连字符来明确表示允许的转折位置。 You can either use the unicode character or the HTML entity ­ 您可以使用Unicode字符或HTML实体­ which pandoc will convert automatically for LaTeX etc. For example; 哪个pandoc将自动转换为LaTeX等。 cryp­to­graphy

  3. Specify exceptions via \\hyphenation{cryp-to-graphy} 通过\\hyphenation{cryp-to-graphy}指定例外

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM