From 140b6ff99d0a085bc04019ed910de8adf571e45a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 12 Nov 2011 23:36:55 +0000 Subject: csvsimple (11nov11) git-svn-id: svn://tug.org/texlive/trunk@24575 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/csvsimple/CHANGES | 77 +++++++++-------- Master/texmf-dist/doc/latex/csvsimple/README | 2 +- .../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 570779 -> 580548 bytes .../texmf-dist/tex/latex/csvsimple/csvsimple.sty | 94 +++++++++++++++------ 6 files changed, 110 insertions(+), 65 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/csvsimple/CHANGES b/Master/texmf-dist/doc/latex/csvsimple/CHANGES index 75dc9bda505..4076a947193 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/CHANGES +++ b/Master/texmf-dist/doc/latex/csvsimple/CHANGES @@ -1,35 +1,42 @@ -%% The LaTeX package csvsimple - version 1.03 (2011/11/04) -%% -%% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2008-2011 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): -- Documention 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 - +%% The LaTeX package csvsimple - version 1.04 (2011/11/11) +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2008-2011 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 + diff --git a/Master/texmf-dist/doc/latex/csvsimple/README b/Master/texmf-dist/doc/latex/csvsimple/README index c3c0d6b659a..c22e2815f8e 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/README +++ b/Master/texmf-dist/doc/latex/csvsimple/README @@ -1,4 +1,4 @@ -%% The LaTeX package csvsimple - version 1.03 (2011/11/04) +%% The LaTeX package csvsimple - version 1.04 (2011/11/11) %% %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2008-2011 by Prof. Dr. Dr. Thomas F. Sturm diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf index f5ec2c4d625..b0891ff94f3 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 dae6b4408b4..bccdba6191a 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.03 (2011/11/04) +%% The LaTeX package csvsimple - version 1.04 (2011/11/11) %% 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 c1f440ceb37..44e40b77d94 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/tex/latex/csvsimple/csvsimple.sty b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty index 67f48ed1692..d2945adf221 100644 --- a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty +++ b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty @@ -1,4 +1,4 @@ -%% The LaTeX package csvsimple - version 1.03 (2011/11/04) +%% The LaTeX package csvsimple - version 1.04 (2011/11/11) %% csvsimple.sty: Simple LaTeX CSV file processing %% %% ------------------------------------------------------------------------------------------- @@ -18,7 +18,7 @@ %% This work consists of all files listed in README %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csvsimple}[2011/11/04 version 1.03 LaTeX CSV file processing] +\ProvidesPackage{csvsimple}[2011/11/11 version 1.04 LaTeX CSV file processing] \RequirePackage{pgfkeys,ifthen} @@ -115,12 +115,23 @@ \def\csv@current@col{\csname csvcol\roman{csvcol}\endcsname} -% head names +% auto head names +\def\set@csv@autohead{% + \toks0=\expandafter{\csname\csv@current@col\endcsname}% + \toks1=\expandafter{\csname csvcol\roman{csvcol}\endcsname}% + \edef\csv@temp{\noexpand\gdef\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\noexpand\gdef\the\toks0{}}}% + \csv@temp% +} + + +% head names and numbers \def\set@csv@head{% \toks0={\gdef##1}% \toks1=\expandafter{\csname csvcol\roman{csvcol}\endcsname}% - \edef\temp{\noexpand\pgfkeysdef{/csv head/\csv@current@col}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% - \temp% + \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\csv@current@col}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% + \csv@temp% + \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\thecsvcol}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% + \csv@temp% } % head line @@ -131,6 +142,7 @@ \setcounter{csvcol}{0}% \loop% \stepcounter{csvcol}% + \csv@opt@headtocolumnames% \set@csv@head% \ifnum\thecsvcol<\csv@columncount\repeat% \toks@=\expandafter{\csv@columnnames}% @@ -139,6 +151,26 @@ \csv@posthead% } +% head numbers for no head +\def\set@csv@nohead{% + \toks0={\gdef##1}% + \toks1=\expandafter{\csname csvcol\roman{csvcol}\endcsname}% + \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\thecsvcol}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% + \csv@temp% +} + +% no head line +\def\csv@noheadline{% + \setcounter{csvcol}{0}% + \loop% + \stepcounter{csvcol}% + \set@csv@nohead% + \ifnum\thecsvcol<\csv@columncount\repeat% + \toks@=\expandafter{\csv@columnnames}% + \edef\csv@processkeys{\noexpand\pgfkeys{/csv head/.cd,\the\toks@}}% + \csv@processkeys% +} + % check filter \def\csv@checkfilter{% \csv@prefiltercommand% @@ -191,6 +223,7 @@ % options \csvset{default,every csv,#1}% \csv@prereading% + \csv@table@begin% \setcounter{csvinputline}{0}% % start reading \openin\csv@file=\csv@filename\relax% @@ -245,6 +278,7 @@ \closein\csv@file% \@endloophook% \csv@latepostlastline% + \csv@table@end% \csv@postreading% } @@ -275,19 +309,23 @@ \def\temp{#1}\toks1=\expandafter{\temp}% \xdef\csv@columnnames{\the\toks0,\the\toks1}% }, - command/.gstore in=\csv@body, + command/.gstore in=\csv@body,% check column count/.code={\ifthenelse{\equal{#1}{true}}{% \global\let\csv@opt@checkcolumncount=\csv@checkcolumncount}{% \global\let\csv@opt@checkcolumncount=\csv@nocheckcolumncount}}, - check column count/.default=true, + check column count/.default=true,% on column count error/.gstore in=\csv@columncounterror, head/.code={\ifthenelse{\equal{#1}{true}}{% \global\let\csv@opt@processheadline=\csv@processheadline% \pgfkeysalso{check column count}}{% - \global\let\csv@opt@processheadline=\csv@empty% + \global\let\csv@opt@processheadline=\csv@noheadline% \pgfkeysalso{check column count=false,late after head=}}}, - head/.default=true, - column count/.gstore in=\csv@columncount, + head/.default=true,% + head to column names/.code={\ifthenelse{\equal{#1}{true}}{% + \global\let\csv@opt@headtocolumnames=\set@csv@autohead}{% + \global\let\csv@opt@headtocolumnames=\csv@empty}},% + head to column names/.default=true,% + column count/.gstore in=\csv@columncount,% filter/.code={% \def\temp{#1}\toks@=\expandafter{\temp}% \xdef\csv@iffilter{\noexpand\ifthenelse{\the\toks@}}}, @@ -310,6 +348,8 @@ after table/.gstore in=\csv@posttable, table head/.gstore in=\csv@tablehead, table foot/.gstore in=\csv@tablefoot, + @table/.code 2 args={\gdef\csv@table@begin{#1}\gdef\csv@table@end{#2}}, + no table/.style={@table={}{}}, % % default for reset default/.style={ @@ -317,6 +357,8 @@ command=\csvline, column names reset, head, + head to column names=false, + column count=10, on column count error=, nofilter, before filter=, @@ -330,7 +372,8 @@ before table=, after table=, table head=, - table foot= + table foot=, + no table }, default, % @@ -342,17 +385,22 @@ filter equal/.style 2 args={filter=\equal{#1}{#2}}, filter not equal/.style 2 args={filter=\not\equal{#1}{#2}}, tabular/.style={ - before reading=\csv@pretable\begin{tabular}{#1}\csv@tablehead, - after reading=\csv@tablefoot\end{tabular}\csv@posttable, + @table={\csv@pretable\begin{tabular}{#1}\csv@tablehead}{\csv@tablefoot\end{tabular}\csv@posttable}, late after line=\\}, centered tabular/.style={ - before reading=\begin{center}\csv@pretable\begin{tabular}{#1}\csv@tablehead, - after reading=\csv@tablefoot\end{tabular}\csv@posttable\end{center}, + @table={\begin{center}\csv@pretable\begin{tabular}{#1}\csv@tablehead}{\csv@tablefoot\end{tabular}\csv@posttable\end{center}}, late after line=\\}, longtable/.style={ - before reading=\csv@pretable\begin{longtable}{#1}\csv@tablehead, - after reading=\csv@tablefoot\end{longtable}\csv@posttable, + @table={\csv@pretable\begin{longtable}{#1}\csv@tablehead}{\csv@tablefoot\end{longtable}\csv@posttable}, late after line=\\}, + tabbing/.style={ + @table={\csv@pretable\begin{tabbing}\csv@tablehead}{\csv@tablefoot\end{tabbing}\csv@posttable}, + late after line=\\, + late after last line=}, + centered tabbing/.style={ + @table={\begin{center}\csv@pretable\begin{tabbing}\csv@tablehead}{\csv@tablefoot\end{tabbing}\csv@posttable\end{center}}, + late after line=\\, + late after last line=}, autotabular/.style={ file=#1, after head=\csv@pretable\begin{tabular}{|*{\csv@columncount}{l|}}\csv@tablehead, @@ -367,17 +415,7 @@ table head=\hline\csvlinetotablerow\\\hline\endhead\hline\endfoot, late after line=\\, late after last line=\csv@tablefoot\end{longtable}\csv@posttable, - command=\csvlinetotablerow}, - tabbing/.style={ - before reading=\csv@pretable\begin{tabbing}\csv@tablehead, - after reading=\csv@tablefoot\end{tabbing}\csv@posttable, - late after line=\\, - late after last line=}, - centered tabbing/.style={ - before reading=\begin{center}\csv@pretable\begin{tabbing}\csv@tablehead, - after reading=\csv@tablefoot\end{tabbing}\csv@posttable\end{center}, - late after line=\\, - late after last line=} + command=\csvlinetotablerow} } \def\csvautotabular#1{\csvloop{autotabular={#1}}} -- cgit v1.2.3