filecontents package replaces tabs with spaces. Is there any solution to preserve tabs in the generated file without changing the following code?
\begin{filecontents*}{textWithTabs.txt}
Aa Bb Cc
1 2 3
\end{filecontents*}
Generated file is:
Aa Bb Cc
1 2 3
Desired file is:
Aa Bb Cc
1 2 3


texdoc filecontentssays nothing about that point. – Clément Jul 09 '14 at 12:37texdoc usrguidedocuments the originalfilecontentsenvironment, before the environment is patched by thefilecontentspackage. Quoting the document: Only normal ASCII text characters (7-bit visible text) should be included in a filecontents environment. Anything else, such as tab characters, form-feeds or 8-bit characters, should not be included in a filecontents environment. There is more text about the conversion to spaces. The document does not suggest any solution around this limitation. – mvkorpel Jul 09 '14 at 12:50filecontentsversion claims aboutverbatimwriting the content, in this case, the tab characters should be preserved. – Jul 09 '14 at 12:58filecontentspackage does nothing about this particular limitation. One could also assume that the package documentation would advertise the ability to preserve tabs if such a feature was implemented. I don't understand what you mean by "verbatimwriting the content". – mvkorpel Jul 09 '14 at 13:22verbatim writing... I meant, as stated infilecontentspackage manual filecontents works much like verbatim ... I misinterpreted this, that verbatim is used. – Jul 09 '14 at 13:43filecontentsenvironment makes the tab active\catcode`\^^I\activeand later defines it to insert a space AFAIK – cgnieder Mar 08 '17 at 21:52