latextable -- produces LaTeX snippets. E.g. From table data/code into LaTeX tables/captions.
Program Name : latextable ('=Bin=')
Usage Example :
latextable -_ -w 12 -3 4..8 # Assuming 12 columns and treat some column in numbers and emphasize spaces.
Give the tab separated table from STDIN, then it yields a LaTeX table code from "\begin{table})..".
Labor-saving to create LaTeX tables from the copy/paste from Excel and SQL outputs, etc.
Main functions :
NOT ONLY performing the tedious work in typing LaTeX codes such as
(1) transforming tab characters into ampersands (&) characters for table environments,
(2) adding the "\hline" on the beginning and the ending inside the tabular environments,
BUT ALSO
(3) grouping every 3 digits by comma on numbers >= 1000 and aligning toward right in a column,
(4) properly modifying various signs \~!<>_%#&$ fitting into LaTeX (with -j, Japanese half-width as well),
(5) emphasizing the space chacters both usual half-size space and full-width space,
(6) by with -_, emphasizing the fullsize hyphen to indicate that it differs from prolonged sound sign.
Options :
-/ REGEX : Specifying the input delimter. Default is tab character. You can specify as -/ , for pseudo-CSV.
-= : To indicate that the first line in STDIN is the header, to yield "\hline" btw. 1st and 2nd lines.
-w N : Specification of the max number of columns. The columns over this limit will be neglected.
-$ : -\$ の指定によりあふれた列は、列を増やさずに残すこと指定。
-j : For Japanese half-width character. The LaTeX output utilize \scalebox{0.5}[1]{...}
-s N : N is the displaying magnifying factor. Often used for large-size table to reduce the physical size.
-_ : To emphasize the space character. Both for half-width \x{20} and full-width \x{3000}.
-0 regex ; The regex will be removed in the output. E.g, if you want the exact 0, specify : -0 '^0$'
-1 ; The leftmost column will be : (1) separated by horizontal line, and (2) -0 will not be applied there.
-3 n[..n][,n[..n]][,n[..n]].. ; Specify number columns. The leftest columns is numbered 1.
-9 : Rotate the entire table 90 degree unclockwise, using "\rotatebox{90}".
-x 60mm ; logical narrowing of a table for the purpose of cenering a wide table.
-\' : Rotate each cell of the 1st line unclockwise. Often used that column names are long string.
-p ; Suppresses the redundant comments on LaTeX output. (Primitive)
-s ; remoring the spaces of : (1) consecutive space characters in the end of line and (2) blank lines.
-\# str : テーブル内の各行と各列に罫線を挿入する。 -\# 1 で実線、 -\# . により点線(\usepackage{arydshln} が必要)。
-C [mnh]+ : Useful to table caption and main text. One or more characters from {m,n,h} is requried after -C
-C m : encloses mbox{} for every input line ;
-C n : add "\newline" in the end of every input line, to be used in Latex table caption ;
-C h : add "hspace*{-6mm}" on the head of every line where the length (here -6mm) is specified by "-x -6mm".
-H N : Shrinkens hexadecimal digits with more than N digits by taking the head N digits with ".." in the tail.
--help : Print this online help manual of this command "'=SCRIPT='". Similar to "perldoc `which [-t] '=SCRIPT='` ".
--help opt ..or.. --help options : Only shows the option helps. It is easy to read when you are in very necessary.
--help ja : Shows Japanese online help manual. ; "'=script=' --help ja" で日本語のオンラインマニュアルを表示します。
--help nopod : Print this online manual using the code insdide this program without using the function of Perl POD.
Remarks :
- \usepackage{graphicx} is needed between \documentclass and \begin{document}, for rotating and magnifying.
- The output LaTeX snippet does not work well if the column number of each line increase in a table.
- Please fill in \caption{} and \label{} as neccessary in the output LaTeX code.
Notes for developing :
* I want to add -r switching options to specify only right alignment.
* I have not yet fully investigate good LaTeX books yet. I only developed this program merely mainly by experience.
# This program has been made since 2018-02-09(Fri) by Toshiyuki Shimono, as a part of TSV hacking toolset for table data.