1

I'm following this csvsimple documentation and I've come across an issue with my csv file having a reserved character: # and I've tried escaping it with a blackslash(\) and I've tried appending [respect sharp] to \csvreader (since you can escape the underscore by doing that) but to no avail. I know you can use [respect sharp] with \csvautotabular, but I can't seem to find out how to do this with csvreader

This is my code:

\begin{tabular}{|r|l|c|}\hline%
   & Person & Matr.~No.\\\hline\hline
   \csvreader[tabular=|r|l|l|, table head=\hline, table foot=\hline]%
   {csv/scientists.csv}{name=\name,description=\desc}%
   {\thecsvrow & \name & \desc}%
\end{tabular}

This is my csv code:

name, description
Locking, {Priced standard #2.  Priced outside #1.}

Getting an Illegal parameter number in definition of \csv@col@body error

0
2

The respect sharp key is indeed the correct key to use. Your code doesn't really compile to what I think you want (it's helpful for future question to embed the code into a complete compilable document that people can play with.)

Here's a version of the code you posted. As you can see, both csvautotabular and csvreader allow the same respect sharp option. I removed the tabular specification inside the csvreader command, since you don't really want a table within a table I don't think.

\documentclass{article}
\begin{filecontents*}{\jobname.csv}
name, description
Locking,{Priced standard #2.  Priced outside #1.}
\end{filecontents*}
\usepackage{csvsimple}
\begin{document}
\csvautotabular[respect sharp]{\jobname.csv}

\bigskip

\begin{tabular}{|r|l|c|}
   \hline%
   & Person & Matr.~No.\\\hline\hline
   \csvreader[ table head=\hline, table foot=\hline, respect sharp]%
   {\jobname.csv}{name=\name,description=\desc}%
   {\thecsvrow & \name & \desc}
   \\\hline%
\end{tabular}
\end{document}

output of code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.