July 13, 2023

Show paragraph count on pdf document compiled with Pandoc

To show paragraph count on a pdf compiled with Pandoc, first download the lua script count-para.lua (there is a copy of the script hosted on this website) by running:

$ wget https://yctct.com/count-para.lua

Then, when converting a file from Markdown to pdf, to show paragraph count add --lua-filter=path/to/file/count-para.lua as an option:

$ pandoc -o file.pdf file.md --lua-filter=path/to/file/count-para.lua  

If the file containing the script count-para.lua is located in the same directory as the file you wish to count words of, you can run:

$ pandoc -o file.pdf file.md --lua-filter=count-para.lua

A number in brackets should be displayed next to each paragraph on a pdf.

If you need to download Pandoc, on Trisquel GNU/Linux run:

$ sudo apt install pandoc

command-line interface (cli) personal computing pandoc trisquel GNU linux text processing office applications wiki shell literacy

No affiliate links, no analytics, no tracking, no cookies. © 2016-2023 yctct.com. Content is licensed under CC BY-NC-SA 4.0 .