1 |
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [ |
2 |
|
3 |
<!-- |
4 |
|
5 |
This document is free software; you can redistribute it and/or |
6 |
modify it under the terms of the GNU General Public License |
7 |
as published by the Free Software Foundation; version 2 only |
8 |
of the License. |
9 |
|
10 |
This program is distributed in the hope that it will be useful, |
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
GNU General Public License for more details. |
14 |
|
15 |
You should have received a copy of the GNU General Public License |
16 |
along with this document; if not, write to the Free Software |
17 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 |
Boston, MA 02110-1301, USA. |
19 |
|
20 |
see the COPYING file included in the csv2latex package or |
21 |
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt |
22 |
|
23 |
--> |
24 |
|
25 |
<!-- Process this file with docbook-to-man to generate an nroff manual |
26 |
page: `docbook-to-man manpage.sgml > manpage.1'. You may view |
27 |
the manual page with: `docbook-to-man manpage.sgml | nroff -man | |
28 |
less'. A typical entry in a Makefile or Makefile.am is: |
29 |
|
30 |
manpage.1: manpage.sgml |
31 |
docbook-to-man $< > $@ |
32 |
|
33 |
|
34 |
The docbook-to-man binary is found in the docbook-to-man package. |
35 |
Please remember that if you create the nroff version in one of the |
36 |
debian/rules file targets (such as build), you will need to include |
37 |
docbook-to-man in your Build-Depends control field. |
38 |
|
39 |
--> |
40 |
|
41 |
<!-- Fill in your name for FIRSTNAME and SURNAME. --> |
42 |
<!ENTITY dhfirstname "<firstname>BENOIT</firstname>"> |
43 |
<!ENTITY dhsurname "<surname>ROUITS</surname>"> |
44 |
<!-- Please adjust the date whenever revising the manpage. --> |
45 |
<!ENTITY dhdate "<date>january 24, 2009</date>"> |
46 |
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are |
47 |
allowed: see man(7), man(1). --> |
48 |
<!ENTITY dhsection "<manvolnum>1</manvolnum>"> |
49 |
<!ENTITY dhemail "<email>brouits@free.fr</email>"> |
50 |
<!ENTITY dhusername "Benoit Rouits"> |
51 |
<!ENTITY dhucpackage "<refentrytitle>CSV2LATEX</refentrytitle>"> |
52 |
<!ENTITY dhpackage "csv2latex"> |
53 |
|
54 |
<!ENTITY ubuntu "<productname>Ubuntu</productname>"> |
55 |
<!ENTITY debian "<productname>Debian</productname>"> |
56 |
<!ENTITY gnu "<acronym>GNU</acronym>"> |
57 |
<!ENTITY gpl "&gnu; <acronym>GPL</acronym>"> |
58 |
]> |
59 |
|
60 |
<refentry> |
61 |
<refentryinfo> |
62 |
<address> |
63 |
&dhemail; |
64 |
</address> |
65 |
<author> |
66 |
&dhfirstname; |
67 |
&dhsurname; |
68 |
</author> |
69 |
<copyright> |
70 |
<year>2003</year> |
71 |
<holder>&dhusername;</holder> |
72 |
</copyright> |
73 |
&dhdate; |
74 |
</refentryinfo> |
75 |
<refmeta> |
76 |
&dhucpackage; |
77 |
|
78 |
&dhsection; |
79 |
</refmeta> |
80 |
<refnamediv> |
81 |
<refname>&dhpackage;</refname> |
82 |
|
83 |
<refpurpose>convert a csv file into a LaTeX document</refpurpose> |
84 |
</refnamediv> |
85 |
<refsynopsisdiv> |
86 |
<cmdsynopsis> |
87 |
<command>&dhpackage;</command> |
88 |
<arg><option>--nohead</option></arg> |
89 |
<arg><option>--longtable</option></arg> |
90 |
<arg><option>--noescape</option></arg> |
91 |
<arg><option>--guess</option></arg> |
92 |
<arg><option>--separator <replaceable>c</replaceable>|<replaceable>s</replaceable>|<replaceable>t</replaceable>|<replaceable>p</replaceable>|<replaceable>l</replaceable></option></arg> |
93 |
<arg><option>--block <replaceable>q</replaceable>|<replaceable>d</replaceable>|<replaceable>n</replaceable></option></arg> |
94 |
<arg><option>--lines <replaceable>#</replaceable></option></arg> |
95 |
<arg><option>--position <replaceable>l</replaceable>|<replaceable>c</replaceable>|<replaceable>r</replaceable></option></arg> |
96 |
<arg><option>--colorrows <replaceable>0-1</replaceable></option></arg> |
97 |
<arg><option>--reduce <replaceable>1</replaceable>|<replaceable>2</replaceable>|<replaceable>3</replaceable>|<replaceable>4</replaceable></option></arg> |
98 |
<arg><option>--repeatheader</option></arg> |
99 |
<arg><option>--nohlines</option></arg> |
100 |
<arg><option>--novlines</option></arg> |
101 |
<arg><option>--landscape</option></arg> |
102 |
<arg><option>--font <replaceable>#</replaceable></option></arg> |
103 |
<arg>file</arg> |
104 |
</cmdsynopsis> |
105 |
</refsynopsisdiv> |
106 |
<refsect1> |
107 |
<title>DESCRIPTION</title> |
108 |
|
109 |
<para>This manual page documents the <command>&dhpackage;</command> program.</para> |
110 |
<para><command>&dhpackage;</command> is a program that reads a "comma separated values" (csv) file |
111 |
and outputs a LaTeX file with one or more tabular environments to display |
112 |
the printable values of the csv file. The LaTeX code is flushed on the standard output. |
113 |
</para> |
114 |
|
115 |
<para>So-called "comma separated values" files are common formats for exchanging two-dimensinal |
116 |
tables between programs such as spreadsheets editors, to represent almost any kind of data. |
117 |
By default, a csv file is made of printable data separated by commas (`,'), each comma |
118 |
representing a `cell' separator, and each line representing a row. By extension, cell |
119 |
separators can be represented by tabs if the comma is considered as printable data. |
120 |
Moreover, some non true csv files can be assumed as two-dimensional tables as well. |
121 |
In some circumstances, if the printable data includes the cell separator of the |
122 |
exchange format, the latter can use a second extra character to embrace the printable |
123 |
data into a block (e.g: quoted text). Thus, it is still possible to parse the file by |
124 |
using the block delimiter (used twice to embrace the cell) instead of the separator. |
125 |
</para> |
126 |
<para><command>&dhpackage</command> aims to parse various csv formats plus formats that fits |
127 |
into the above definiton, assuming the data is text, and to produce a yet simple LaTeX file |
128 |
using the "tabular" environment for a table-style layout. |
129 |
Some options of output will also use macros provided by extra |
130 |
LaTeX packages that are commonly included in the main LaTeX distributions. |
131 |
</para> |
132 |
</refsect1> |
133 |
<refsect1> |
134 |
<title>OPTIONS</title> |
135 |
|
136 |
<para>This program follows the usual &gnu; command line syntax, |
137 |
with long options starting with two dashes (`-'). A summary of |
138 |
options is included below.</para> |
139 |
|
140 |
<variablelist> |
141 |
<varlistentry> |
142 |
<term><option>-h</option> |
143 |
<option>--help</option> |
144 |
</term> |
145 |
<listitem> |
146 |
<para>Show summary of options.</para> |
147 |
</listitem> |
148 |
</varlistentry> |
149 |
<varlistentry> |
150 |
<term><option>-v</option> |
151 |
<option>--version</option> |
152 |
</term> |
153 |
<listitem> |
154 |
<para>Show version of program.</para> |
155 |
</listitem> |
156 |
</varlistentry> |
157 |
<varlistentry> |
158 |
<term><option>-n</option> |
159 |
<option>--nohead</option> |
160 |
</term> |
161 |
<listitem> |
162 |
<para>Do not output the LaTeX document header. |
163 |
This is useful when the output is to be included as a separate file into the master document. |
164 |
</para> |
165 |
</listitem> |
166 |
</varlistentry> |
167 |
<varlistentry> |
168 |
<term><option>-t</option> |
169 |
<option>--longtable</option> |
170 |
</term> |
171 |
<listitem> |
172 |
<para>uses the 'longtable' package instead of the 'tabular' one. |
173 |
This is useful when the input is long, with <option>--lines 0</option> option. |
174 |
This option uses the extra `longtable' LaTeX package. |
175 |
If you also use <option>--nohead</option> option, do not forget to add |
176 |
the following line into the header of your master document: "\\usepackage{longtable}". |
177 |
</para> |
178 |
</listitem> |
179 |
</varlistentry> |
180 |
<varlistentry> |
181 |
<term><option>-x</option> |
182 |
<option>--noescape</option> |
183 |
</term> |
184 |
<listitem> |
185 |
<para>Do not escape TeX control characters from the input. |
186 |
This is useful when the input contains already TeX code. |
187 |
</para> |
188 |
</listitem> |
189 |
</varlistentry> |
190 |
<varlistentry> |
191 |
<term><option>-g</option> |
192 |
<option>--guess</option> |
193 |
</term> |
194 |
<listitem> |
195 |
<para>Try to guess the csv format. |
196 |
This is useful when the input is not strictly a comma separated set of printable data. |
197 |
For example, a line like %Foo, Bar%:%Wizz: Hey% may be parsed as "Foo, Bar" then "Wizz: Hey". |
198 |
</para> |
199 |
</listitem> |
200 |
</varlistentry> |
201 |
<varlistentry> |
202 |
<term><option>-s <replaceable>c</replaceable>|<replaceable>s</replaceable>|<replaceable>t</replaceable>|<replaceable>p</replaceable>|<replaceable>l</replaceable></option> |
203 |
<option>--separator <replaceable>c</replaceable>|<replaceable>s</replaceable>|<replaceable>t</replaceable>|<replaceable>p</replaceable>|<replaceable>l</replaceable></option> |
204 |
</term> |
205 |
<listitem> |
206 |
<para>Set the given separator as cell separator of the csv format. |
207 |
`c' means a comma (default). |
208 |
`s' means a semicolon. |
209 |
`t' means a tab. |
210 |
`p' means a space. |
211 |
`l' means a colon. |
212 |
</para> |
213 |
</listitem> |
214 |
</varlistentry> |
215 |
<varlistentry> |
216 |
<term><option>-b <replaceable>q</replaceable>|<replaceable>d</replaceable>|<replaceable>n</replaceable></option> |
217 |
<option>--block <replaceable>q</replaceable>|<replaceable>d</replaceable>|<replaceable>n</replaceable></option> |
218 |
</term> |
219 |
<listitem> |
220 |
<para>Set the given block delimiter that embraces the printable data of the csv format. |
221 |
`q' means a simple quote. |
222 |
`d' means a double quote. |
223 |
`n' means no quoting at all (default). |
224 |
</para> |
225 |
</listitem> |
226 |
</varlistentry> |
227 |
<varlistentry> |
228 |
<term><option>-l <replaceable>#</replaceable></option> |
229 |
<option>--lines <replaceable>#</replaceable></option> |
230 |
</term> |
231 |
<listitem> |
232 |
<para>Force to output multiple tabulars, each having a limited number of lines. |
233 |
The given argument must be a POSITIVE INTEGER VALUE. This is useful when |
234 |
the number of input rows is too big to fit into a single papersheet. |
235 |
A good average for a4 paper is about 40 lines (default). 0 means infinity |
236 |
(actually about 2 Giga lines). |
237 |
</para> |
238 |
</listitem> |
239 |
</varlistentry> |
240 |
<varlistentry> |
241 |
<term><option>-p <replaceable>l</replaceable>|<replaceable>c</replaceable>|<replaceable>r</replaceable></option> |
242 |
<option>--position <replaceable>l</replaceable>|<replaceable>c</replaceable>|<replaceable>r</replaceable></option> |
243 |
</term> |
244 |
<listitem> |
245 |
<para>Set the text position in all cells at once. |
246 |
This simply uses one of the three basic cell formatting options of the LaTeX tabular environment. |
247 |
`l' means left-aligned (default). |
248 |
`c' means centered. |
249 |
`r' means right-aligned. |
250 |
</para> |
251 |
</listitem> |
252 |
</varlistentry> |
253 |
<varlistentry> |
254 |
<term><option>-c <replaceable>0-1</replaceable></option> |
255 |
<option>--colorrows <replaceable>0-1</replaceable></option> |
256 |
</term> |
257 |
<listitem> |
258 |
<para>Alternate white/gray rows on the LaTeX output, having the given graylevel. |
259 |
The given argument must be a REAL NUMBER BETWEEN 0 AND 1. |
260 |
0 means black while 1 means white. |
261 |
A nice looking value is 0.75 when printed on white paper. |
262 |
This option uses the extra `colortbl' LaTeX package. |
263 |
If you also use <option>--nohead</option> option, do not forget to add |
264 |
the following line into the header of your master document: "\\usepackage{colortbl}". |
265 |
</para> |
266 |
</listitem> |
267 |
</varlistentry> |
268 |
<varlistentry> |
269 |
<term><option>-r <replaceable>1</replaceable>|<replaceable>2</replaceable>|<replaceable>3</replaceable>|<replaceable>4</replaceable></option> |
270 |
<option>--reduce <replaceable>1</replaceable>|<replaceable>2</replaceable>|<replaceable>3</replaceable>|<replaceable>4</replaceable></option> |
271 |
</term> |
272 |
<listitem> |
273 |
<para>Reduce the size of the tabular and the font in the LaTeX output, given a reduction level. |
274 |
The given argument must be one of 1, 2, 3 or 4. |
275 |
The more the level is high, the more the tabular will appear small. |
276 |
This is useful to shrink the table width when the printable data is made of very long text. |
277 |
This option uses the extra `relsize' LaTeX package. |
278 |
If you also use <option>--nohead</option> option, do not forget to add |
279 |
the following line into the header of your master document: "\\usepackage{relsize}". |
280 |
</para> |
281 |
</listitem> |
282 |
</varlistentry> |
283 |
<varlistentry> |
284 |
<term><option>-z</option> |
285 |
<option>--nohlines</option> |
286 |
</term> |
287 |
<listitem> |
288 |
<para>Do not output horizontal lines in the table(s). |
289 |
</para> |
290 |
</listitem> |
291 |
</varlistentry> |
292 |
<varlistentry> |
293 |
<term><option>-y</option> |
294 |
<option>--novlines</option> |
295 |
</term> |
296 |
<listitem> |
297 |
<para>Do not output vertical lines in the table(s). |
298 |
</para> |
299 |
</listitem> |
300 |
</varlistentry> |
301 |
<varlistentry> |
302 |
<term><option>-e</option> |
303 |
<option>--repeatheader</option> |
304 |
</term> |
305 |
<listitem> |
306 |
<para>Repeat the first row of the first table in every table. |
307 |
This is useful when the output is very long and separated in |
308 |
multiple tables. |
309 |
</para> |
310 |
</listitem> |
311 |
</varlistentry> |
312 |
<varlistentry> |
313 |
<term><option>-f <replaceable>#</replaceable></option> |
314 |
<option>--font <replaceable>#</replaceable></option> |
315 |
</term> |
316 |
<listitem> |
317 |
<para>Set the font size to be inserted on the header and use it to compute lines per table. |
318 |
The given argument must be an integer in points unit. |
319 |
If used in conjunction with <option>--lines</option> set to 0, then the lines per tabular |
320 |
is computed based on LaTeX \\textheight defaulting to 592 pt. |
321 |
If the <option>--longtable</option> is used, then the computation is not done. |
322 |
If you also use <option>--nohead</option> option, you should use the same font size |
323 |
according to your own LaTeX document for best result. |
324 |
</para> |
325 |
</listitem> |
326 |
</varlistentry> |
327 |
<varlistentry> |
328 |
<term><option>-a</option> |
329 |
<option>--landscape</option> |
330 |
</term> |
331 |
<listitem> |
332 |
<para>Set landscape mode in the LaTeX document header. If used in conjunction with |
333 |
<option>--lines</option> set to 0 and <option>--font</option> size, then the \\textheight used |
334 |
to compute lines per tabular defaults to (592 / 1.414) pt. If you also use <option>--nohead</option> |
335 |
option, you should set your own LaTeX document to landscape mode for best result. |
336 |
</para> |
337 |
</listitem> |
338 |
</varlistentry> |
339 |
</variablelist> |
340 |
</refsect1> |
341 |
<refsect1> |
342 |
|
343 |
<title>EXAMPLES</title> |
344 |
|
345 |
<para>Create a PDF document with small text, alternate gray rows, 80 lines per table, |
346 |
from a guessed csv format of the january stats that my boss created with his |
347 |
super point-and-click spreadsheet program (which could not generate a PDF output!). |
348 |
</para> |
349 |
<para> |
350 |
<command>&dhpackage; --guess --lines 80 --colorrows 0.75 --reduce 2 january_stats.csv > january_stats.tex && pdflatex january_stats.tex</command> |
351 |
</para> |
352 |
|
353 |
<para>Quickly preview a phonebook from a file formatted as "Surname" "Name" "Phone" "Cellular": |
354 |
</para> |
355 |
<para> |
356 |
<command>&dhpackage; -s p -b d -l 42 phonebook-sorted.txt | latex</command> |
357 |
</para> |
358 |
|
359 |
</refsect1> |
360 |
<refsect1> |
361 |
|
362 |
<title>SEE ALSO</title> |
363 |
|
364 |
<para>tex (1), latex (1).</para> |
365 |
|
366 |
</refsect1> |
367 |
</refentry> |
368 |
|
369 |
<!-- Keep this comment at the end of the file |
370 |
Local variables: |
371 |
mode: sgml |
372 |
sgml-omittag:t |
373 |
sgml-shorttag:t |
374 |
sgml-minimize-attributes:nil |
375 |
sgml-always-quote-attributes:t |
376 |
sgml-indent-step:2 |
377 |
sgml-indent-data:t |
378 |
sgml-parent-document:nil |
379 |
sgml-default-dtd-file:nil |
380 |
sgml-exposed-tags:nil |
381 |
sgml-local-catalogs:nil |
382 |
sgml-local-ecat-files:nil |
383 |
End: |
384 |
--> |
385 |
|
386 |
|