diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/CHANGES | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/README | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/catsort.xml | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf | bin | 72221 -> 72221 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf | bin | 834750 -> 840011 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex | 144 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty | 50 |
8 files changed, 170 insertions, 45 deletions
diff --git a/Master/texmf-dist/doc/latex/csvsimple/CHANGES b/Master/texmf-dist/doc/latex/csvsimple/CHANGES index 09616932ce4..01716414ecc 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/CHANGES +++ b/Master/texmf-dist/doc/latex/csvsimple/CHANGES @@ -1,4 +1,4 @@ -%% The LaTeX package csvsimple - version 1.11 (2014/07/08) +%% The LaTeX package csvsimple - version 1.12 (2014/07/14) %% %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2008-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> @@ -82,3 +82,10 @@ version 1.10 (2014/07/07): version 1.11 (2014/07/08): - bug fix (serious!): sorting preprocessor overwrites the input data in some combinations - changed: if a CSV file with an empty first line is found, csvsimple stops with an error message + +version 1.12 (2014/07/14): +- fixed: CSV-Sorter call incompatibilities with the ngerman package (not babel) +- changed: success of CSV-Sorter call is checked (Note: Update to CSV-Sorter v0.94 or newer!) + new key 'csvsorter token' +- changed: encircling column entry braces removed for all entries for better siunitx compatibility +- documentation revised and extended with siunitx examples diff --git a/Master/texmf-dist/doc/latex/csvsimple/README b/Master/texmf-dist/doc/latex/csvsimple/README index f9cc49a7786..a381c139032 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.11 (2014/07/08) +%% The LaTeX package csvsimple - version 1.12 (2014/07/14) %% %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2008-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> @@ -34,6 +34,7 @@ Contents of the package 'csvsimple-example.csv' CSV file as part of the example 'csvsimple-example.pdf' Compiled example 'amountsort.xml' csvsorter configuration file (example) + 'catsort.xml' csvsorter configuration file (example) 'gradesort.xml' csvsorter configuration file (example) 'matriculationsort.xml' csvsorter configuration file (example) 'namesort.xml' csvsorter configuration file (example) diff --git a/Master/texmf-dist/doc/latex/csvsimple/catsort.xml b/Master/texmf-dist/doc/latex/csvsimple/catsort.xml new file mode 100644 index 00000000000..ac8e44aad34 --- /dev/null +++ b/Master/texmf-dist/doc/latex/csvsimple/catsort.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<csv> + <bracket empty="true" /> + <sortlines> + <column name="cats" order="ascending" type="double"/> + </sortlines> +</csv> diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf Binary files differindex 02c9035c7e8..4d61bebec6e 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf +++ b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.pdf diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex b/Master/texmf-dist/doc/latex/csvsimple/csvsimple-example.tex index a84946f42cd..fd17a30ca08 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.11 (2014/07/08) +%% The LaTeX package csvsimple - version 1.12 (2014/07/14) %% 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 Binary files differindex fdf46bb7eb7..475b6fdd9c0 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf +++ b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.pdf diff --git a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex index f68ab25177d..d27e864b673 100644 --- a/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex +++ b/Master/texmf-dist/doc/latex/csvsimple/csvsimple.tex @@ -1,5 +1,5 @@ % \LaTeX-Main\ -%% The LaTeX package csvsimple - version 1.11 (2014/07/08) +%% The LaTeX package csvsimple - version 1.12 (2014/07/14) %% csvsimple.tex: Manual %% %% ------------------------------------------------------------------------------------------- @@ -26,7 +26,7 @@ \usepackage{lmodern,parskip,array,ifthen,calc,makeidx} \usepackage{amsmath,amssymb} \usepackage[svgnames,table,hyperref]{xcolor} -\usepackage{tikz} +\usepackage{tikz,siunitx} \usepackage[pdftex,bookmarks,raiselinks,pageanchor,hyperindex,colorlinks]{hyperref} \urlstyle{sf} @@ -111,8 +111,8 @@ pdfkeywords={csv file, comma separated values, key value syntax} } -\def\version{1.11}% -\def\datum{2014/07/08}% +\def\version{1.12}% +\def\datum{2014/07/14}% \makeindex @@ -381,8 +381,7 @@ a certificate is printed only for students with grade unequal to 5.0. are described in section \ref{sec:schluessel} from page \pageref{sec:schluessel}. \begin{dispExample} -\csvreader[tabular=|r|l|l|, table head=\hline, late after line=\\, - late after last line=\\\hline]{grade.csv}% +\csvreader[tabular=|r|l|l|, table head=\hline, table foot=\hline]{grade.csv}% {name=\name,givenname=\firstname,grade=\grade}% {\grade & \firstname~\name & \csvcoliii} \end{dispExample} @@ -402,13 +401,19 @@ is useless for |\csvreader|. This list of \meta{options} controls the total processing. Especially, it has to contain the CSV file name. \begin{dispExample} -\csvloop{file={grade.csv}, column names={name=\name}, command=\name, +\csvloop{file={grade.csv}, head to column names, command=\name, before reading={List of students:\ }, late after line={{,}\ }, late after last line=.} \end{dispExample} \end{docCommand} \clearpage +The following |\csvauto...| commands are intended for quick data overview +with limited formatting potential. +See Subsection~\ref{subsec:tabsupport} on page \pageref{subsec:tabsupport} +for the general table options in combination with \refCom{csvreader} and +\refCom{csvloop}. + \begin{docCommand}{csvautotabular}{\oarg{options}\marg{file name}} |\csvautotabular| is an abbreviation for the application of the option key \refKey{/csv/autotabular} together with other \meta{options} to \refCom{csvloop}. @@ -533,7 +538,7 @@ The following students passed the test in mathematics: \begin{dispExample} \csvreader[head to column names,tabular=|l|l|l|l|, table head=\hline\bfseries \# & \bfseries Name & \bfseries Grade\\\hline, - late after line=\\, late after last line=\\\hline]{grade.csv}{}{% + table foot=\hline]{grade.csv}{}{% \csvifoddrow{\slshape\thecsvrow & \slshape\name, \givenname & \slshape\grade}% {\bfseries\thecsvrow & \bfseries\name, \givenname & \bfseries\grade}} \end{dispExample} @@ -560,7 +565,7 @@ purpose: \csvreader[tabular=rlcc, before table=\rowcolors{2}{red!25}{yellow!50}, table head=\hline\rowcolor{red!50!black}\color{white}\# & \color{white}Person & \color{white}Matr.~No. & \color{white}Grade\\\hline, - late after line=\\,head to column names]{grade.csv}{}% + head to column names]{grade.csv}{}% {\thecsvrow & \givenname~\name & \matriculation & \grade}% \end{dispExample} \end{docCommand} @@ -657,6 +662,8 @@ to be used inside these macros. of the next accepted data line (after \refKey{/csv/before filter}). They are executed before further processing of this next line. |late after line| overwrites |late after first line| and |late after last line|. + Note that table options like \refKey{/csv/tabular} set this key to |\\| + automatically. \end{docCsvKey} @@ -903,6 +910,11 @@ Additionally, the commands defined by the key values of or after |\end{tabbing}|, respectively. \end{docCsvKey} +\bigskip + +The following |auto| options are the counterparts for the respective quick +overview commands like \refCom{csvautotabular}. They are listed for +completeness, but are unlikely to be used directly. \begin{docCsvKey}{autotabular}{=\meta{file name}}{no default} Reads the whole CSV file denoted \meta{file name} with an automated formatting. @@ -1140,16 +1152,20 @@ For the third method, the \refKey{/csv/preprocessor} option is made for. This allows to access an external tool for sorting. \emph{Which tool} is your choice. -\csvsorter\footnote{\url{http://T-F-S.github.io/csvsorter/}\quad or\quad - \url{https://github.com/T-F-S/csvsorter}} \cite{sturm:2014j} +\csvsorter\ \cite{sturm:2014j} was written as a companion tool for |csvsimple|. -It is an open source Java command-line tool for sorting CSV files. It can be +It is an open source Java command-line tool for sorting CSV files, available at\\ +\url{http://T-F-S.github.io/csvsorter/}\quad or\quad +\url{https://github.com/T-F-S/csvsorter} + +It can be used for all three sorting approaches described above. There is special support for on-the-fly sorting with \csvsorter\ using the following options. \begin{enumerate}\bfseries -\item To use the sorting options, you have to install \csvsorter\ \cite{sturm:2014j} before! +\item To use the sorting options, you have to install \csvsorter\ \cite{sturm:2014j} before!\\ + |csvsimple| v1.12 or newer needs \csvsorter\ v0.94 of newer! \item You have to give permission to call external tools during compilation, i.\,e.\ the command-line options for |latex| have to include |-shell-escape|. @@ -1185,8 +1201,17 @@ following options. Here, the log file is written to a subdirectory named |outdir|. \end{docCsvKey} - \clearpage +\begin{docCsvKey}{csvsorter token}{=\meta{file name}}{no default, initially |\textbackslash jobname.csvtoken|} + Sets \meta{file name} as token file. This is an auxiliary file which + communicates the success of \csvsorter\ to |csvsimple|. + \begin{dispListing} + \csvset{csvsorter log=outdir/\jobname.csvtoken} + \end{dispListing} + Here, the token file is written to a subdirectory named |outdir|. +\end{docCsvKey} + + \begin{docCsvKey}{sort by}{=\meta{file name}}{style, initially unset} The \meta{file name} denotes an XML configuration file for \csvsorter. Setting this option inside \refCom{csvreader} or @@ -1213,8 +1238,7 @@ following options. head to column names, tabular=>{\color{red}}lllll, table head=\toprule Name & Given Name & Matriculation & Gender & Grade\\\midrule, - late after line=\\, - late after last line=\\\bottomrule] + table foot=\bottomrule] {grade.csv}{}{\csvlinetotablerow} \end{dispExample} @@ -1232,8 +1256,7 @@ following options. head to column names, tabular=llll>{\color{red}}l, table head=\toprule Name & Given Name & Matriculation & Gender & Grade\\\midrule, - late after line=\\, - late after last line=\\\bottomrule] + table foot=\bottomrule] {grade.csv}{}{\csvlinetotablerow} \end{dispExample} @@ -1251,8 +1274,7 @@ following options. head to column names, tabular=>{\color{red}}ll, table head=\toprule Matriculation & Grade\\\midrule, - late after line=\\, - late after last line=\\\bottomrule] + table foot=\bottomrule] {grade.csv}{}{\matriculation & \grade} \end{dispExample} \end{docCsvKey} @@ -1518,6 +1540,70 @@ Now, formulas only: \item \description:\qquad\content} \end{dispExample} +\clearpage +\subsection{Tables with Number Formatting}\label{numberformatting}% + +We consider a file with numerical data which should be pretty-printed. + +%-- file embedded for simplicity -- +\begin{tcbverbatimwrite}{data_numbers.csv} +month, dogs, cats +January, 12.50,12.3e5 +February, 3.32, 8.7e3 +March, 43, 3.1e6 +April, 0.33, 21.2e4 +May, 5.12, 3.45e6 +June, 6.44, 6.66e6 +July, 123.2,7.3e7 +August, 12.3, 5.3e4 +September,2.3, 4.4e4 +October, 6.5, 6.5e6 +November, 0.55, 5.5e5 +December, 2.2, 3.3e3 +\end{tcbverbatimwrite} + +\csvlisting{data_numbers} + +The |siunitx| \cite{wright:2013a} package provides a new column type |S| +which can align material using a number of different strategies. +The following example demonstrates the application with CSV reading. +The package documentation \cite{wright:2013a} contains a huge amount +of formatting options. + +\begin{dispExample} +% \usepackage{siunitx,array,booktabs} +\csvloop{ + file=data_numbers.csv, + head to column names, + before reading=\centering\sisetup{table-number-alignment=center}, + tabular={lSS[table-format=2.2e1]}, + table head=\toprule\textbf{Month} & \textbf{Dogs} & \textbf{Cats}\\\midrule, + command=\month & \dogs & \cats, + table foot=\bottomrule} +\end{dispExample} + +\clearpage +Now, the preceding table shall be sorted by the \emph{cats} values. +If the \csvsorter\ program is properly installed, +see Subsection~\ref{sec:Sorting} on page~\pageref{sec:Sorting}, +this can be done with the following configuration file for \csvsorter: + +\xmllisting{catsort} + +Now, we just have to add an option |sort by=catsort.xml|: +\begin{dispExample} +% \usepackage{siunitx,array,booktabs} +% Also, the CSV-Sorter tool has to be installed +\csvloop{ + file=data_numbers.csv, + sort by=catsort.xml, + head to column names, + before reading=\centering\sisetup{table-number-alignment=center}, + tabular={lSS[table-format=2.2e1]}, + table head=\toprule\textbf{Month} & \textbf{Dogs} & \textbf{Cats}\\\midrule, + command=\month & \dogs & \cats, + table foot=\bottomrule} +\end{dispExample} \clearpage @@ -1573,8 +1659,7 @@ because there is no head, but the columns can be addressed by their numbers: \csvreader[no head, tabular=lr, table head=\toprule\bfseries Land & \bfseries Amount\\\midrule, - late after line=\\, - late after last line=\\\bottomrule] + table foot=\bottomrule] {data_headless.csv} {1=\land,3=\amount} {\land & \amount} @@ -1618,8 +1703,7 @@ the input data. Here, we actually do not sort. sort by=transform.xml, tabular=>{\itshape}ll>{\ttfamily}l, table head=\toprule\Header{Name} & \Header{Address} & \Header{email}\\\midrule, - late after line=\\, - late after last line=\\\bottomrule] + table foot=\bottomrule] {imported.csv}{}{\csvlinetotablerow} \end{dispExample} @@ -1665,9 +1749,9 @@ The file which is generated on-the-fly and which is actually read by @manual{sturm:2014j, author = {Thomas F. Sturm}, title = {The CSV-Sorter program}, - subtitle = {Manual for version 0.91 beta}, + subtitle = {Manual for version 0.94 beta}, url = {http://T-F-S.github.io/csvsorter/csvsorter.pdf}, - date = {2014-07-05}, + date = {2014-07-14}, language = {english} } @@ -1687,6 +1771,14 @@ The file which is generated on-the-fly and which is actually read by language = {english} } +@manual{wright:2013a, + author = {Joseph Wright}, + title = {siunitx --- A comprehensive (SI) units package}, + url = {http://mirror.ctan.org/macros/latex/contrib/siunitx/siunitx.pdf}, + date = {2013-07-31}, + language = {english} +} + \end{tcbverbatimwrite} diff --git a/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty b/Master/texmf-dist/tex/latex/csvsimple/csvsimple.sty index 4712481c85d..18345ebd5cd 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.11 (2014/07/08) +%% The LaTeX package csvsimple - version 1.12 (2014/07/14) %% csvsimple.sty: Simple LaTeX CSV file processing %% %% ------------------------------------------------------------------------------------------- @@ -18,7 +18,7 @@ %% This work consists of all files listed in README %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csvsimple}[2014/07/08 version 1.11 LaTeX CSV file processing] +\ProvidesPackage{csvsimple}[2014/07/14 version 1.12 LaTeX CSV file processing] \RequirePackage{pgfkeys,ifthen} @@ -85,11 +85,16 @@ \def\csv@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} \catcode`\Q=11 +\def\csv@TrimBraces#1{\expandafter\csv@TrimBraces@#1\@nil{#1}} +\def\csv@TrimBraces@#1\@nil#2{\def#2{#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}\csv@TrimSpaces\csv@col@body% + \def\csv@col@body{#1}% + \csv@TrimSpaces\csv@col@body% + \csv@TrimBraces\csv@col@body% \toks@\expandafter{\csv@col@body}% \expandafter\xdef\csname csvcol\roman{csvcol}\endcsname{\the\toks@}% \fi% @@ -137,13 +142,30 @@ \@csv@scanline% } -\def\csv@preprocessor@csvsorter#1#2#3#4{% +{ + \catcode`\"=12% + \gdef\csv@passivquotes{"} +} + +\newwrite\csv@out + +\def\csv@preprocessor@csvsorter#1#2#3{% \begingroup% - \catcode`\"=13% - \immediate\write18{\csv@csvsorter@command\space -c "#1" -l "#2" -i "#3" -o "#4"}% + \typeout{<sort \csv@passivquotes#2\csv@passivquotes\space by \csv@passivquotes#1\csv@passivquotes>} + \immediate\openout\csv@out=\csv@csvsorter@token% + \immediate\write\csv@out{\string\makeatletter\string\csv@error{Call of CSV-Sorter failed! Use '-shell-escape' option or check log file '\csv@csvsorter@log'.}{}}% + \immediate\closeout\csv@out% + \immediate\write18{\csv@csvsorter@command\space + -c \csv@passivquotes#1\csv@passivquotes\space + -l \csv@passivquotes\csv@csvsorter@log\csv@passivquotes\space + -t \csv@passivquotes\csv@csvsorter@token\csv@passivquotes\space + -i \csv@passivquotes#2\csv@passivquotes\space + -o \csv@passivquotes#3\csv@passivquotes\space -q 1}% + \input{\csv@csvsorter@token}% \endgroup% } + \def\csv@preprocss@none{% \let\csv@input@filename=\csv@filename% } @@ -163,7 +185,7 @@ % auto head names \def\set@csv@autohead{% - \toks0=\expandafter{\csname\csv@current@col@clean\endcsname}% + \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% @@ -174,17 +196,12 @@ \def\set@csv@head{% \toks0={\gdef##1}% \toks1=\expandafter{\csname csvcol\roman{csvcol}\endcsname}% - \edef\csv@temp{\noexpand\pgfkeysdef{/csv head/\csv@current@col@clean}{\the\toks0{\the\toks1}\noexpand\csv@AtEndLoop{\the\toks0{}}}}% + \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% } -\catcode`\Q=3 -\def\csv@@clean@@head@@nameQ#1Q{\edef\csv@current@col@clean{#1}} -\def\csv@clean@head@name{\edef\csv@temp{\noexpand\csv@@clean@@head@@nameQ\csv@current@colQ}\csv@temp} -\catcode`\Q=11 - % head line \def\csv@processheadline{% \csvreadnext% @@ -196,7 +213,6 @@ \setcounter{csvcol}{0}% \loop% \stepcounter{csvcol}% - \csv@clean@head@name% \csv@opt@headtocolumnames% \set@csv@head% \ifnum\thecsvcol<\csv@columncount\repeat% @@ -260,7 +276,7 @@ \def\csv@do@linecommand{% \csv@do@latepostline% \csv@do@preline% - \csv@body% + \csv@body\relax% \csv@do@postline% } @@ -424,13 +440,15 @@ % csvsorter command/.store in=\csv@csvsorter@command, csvsorter configpath/.store in=\csv@csvsorter@configpath, - sort by/.style={preprocessor={\csv@preprocessor@csvsorter{\csv@csvsorter@configpath/#1}{\csv@csvsorter@log}}}, + sort by/.style={preprocessor={\csv@preprocessor@csvsorter{\csv@csvsorter@configpath/#1}}}, new sorting rule/.style 2 args={sort by #1/.style={sort by={#2}}}, csvsorter log/.store in=\csv@csvsorter@log, + csvsorter token/.store in=\csv@csvsorter@token, csvsorter command=csvsorter, csvsorter configpath=., preprocessed file={\jobname_sorted._csv}, csvsorter log={csvsorter.log}, + csvsorter token={\jobname.csvtoken}, % % default for reset default/.style={ |