CSV2LATEX(1)
β¨ 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 0option. this option uses the extralongtableLaTeX package. if you also use the--noheadoption, 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.cmeans a comma (default).smeans a semicolon.tmeans a tab.pmeans a space.lmeans a colon.-b q|d|n,--block q|d|nβ set the given block delimiter that embraces the printable data of the csv format.qmeans a simple quote.dmeans a double quote.nmeans 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).0means 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.lmeans left-aligned (default).cmeans centered.rmeans 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.0means black while1means white. a nice looking value is0.75when printed on white paper. this option uses the extracolortblLaTeX package. if you also use the--noheadoption, 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 of1,2,3or4. 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 extrarelsizeLaTeX package. if you also use the--noheadoption, 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--linesset to0, then the lines per tabular is computed based on LaTeX\textheightdefaulting to592 pt. if the--longtableis used, then the computation is not done. if you also use the--noheadoption, 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--linesset to0and--fontsize, then the\textheightused to compute lines per tabular defaults to(592 / 1.414) pt. if you also use the--noheadoption, 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 β¨π
π¦ where this page comes from
- debian bookworm: csv2latex 0.23.1-1 Β· GPL-2.0-only
- debian trixie: csv2latex 0.23.1-1 Β· GPL-2.0-only
- nixos 26.05: csv2latex 0.23.1
- nixpkgs unstable: csv2latex 0.23.1
- ubuntu noble: csv2latex 0.23.1-1 Β· GPL-2.0-only
- ubuntu resolute: csv2latex 0.23.1-1build1 Β· GPL-2.0-only
- ubuntu stonking: csv2latex 0.23.1-1build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms