I plan to use the package datatool for loading a .csv-file as database:

\DTLloaddb[<options>]{<db name>}{<filename>}

How to achieve tokenizing values of that database under the same catcode-settings as are used by \verb|...|?


I think it is sufficient to switch to the desired catcode-régime right before calling \DTLloaddb.
You may need to call \DTLsetdelimiter and/or \DTLsetseparator for adjusting delimiter and separator to the desired catcode-régime, too.

!!! But I don't know whether such catcode-changes affect the sorting-algorithms or whatsoever other functionality of the datatool-package. !!!




  % Let's switch to verbatim-catcode-régime:
  \let\do\@makeother  \dospecials
  % ( You may need to call \DTLsetdelimiter and/or \DTLsetseparator with an argument
  %   that also got tokenized under verbatim-catcode-régime.
  %   I don't do it here because category-codes of default-delimiter " and 
  %   default-separator , are not affected when switching to verbatim-catcode-régime. ) 



\DTLforeach{testdatabase}{\ColA=ColumnA, \ColB=ColumnB}{%
  \par\noindent\ColA{} and \ColB.

\DTLforeach{testdatabaseB}{\ColA=ColumnA, \ColB=ColumnB}{%
  \par\noindent{\csname verbatim@font\endcsname\ColA{} and \ColB}.


enter image description here

(The possibility of specifying the desired catcode-régime for each column (and probably post-processing-routines to be applied to the values of a column) when loading a .csv-file via \DTLloaddb would be extremely nice.)

In case you just wish to disable some of the special characters, the command \DTLloadrawdb might be the right tool.

More information at



This is like \DTLloaddb except that it performs a substitution on nine of the ten special characters. (The backslash always retains its special state.) The mappings are listed in Table 2.1.

Table 2.1: Special character mappings used by \DTLloadrawdb

Character Mapping

%          \%
$          \$
&          \&
#          \#
_          \_
{          \{
}          \}
~          \textasciitilde
^          \textasciicircum

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.