TransWikia.com

How can I pass a path name with underscore in a yaml-file to latex via pandoc?

TeX - LaTeX Asked by LukasCB on April 18, 2021

I have a csv-file called test_csv.csv which has this content:

1_c,2,3,4
a2,b,c,d

I would like to print it with LaTeX and csvautobooklongtable but wihin a pandoc-workflow.

The pandoc-template (pandoc-csv.latex) is this:

documentclass{scrartcl}
usepackage{csvsimple}
usepackage{longtable,booktabs}
begin{document}
csvautobooklongtable[before table=ttfamily,respect all]{$pathtocsv$}
end{document}

The path to the csv-file is in an extra yaml-file (my.yaml):

---
pathtocsv: test_csv.csv
---

Since I only have metadata I would like to print there is an empty markdown dummy-file which seems to be necessary (dummy.md) for pandoc.

I do the conversion via CLI and

pandoc my.yaml --template pandoc-csv.latex  dummy.md --pdf-engine=lualatex -o pandoc-csv.pdf

The problem is that pandoc converts the underscore from the path name and it cannot be read in my latex document.

! Package csvsimple Error: File ‘test_csv.csv’ not existent, not readable
, or empty!.

One Answer

You need to to tell pandoc, that the string is already latex to avoid further escaping:

---
pathtocsv: "`test_csv.csv`{=latex}"
---

Correct answer by DG' on April 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP