-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tex
39 lines (32 loc) · 876 Bytes
/
main.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\documentclass[margin=0.1cm]{standalone}
\usepackage{luacode} %improved lua code
\usepackage{pgfkeys}
\pgfkeys{%
/tabular/.cd,%
csv/.code={%
\luaexec{dofile("script.lua")%
csv_to_tabular(\luastring{#1})%
tex.print("\string\\input{output.tex}\%")%
}%
},
tsv/.code={%
\directlua{dofile("script.lua")%
tsv_to_tabular(\luastring{#1})%
tex.print("\string\\input{output.tex}")%
}%
},
}
\newcommand{\tabularfromcsv}[2][csv]{
\pgfkeys{/tabular/#1=#2}
}
\begin{document}
\begin{tabular}{c|c|c|c|c}%
\tabularfromcsv{test.csv}%
\end{tabular}
\begin{tabular}{c|c|c|c|c}
\input{output.tex}
\end{tabular}
\begin{tabular}{c|c|c|c|c}
01 & 02 & 03 & 04 & 05\\06 & 07 & 08 & 09 & 10\\11 & 12 & 13 & 14 & 15\\16 & 17 & 18 & 19 & 20\\21 & 22 & 23 & 24 & 26
\end{tabular}
\end{document}