5

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.

2 Answers 2

8

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.

2
  • Thanks for the edit. I did use the 4 space trick for code but for some reason it failed, along with newline.
    – stevem
    Oct 19, 2011 at 19:07
  • I've checked with Nicola Talbot: this should be working in the upcoming v2.04.
    – Joseph Wright
    Oct 20, 2011 at 17:00
1

For XeLaTeX this works without ^^I:

\catcode`\ 12%
\DTLsetseparator{   }%

The same as above the gap in { } is a tab.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .