[Tex/LaTex] Tab separated files with datatool package


The documentation of the package datatool says that the \DTLsettabseparator command changes the separator in .csv-Files from the default comma to the tab character. What it really does for me is change it to space. Tabs are simply ignored by datatool. Datatool requires space as separator even with the tabseparator command. Is there a way to change it to tabs for real?

Also is there a way to tell datatool to ignore multiple, consecutive separators (i.e. multiple tab characters in a row)? When I write "1,,,3" in my .csv file (for readability comma being the separator here instead of the desired tab), I don't mean datatool to think the "1" is in the first column and the "3" in the fourth. That should be just do columns.

Best Answer

I had this problem with datatool not recognising tabs. I believe there is a bug in the definition of \DTLsettabseparator in datatool.sty. \DTLsettabseparator tries to make \DTLsetseparator a tab but fails, but you can override this by making \DTLsetseparator a tab in your document using:

\catcode`\^^I=12 %
\DTLsetseparator{   }%

The gap in { } is a tab.

Related Question