CSV2LATEX(1)

πŸ“¦
version 0.23.1 Β· 2 versions
  • 0.23.1 Β· debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.22 Β· ubuntu jammy
, in debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ CSV2LATEX(1) β€” like, the whole vibe ✨

okay bestie, welcome to the csv2latex manual page πŸ’– this one lives in the General Commands Manual section of your friendly neighbourhood man command, and it's about turning boring spreadsheets into gorgeous LaTeX tables. no cap. let's get into it 🫢


πŸŽ€ NAME πŸŽ€

csv2latex β€” convert a csv file into a LaTeX document πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

csv2latex [--nohead]  [--longtable]  [--noescape]  [--guess]
[--separator c|s|t|p|l]  [--block q|d|n]  [--lines #]  [--position
l|c|r]  [--colorrows 0-1]  [--reduce 1|2|3|4]  [--repeatheader]
[--nohlines]  [--novlines]  [--landscape]  [--font #]  [file]

that's the whole shape of it, queen. all those brackets mean optional, and [file] is the one lil' positional thing you hand over 🌸


🌈 DESCRIPTION 🌈

so this manual page documents the csv2latex program. that's the whole point of it existing, iykyk ✨

csv2latex is a program that reads a "comma separated values" (csv) file and outputs a LaTeX file with one or more tabular environments, showing off the printable values of that csv file. and where does the LaTeX code go? straight onto standard output, periodt πŸ’…

so-called "comma separated values" files are, like, the common format for exchanging two-dimensional tables between programs β€” spreadsheet editors and stuff β€” and they can hold pretty much any kind of data. by default a csv file is printable data separated by commas (,), where each comma is a cell separator and each line is a row. by extension, cell separators can be tabs instead, if the comma counts as printable data. and ngl, some files that are not true csv files can be assumed to be two-dimensional tables anyway πŸ‘€ and sometimes, if the printable data itself contains the cell separator of the exchange format, the format can use a second extra character to embrace the printable data into a block (e.g. quoted text). so it's still possible to parse the file by using the block delimiter β€” used twice, to embrace the cell β€” instead of the separator. iconic behaviour tbh.

csv2latex aims to parse various csv formats plus formats that fit into the definition above, assuming the data is text, and to produce a yet-simple LaTeX file using the tabular environment for that table-style layout. and some output options will also use macros provided by extra LaTeX packages that are commonly included in the main LaTeX distributions. cute, right? πŸŽ€


πŸ’– OPTIONS πŸ’–

this program follows the usual GNU command line syntax, with long options starting with two dashes (-). a summary of options is included below, and yes, we're doing all of them 🌸

  • -h, --help β€” show summary of options. your little help bestie 🫢
  • -v, --version β€” show version of program.
  • -n, --nohead β€” do not output the LaTeX document header. this is useful when the output is to be included as a separate file into the master document πŸ“„
  • -t, --longtable β€” uses the 'longtable' package instead of the 'tabular' one. this is useful when the input is long, with the --lines 0 option. this option uses the extra longtable LaTeX package. if you also use the --nohead option, do not forget to add the following line into the header of your master document: "\usepackage{longtable}" 🫑
  • -x, --noescape β€” do not escape TeX control characters from the input. this is useful when the input contains already TeX code πŸ‘‘
  • -g, --guess β€” try to guess the csv format. this is useful when the input is not strictly a comma separated set of printable data. for example, a line like %Foo, Bar%:%Wizz: Hey% may be parsed as "Foo, Bar" then "Wizz: Hey" πŸ”
  • -s c|s|t|p|l, --separator c|s|t|p|l β€” set the given separator as cell separator of the csv format. c means a comma (default). s means a semicolon. t means a tab. p means a space. l means a colon.
  • -b q|d|n, --block q|d|n β€” set the given block delimiter that embraces the printable data of the csv format. q means a simple quote. d means a double quote. n means no quoting at all (default).
  • -l #, --lines # β€” force the output to be multiple tabulars, each having a limited number of lines. the given argument must be a POSITIVE INTEGER VALUE. this is useful when the number of input rows is too big to fit into a single papersheet. a good average for a4 paper is about 40 lines (default). 0 means infinity (actually about 2 Giga lines) 😭
  • -p l|c|r, --position l|c|r β€” set the text position in all cells at once. this simply uses one of the three basic cell formatting options of the LaTeX tabular environment. l means left-aligned (default). c means centered. r means right-aligned.
  • -c 0-1, --colorrows 0-1 β€” alternate white/gray rows on the LaTeX output, having the given graylevel. the given argument must be a REAL NUMBER BETWEEN 0 AND 1. 0 means black while 1 means white. a nice looking value is 0.75 when printed on white paper. this option uses the extra colortbl LaTeX package. if you also use the --nohead option, do not forget to add the following line into the header of your master document: "\usepackage{colortbl}" 🌈
  • -r 1|2|3|4, --reduce 1|2|3|4 β€” reduce the size of the tabular and the font in the LaTeX output, given a reduction level. the given argument must be one of 1, 2, 3 or 4. the more the level is high, the more the tabular will appear small. this is useful to shrink the table width when the printable data is made of very long text. this option uses the extra relsize LaTeX package. if you also use the --nohead option, do not forget to add the following line into the header of your master document: "\usepackage{relsize}" ✨
  • -z, --nohlines β€” do not output horizontal lines in the table(s). 🚫
  • -y, --novlines β€” do not output vertical lines in the table(s). 🚫
  • -e, --repeatheader β€” repeat the first row of the first table in every table. this is useful when the output is very long and separated in multiple tables. πŸ‘‘
  • -f #, --font # β€” set the font size to be inserted on the header and use it to compute lines per table. the given argument must be an integer in points unit. if used in conjunction with --lines set to 0, then the lines per tabular is computed based on LaTeX \textheight defaulting to 592 pt. if the --longtable is used, then the computation is not done. if you also use the --nohead option, you should use the same font size according to your own LaTeX document for best result πŸ’œ
  • -a, --landscape β€” set landscape mode in the LaTeX document header. if used in conjunction with --lines set to 0 and --font size, then the \textheight used to compute lines per tabular defaults to (592 / 1.414) pt. if you also use the --nohead option, you should set your own LaTeX document to landscape mode for best result πŸŒ…
fr fr, watch out for those extra packages (longtable, colortbl, relsize) β€” if you're going --nohead, you have to add the \usepackage{...} lines yourself or your master document will simply not slay πŸ’€

πŸ“ EXAMPLES πŸ“

create a PDF document with small text, alternate gray rows, 80 lines per table, from a guessed csv format of the january stats that my boss created with his super point-and-click spreadsheet program (which could not generate a PDF output!). like… sir?? 😭

csv2latex --guess --lines 80 --colorrows 0.75 --reduce 2
january_stats.csv > january_stats.tex && pdflatex january_stats.tex

quickly preview a phonebook from a file formatted as "Surname" "Name" "Phone" "Cellular":

csv2latex -s p -b d -l 42 phonebook-sorted.txt | latex

🧚 SEE ALSO 🧚

tex (1), latex (1).


okay that's the whole page, bestie 🫢 this was the csv2latex(1) page, from the General Commands Manual, and that little CSV2LATEX(1) footer you'd normally see at the bottom is just this page signing off πŸ’… mwah, go make some pretty tables βœ¨πŸŽ€