diff options
author | Karl Berry <karl@freefriends.org> | 2014-07-14 22:44:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-07-14 22:44:11 +0000 |
commit | 7957d3f5ade91f4a42f7d12af3827a42ce0206ef (patch) | |
tree | ece174895b094fa4ed61428ce23086d3ae062a72 /Master/texmf-dist/doc/latex/csvsimple | |
parent | a60a152e4ffebfc5a0753bde98355d247335f2b2 (diff) |
csvsimple (14jul14)
git-svn-id: svn://tug.org/texlive/trunk@34610 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/csvsimple')
-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 |
7 files changed, 136 insertions, 29 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} |