Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
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 '11 at 19:07
    
I've checked with Nicola Talbot: this should be working in the upcoming v2.04. –  Joseph Wright Oct 20 '11 at 17:00

For XeLaTeX this works without ^^I:

\catcode`\ 12%
\DTLsetseparator{   }%

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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