narimiran/tably

Escaping LaTeX special chars

Closed this issue · 3 comments

If your CSV file contains any special chars used in latex like & or % the resulting PDF file might not look as expected. Those characters must be escaped to e.g. \& or \%.

Sources:

If your CSV file contains any special chars used in latex like & or % the resulting PDF file might not look as expected.

Can confirm.

The tool was originally intended for converting 'raw' CSV files (which might be created from a lab equipment) where the cells contain only numeric values, so I didn't take any precaution when it comes to special characters.
Nonetheless, I will try to solve this in future releases.

Should a whole file be checked for those characters or just a header (first row)?

This might be a minor security issue if you can't trust the CSV file, e.g. infinite loops like \def\x{\x}\x. However, in your use case this might not be an issue.

I vote to escape all cells in all rows.

This might be a minor security issue if you can't trust the CSV file, e.g. infinite loops like \def\x{\x}\x.

Thanks for pointing this out, but this is currently a low priority because of the assumption that CSVs are known/simple/machine generated.
If this kind of situation happens in a 'real-world problem', please open another issue and I'll see what can I do.

Commit f9d6426 solves the problem with special characters, so I will close this issue.