From 1297f178ba3a3f477c3af759f9a281c91e4e79de Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 26 Sep 2013 22:25:30 +0000 Subject: csvsimple (26sep13) git-svn-id: svn://tug.org/texlive/trunk@31777 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/csvsimple/CHANGES | 124 +++++++++++---------- Master/texmf-dist/doc/latex/csvsimple/README | 4 +- .../doc/latex/csvsimple/csvsimple-example.pdf | Bin 72286 -> 72286 bytes .../doc/latex/csvsimple/csvsimple-example.tex | 2 +- .../texmf-dist/doc/latex/csvsimple/csvsimple.pdf | Bin 637468 -> 674339 bytes .../texmf-dist/doc/latex/csvsimple/csvsimple.tex | 86 ++++++++++++-- .../texmf-dist/tex/latex/csvsimple/csvsimple.sty | 51 ++++++--- 7 files changed, 181 insertions(+), 86 deletions(-) diff --git a/Master/texmf-dist/doc/latex/csvsimple/CHANGES b/Master/texmf-dist/doc/latex/csvsimple/CHANGES index 12fa1020e44..2b040d4a3a0 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/CHANGES +++ b/Master/texmf-dist/doc/latex/csvsimple/CHANGES @@ -1,60 +1,64 @@ -%% The LaTeX package csvsimple - version 1.06 (2012/11/08) -%% -%% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2008-2012 by Prof. Dr. Dr. Thomas F. Sturm -%% ------------------------------------------------------------------------------------------- -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `author-maintained'. -%% -%% This work consists of all files listed in README -%% - -version 1.00 (2010/07/28): initial public release - -version 1.01 (2010/11/10): -- documentation of some keys clarified -- new key: after first line -- new key: late after first line -- new example for key evaluation in the documentation - -version 1.02 (2011/04/04): -- error in the documentation for longtable und tabbing corrected -- new macros: \csvfilteraccept, \csvfilterreject -- new keys: filter accept all, filter reject all - -version 1.03 (2011/11/04): -- processing error for lines starting with '00' corrected - -version 1.04 (2011/11/11): -- new key: head to column names (automatic column names) -- new key: no table -- column numbers can now be used for column macro definitions -- documentation update and correction -- internal behaviour of 'before reading' and 'after reading' changed for tables - -version 1.05 (2012/03/12): -- documentation language changed from German to English -- source code of the documentation added -- provision of the csvsimple.tds.zip file for easier installation -- key @table removed from the documentation -- new keys: preprocessed file, preprocessor, no preprocessing - for preprocessing support (e.g. sorting) -- error in 'nocheckcolumncount' corrected and key renamed to 'no check column count' -- key nofilter renamed to 'no filter' and 'nohead' to 'no head' (the old names - are kept as deprecated key names) - -version 1.06 (2012/11/08): -- implementation for line breaking changed from full macro expansion to - token expansion. This allows quite arbitrary macro code inside the data. - Note that this may be a breaking change if your application expects - expanded column values. -- option values added for \csvautotabular and \csvautolongtable - +%% The LaTeX package csvsimple - version 1.07 (2013/09/25) +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2008-2013 by Prof. Dr. Dr. Thomas F. Sturm +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of all files listed in README +%% + +version 1.00 (2010/07/28): initial public release + +version 1.01 (2010/11/10): +- documentation of some keys clarified +- new key: after first line +- new key: late after first line +- new example for key evaluation in the documentation + +version 1.02 (2011/04/04): +- error in the documentation for longtable und tabbing corrected +- new macros: \csvfilteraccept, \csvfilterreject +- new keys: filter accept all, filter reject all + +version 1.03 (2011/11/04): +- processing error for lines starting with '00' corrected + +version 1.04 (2011/11/11): +- new key: head to column names (automatic column names) +- new key: no table +- column numbers can now be used for column macro definitions +- documentation update and correction +- internal behaviour of 'before reading' and 'after reading' changed for tables + +version 1.05 (2012/03/12): +- documentation language changed from German to English +- source code of the documentation added +- provision of the csvsimple.tds.zip file for easier installation +- key @table removed from the documentation +- new keys: preprocessed file, preprocessor, no preprocessing + for preprocessing support (e.g. sorting) +- error in 'nocheckcolumncount' corrected and key renamed to 'no check column count' +- key nofilter renamed to 'no filter' and 'nohead' to 'no head' (the old names + are kept as deprecated key names) + +version 1.06 (2012/11/08): +- implementation for line breaking changed from full macro expansion to + token expansion. This allows quite arbitrary macro code inside the data. + Note that this may be a breaking change if your application expects + expanded column values. +- option values added for \csvautotabular and \csvautolongtable + +version 1.07 (2013/09/25): +- internal macro '\TrimSpaces' renamed to avoid name clashed with 'xparse' +- new option 'separator' to set the data value separator to + 'comma', 'semicolon', or 'pipe' diff --git a/Master/texmf-dist/doc/latex/csvsimple/README b/Master/texmf-dist/doc/latex/csvsimple/README index 840bef3c6aa..ff38a38ef59 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/README +++ b/Master/texmf-dist/doc/latex/csvsimple/README @@ -1,7 +1,7 @@ -%% The LaTeX package csvsimple - version 1.06 (2012/11/08) +%% The LaTeX package csvsimple - version 1.07 (2013/09/25) %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2008-2012 by Prof. Dr. Dr. Thomas F. Sturm +%% Copyright (c) 2008-2013 by Prof. Dr. Dr. Thomas F. Sturm %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf index b9fc81d57b7..ca491ced639 100644 Binary files a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf and b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf differ diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex index ac2887915e5..8680f26f52d 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex +++ b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex @@ -1,4 +1,4 @@ -%% The LaTeX package csvsimple - version 1.06 (2012/11/08) +%% The LaTeX package csvsimple - version 1.07 (2013/09/25) %% csvsimple-example.tex: an example for csvsimple %% %% ------------------------------------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf index f5320a67f79..c5b455bdc87 100644 Binary files a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf and b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf differ diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex index 6d9ea7e7b6c..aff18dbd3a9 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex +++ b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex @@ -1,9 +1,9 @@ % \LaTeX-Main\ -%% The LaTeX package csvsimple - version 1.06 (2012/11/08) +%% The LaTeX package csvsimple - version 1.07 (2013/09/25) %% csvsimple.sty: Simple LaTeX CSV file processing %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2008-2012 by Prof. Dr. Dr. Thomas F. Sturm +%% Copyright (c) 2008-2013 by Prof. Dr. Dr. Thomas F. Sturm %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -51,10 +51,37 @@ \setlength{\bibitemsep}{\smallskipamount} \addbibresource{\jobname.bib} -\usepackage[documentation]{tcolorbox} +\usepackage[most,documentation]{tcolorbox} +\tcbset{skin=enhanced} \usepackage{longtable} \usepackage{csvsimple} + +\lstdefinestyle{mydocumentation}{style=tcbdocumentation, + classoffset=0, + texcsstyle=\color{blue}, + % LaTeX and other packages + moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso}, + classoffset=1, + moretexcs={% + csvset,csvreader,csvautotabular,csvloop,csvautolongtable,csvstyle, + csvnames,csvheadset,csviffirstrow,csvifoddrow,csvfilteraccept, + csvfilterreject,csvline,thecsvrow,thecsvinputline,csvlinetotablerow, + }, + texcsstyle=\color{Definition}\bfseries, + classoffset=2, + keywordstyle=\color{Option}\bfseries, + % option list + morekeywords={% + }, + classoffset=0% restore default + } + +\tcbset{documentation listing style=mydocumentation,% + docexample/.style={enhanced,colframe=Navy!50!ExampleFrame,colback=Navy!5!ExampleBack,fontlower=\footnotesize, + bicolor,colbacklower=ExampleBack!5!white,drop fuzzy shadow}, +} + \tcbmakedocSubKey{docCsvKey}{csv} \newcommand{\csvlisting}[1]{% @@ -72,17 +99,21 @@ pdfkeywords={csv file, comma separated values, key value syntax} } -\def\version{1.06}% -\def\datum{2012/11/08}% +\def\version{1.07}% +\def\datum{2013/09/25}% \makeindex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{center} -\vspace*{5mm}\par -{\bfseries\LARGE The \texttt{csvsimple} package\par} -{\large Version \version\ (\datum)\par}\bigskip +\vspace*{5mm} +\begin{tcolorbox}[enhanced, + center upper,width=10cm,boxrule=0.4pt, + colback=white,colframe=black!50!yellow,drop fuzzy midday shadow=black!50!yellow] +{\bfseries\LARGE The \texttt{csvsimple} package\par}\medskip +{\large Manual for version \version\ (\datum)\par} +\end{tcolorbox}\bigskip {\large Thomas F.~Sturm% \footnote{Prof.~Dr.~Dr.~Thomas F.~Sturm, Institut f\"{u}r Mathematik und Informatik, Universit\"{a}t der Bundeswehr M\"{u}nchen, D-85577 Neubiberg, Germany; @@ -101,7 +132,7 @@ \tableofcontents - +\enlargethispage*{1cm} \section{Introduction}% The |csvsimple| package is applied to the processing of CSV\footnote{CSV file: file with comma separated values.} files. @@ -128,7 +159,7 @@ The package |csvsimple| loads the packages \subsection{First Steps} Every line of a processable CSV file has to contain an identical amount of -comma separated values. The curly braces |{}| of \TeX\ groups can be used +comma\footnote{See \refKey{/csv/separator} for other separators than comma.} separated values. The curly braces |{}| of \TeX\ groups can be used to mask a block which may contain commas not to be processed as separators. The first line of such a CSV file is usually but not necessarily a header line @@ -852,6 +883,41 @@ Additionally, the commands defined by the key values of \end{docCsvKey} +\begin{docCsvKey}{separator}{=\meta{sign}}{no default, initially |comma|} + \catcode `|=12 + Sets the \meta{sign} which is treates as separator between the data values + of a data line. Feasible values are: + \begin{itemize} + \item\texttt{comma}: This is the initial value with '\texttt{,}' as separator. + \item\texttt{semicolon}: Sets the separator to '\texttt{;}'. +\begin{dispExample} +% \usepackage{tcolorbox} for tcbverbatimwrite +\begin{tcbverbatimwrite}{testsemi.csv} + name;givenname;matriculation;gender;grade + Maier;Hans;12345;m;1.0 + Huber;Anna;23456;f;2.3 + Wei\ss{}b\"{a}ck;Werner;34567;m;5.0 +\end{tcbverbatimwrite} + +\csvautotabular[separator=semicolon]{testsemi.csv} +\end{dispExample} + + \item\texttt{pipe}: Sets the separator to '\texttt{|}'. +\begin{dispExample} +% \usepackage{tcolorbox} for tcbverbatimwrite +\begin{tcbverbatimwrite}{pipe.csv} + name|givenname|matriculation|gender|grade + Maier|Hans|12345|m|1.0 + Huber|Anna|23456|f|2.3 + Wei\ss{}b\"{a}ck|Werner|34567|m|5.0 +\end{tcbverbatimwrite} + +\csvautotabular[separator=pipe]{pipe.csv} +\end{dispExample} + \end{itemize} +\end{docCsvKey} + +\clearpage \begin{docCsvKey}{file}{=\meta{file name}}{no default, initially |unknown.csv|} Sets the \meta{file name} of the CSV file to be processed. \end{docCsvKey} diff --git a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty index 54a54d36c3a..51e622ee8ed 100644 --- a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty +++ b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty @@ -1,8 +1,8 @@ -%% The LaTeX package csvsimple - version 1.06 (2012/11/08) +%% The LaTeX package csvsimple - version 1.07 (2013/09/25) %% csvsimple.sty: Simple LaTeX CSV file processing %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2008-2012 by Prof. Dr. Dr. Thomas F. Sturm +%% Copyright (c) 2008-2013 by Prof. Dr. Dr. Thomas F. Sturm %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -18,7 +18,7 @@ %% This work consists of all files listed in README %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csvsimple}[2012/11/08 version 1.06 LaTeX CSV file processing] +\ProvidesPackage{csvsimple}[2013/09/25 version 1.07 LaTeX CSV file processing] \RequirePackage{pgfkeys,ifthen} @@ -74,34 +74,51 @@ % the original code on the web. The original author was Michael Downes, who % provided the code as an answer to 'around the bend' question #15. \catcode`\Q=3 -\def\TrimSpaces#1{% +\def\csv@TrimSpaces#1{% \begingroup% \aftergroup\toks\aftergroup0\aftergroup{% - \expandafter\trimb\expandafter\noexpand#1Q Q}% + \expandafter\csv@trimb\expandafter\noexpand#1Q Q}% \global\edef#1{\the\toks0}% } -\def\trimb#1 Q{\trimc#1Q} -\def\trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} +\def\csv@trimb#1 Q{\csv@trimc#1Q} +\def\csv@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} \catcode`\Q=11 -% needs \csv@termination -\def\csv@breakline#1,{% +\def\csv@breakline@kernel#1{% \ifx\csv@termination#1\let\nextcol=\relax\else% \let\nextcol=\csv@breakline% \stepcounter{csvcol}% - \def\csv@col@body{#1}\TrimSpaces\csv@col@body% + \def\csv@col@body{#1}\csv@TrimSpaces\csv@col@body% \toks@\expandafter{\csv@col@body}% \expandafter\xdef\csname csvcol\roman{csvcol}\endcsname{\the\toks@}% \fi% \nextcol% } -% adds \csv@termination -\def\csv@scanline#1{% +% comma +\def\csv@breakline@A#1,{\csv@breakline@kernel{#1}} + +\def\csv@scanline@A#1{% \setcounter{csvcol}{0}% \csv@breakline#1,\csv@termination,% } +% semi colon +\def\csv@breakline@B#1;{\csv@breakline@kernel{#1}} + +\def\csv@scanline@B#1{% + \setcounter{csvcol}{0}% + \csv@breakline#1;\csv@termination;% + } + +% pipe +\def\csv@breakline@C#1|{\csv@breakline@kernel{#1}} + +\def\csv@scanline@C#1{% + \setcounter{csvcol}{0}% + \csv@breakline#1|\csv@termination|% + } + % expands a CSV line and scans content \def\csv@escanline#1{% \toks@\expandafter{#1}% @@ -360,6 +377,13 @@ table foot/.gstore in=\csv@tablefoot, @table/.code 2 args={\gdef\csv@table@begin{#1}\gdef\csv@table@end{#2}}, no table/.style={@table={}{}}, + separator/.is choice, + separator/comma/.code={\global\let\csv@scanline=\csv@scanline@A% + \global\let\csv@breakline\csv@breakline@A}, + separator/semicolon/.code={\global\let\csv@scanline=\csv@scanline@B% + \global\let\csv@breakline\csv@breakline@B}, + separator/pipe/.code={\global\let\csv@scanline=\csv@scanline@C% + \global\let\csv@breakline\csv@breakline@C}, % % default for reset default/.style={ @@ -384,7 +408,8 @@ after table=, table head=, table foot=, - no table + no table, + separator=comma, }, default, % -- cgit v1.2.3