| 1 |
% \LaTeX-Main\ |
| 2 |
% !TeX encoding=UTF-8 |
| 3 |
%% The LaTeX package csvsimple - version 2.7.1 (2026/04/27) |
| 4 |
%% csvsimple.tex: Manual |
| 5 |
%% |
| 6 |
%% ------------------------------------------------------------------------------------------- |
| 7 |
%% Copyright (c) 2008-2026 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> |
| 8 |
%% ------------------------------------------------------------------------------------------- |
| 9 |
%% |
| 10 |
%% This work may be distributed and/or modified under the |
| 11 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 12 |
%% of this license or (at your option) any later version. |
| 13 |
%% The latest version of this license is in |
| 14 |
%% http://www.latex-project.org/lppl.txt |
| 15 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 16 |
%% version 2005/12/01 or later. |
| 17 |
%% |
| 18 |
%% This work has the LPPL maintenance status `author-maintained'. |
| 19 |
%% |
| 20 |
%% This work consists of all files listed in README.md |
| 21 |
%% |
| 22 |
\documentclass[a4paper,11pt]{ltxdoc} |
| 23 |
\usepackage{csvsimple-doc} |
| 24 |
|
| 25 |
\usepackage{\csvpkgprefix csvsimple-legacy} |
| 26 |
|
| 27 |
\hypersetup{ |
| 28 |
pdftitle={Manual for the csvsimple package}, |
| 29 |
pdfauthor={Thomas F. Sturm}, |
| 30 |
pdfsubject={csv file processing with LaTeX}, |
| 31 |
pdfkeywords={csv file, comma separated values, key value syntax} |
| 32 |
} |
| 33 |
|
| 34 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 |
\begin{document} |
| 36 |
\begin{center} |
| 37 |
\begin{tcolorbox}[enhanced,hbox,tikznode,left=8mm,right=8mm,boxrule=0.4pt, |
| 38 |
colback=white,colframe=black!50!yellow, |
| 39 |
drop lifted shadow=black!50!yellow,arc is angular, |
| 40 |
before=\par\vspace*{5mm},after=\par\bigskip] |
| 41 |
{\bfseries\LARGE The \texttt{csvsimple} package}\\[3mm] |
| 42 |
{\large Manual for version \version\ (\datum)} |
| 43 |
\end{tcolorbox} |
| 44 |
{\large Thomas F.~Sturm% |
| 45 |
\footnote{Prof.~Dr.~Dr.~Thomas F.~Sturm, Institut f\"{u}r Mathematik und Informatik, |
| 46 |
University of the Bundeswehr Munich, D-85577 Neubiberg, Germany; |
| 47 |
email: \href{mailto:[email protected]}{[email protected]}}\par\medskip |
| 48 |
\normalsize\url{https://www.ctan.org/pkg/csvsimple}\par |
| 49 |
\url{https://github.com/T-F-S/csvsimple} |
| 50 |
} |
| 51 |
\end{center} |
| 52 |
\bigskip |
| 53 |
\begin{absquote} |
| 54 |
\begin{center}\bfseries Abstract\end{center} |
| 55 |
|csvsimple| provides a simple \LaTeX\ interface for processing files with |
| 56 |
comma-separated values (CSV). |
| 57 |
|csvsimple| makes extensive use of key–value syntax, resulting in a straightforward interface. |
| 58 |
|
| 59 |
Filtering and table generation are particularly supported. As the package |
| 60 |
is intended to be lightweight, it does not provide support for data sorting or |
| 61 |
database storage. |
| 62 |
\end{absquote} |
| 63 |
|
| 64 |
\section{Package Options}% |
| 65 |
|
| 66 |
|csvsimple| is a stub which merely selects to load exclusively one of the |
| 67 |
following packages: |
| 68 |
\begin{itemize} |
| 69 |
\item \href{csvsimple-l3.pdf}{\flqq The |csvsimple-l3| package\frqq}:\\ |
| 70 |
This is the pure \LaTeX3 version of |csvsimple|. It is considered |
| 71 |
to be the \emph{current} version. |
| 72 |
New documents are encouraged to use this package.\par |
| 73 |
|csvsimple-l3| is loaded with \emph{one} of the following |
| 74 |
alternatives inside the preamble: |
| 75 |
\begin{dispListing} |
| 76 |
\usepackage[l3]{csvsimple} |
| 77 |
% or alternatively (not simultaneously!) |
| 78 |
\usepackage{csvsimple-l3} |
| 79 |
\end{dispListing} |
| 80 |
\medskip |
| 81 |
|
| 82 |
\item \href{csvsimple-legacy.pdf}{\flqq The |csvsimple-legacy| package\frqq}:\\ |
| 83 |
This is the \LaTeXe{} version of |csvsimple|. It is considered |
| 84 |
to be the \emph{superseded} version identical to version 1.22 of |csvsimple|. |
| 85 |
Documents based on that former version do \emph{not have to be changed} |
| 86 |
and stay compilable in future.\par |
| 87 |
|csvsimple-legacy| is loaded with \emph{one} of the following |
| 88 |
alternatives inside the preamble: |
| 89 |
\begin{dispListing} |
| 90 |
\usepackage{csvsimple} |
| 91 |
% or alternatively (not simultaneously!) |
| 92 |
\usepackage[legacy]{csvsimple} |
| 93 |
% or alternatively (not simultaneously!) |
| 94 |
\usepackage{csvsimple-legacy} |
| 95 |
\end{dispListing} |
| 96 |
\end{itemize} |
| 97 |
|
| 98 |
|
| 99 |
\clearpage |
| 100 |
\section{Differences between \texttt{csvsimple-l3} and \texttt{csvsimple-legacy}} |
| 101 |
This section is intended for users who know |csvsimple| before version~2.00. |
| 102 |
|
| 103 |
|csvsimple-l3| is a \emph{nearly} drop-in replacement for |
| 104 |
|csvsimple-legacy|. Although old documents have no \emph{need} to be changed, |
| 105 |
adopting the new \LaTeX3 version for existing documents should impose not |
| 106 |
too much effort. Actually, it depends on how intense |pgfkeys| specific |
| 107 |
styles were used. |
| 108 |
|
| 109 |
That brings us to the differences between the two packages and a more precise |
| 110 |
understanding what \emph{nearly} drop-in replacement means. The following enumeration |
| 111 |
does not list new features of \texttt{csvsimple-l3} (if any), but takes an |
| 112 |
upgrade point of view. |
| 113 |
|
| 114 |
\begin{itemize} |
| 115 |
\item Any patches or additions using undocumented internals of |csvsimple-legacy| |
| 116 |
will stop to function, because |csvsimple-l3| has a completely new implementation. |
| 117 |
\item |csvsimple-l3| is programmed in |expl3| code using the \LaTeX3 interfaces. |
| 118 |
No additional packages are loaded or needed with exception of several options |
| 119 |
which allow to access methods from |ifthen|, |etoolbox|, |longtable|, etc. |
| 120 |
On the other hand, |csvsimple-legacy| is programmed in \LaTeXe{} with |
| 121 |
dirty tricks from here and there. |
| 122 |
\item The most significant change of the user interface is that the key value |
| 123 |
engine of |csvsimple-legacy| is |pgfkeys| (root \docAuxKey*[csv]{}) while |csvsimple-l3| uses |
| 124 |
|l3keys| (root \docAuxKey*[csvsim]{}). |
| 125 |
Names and usage of the keys are \emph{unchanged}. |
| 126 |
But, if |
| 127 |
you made own |pgfkeys| \emph{styles} using the |pgfkeys| style handler, |
| 128 |
these \emph{styles} have to be adapted to |.meta| keys of |l3keys|. |
| 129 |
The good news is that styles |
| 130 |
made with \docAuxCommand*{csvstyle} become |.meta| keys automatically. |
| 131 |
\item The macro \docAuxCommand*{csvheadset} is removed. It is not supportable |
| 132 |
by the new implementation. I never used it and I forgot why I ever wrote it |
| 133 |
-- I hope the same is true for you. If not, |csvsimple-legacy| can be |
| 134 |
used for documents which needs it. |
| 135 |
\item Option \docAuxKey*[csv]{filter} is removed. Instead, \docAuxKey*[csvsim]{filter ifthen} |
| 136 |
can be used (also true with \docAuxKey*[csv]{filter ifthen} for the old version). |
| 137 |
\item The deprecated options |
| 138 |
\docAuxKey*[csv]{nofilter} and \docAuxKey*[csv]{nohead} are removed. |
| 139 |
They were not documented any more since years. Obviously, use |
| 140 |
\docAuxKey*[csvsim]{no filter} and \docAuxKey*[csvsim]{no head} instead. |
| 141 |
\item Compilation problems are to be expected, if an |S| column of the |siunitx| package |
| 142 |
is used as first or last column. Documents neglecting this rule successfully |
| 143 |
for |csvsimple-legacy|, may fail to compile with |csvsimple-l3.| |
| 144 |
\item The \LaTeX{} counters \docCounter*{csvinputline} |
| 145 |
and \docCounter*{csvrow} |
| 146 |
are replaced by \LaTeX3 integers |
| 147 |
\docCounter*{g_csvsim_inputline_int} |
| 148 |
and \docCounter*{g_csvsim_row_int}, but accessors |
| 149 |
\docAuxCommand*{thecsvinputline} and |
| 150 |
\docAuxCommand*{thecsvrow} are still valid. |
| 151 |
\item The packages |pgfrcs|, |pgfkeys|, |ifthen|, |etoolbox|, and |shellesc| |
| 152 |
are not included anymore (include manually, if needed). |
| 153 |
\item |
| 154 |
\docAuxCommand*{csviffirstrow} and |
| 155 |
\docAuxCommand*{csvifoddrow} are deprecated and replaced by |
| 156 |
\docAuxCommand*{ifcsvfirstrow} |
| 157 |
\docAuxCommand*{ifcsvoddrow} |
| 158 |
which are more consistent in nomenclature. |
| 159 |
\item For |csvsimple-l3|, data lines are allowed to begin with an backslash. |
| 160 |
\item Assigned macros like |\myname| for e.g. the third column contain |
| 161 |
not |\csvcoliii| anymore, but are equal to the content of |\csvcoliii| now. |
| 162 |
\item Character code changes with \docAuxKey*[csvsim]{respect percent} etc. |
| 163 |
and the tabulator as separator should work for |csvsimple-l3| as expected in every |
| 164 |
situation (not always worked for |csvsimple-legacy|). |
| 165 |
\item A drawback of |csvsimple-l3| against |csvsimple-legacy| is |
| 166 |
a higher compilation time. This may vary by used compiler. |
| 167 |
An example document of 5061 pages using a CSV file with 166 992 lines |
| 168 |
took about 28 seconds with |csvsimple-legacy| and |
| 169 |
about 51 seconds with |csvsimple-l3| on my machine |
| 170 |
(just a singular observation, no scientific analysis at all). |
| 171 |
\end{itemize} |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
\end{document} |