Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Left-align text when converting from md to pdf

Tags:

pandoc

I'm converting a markdown file to pdf with:

pandoc -o out.pdf in.md

The results are justified alignment, a pet hate. Is there any way to render regular text as left-aligned instead? Nothing appears in help for 'left' or 'align'..

like image 661
geotheory Avatar asked Sep 02 '25 05:09

geotheory


1 Answers

You could use the latex package ragged2e.

For one document

Add this to your yaml front matter:

---
header-includes: 
- \usepackage[document]{ragged2e}
---

For all documents

Edit your pandoc latex template; to create it:

pandoc -D latex > ~/.pandoc/templates/default.latex

Then open the file and add somewhere before the \begin{document}:

\usepackage[document]{ragged2e}
like image 148
scoa Avatar answered Sep 05 '25 00:09

scoa