@@ -10,27 +10,22 @@ Suppose you want to convert a `numpy.NDArray` object to a LaTeX representation:
1010
1111``` python
1212>> > import numpy as np
13- >> > A = np.arange(6 ).reshape(2 , 3 )
13+ >> > A = np.arange(1 , 7 ).reshape(2 , 3 )
1414>> > A
15- array([[0 , 1 , 2 ],
16- [3 , 4 , 5 ]])
15+ array([[1 , 2 , 3 ],
16+ [4 , 5 , 6 ]])
1717```
1818
1919## To matrix
2020
21- First import the ` to_matrix ` function :
21+ Basic usage :
2222
2323``` python
2424>> > from arraytex import to_matrix
25- ```
26-
27- Then run ` to_matrix ` with a ` numpy.NDArray ` object as the first argument:
28-
29- ``` python
3025>> > print (to_matrix(A))
3126\begin{bmatrix}
32- 0 & 1 & 2 \\
33- 3 & 4 & 5 \\
27+ 1 & 2 & 3 \\
28+ 4 & 5 & 6 \\
3429\end{bmatrix}
3530```
3631
@@ -39,15 +34,15 @@ Different matrix style environment delimiters can be used:
3934``` python
4035>> > print (to_matrix(A, style = " p" ))
4136\begin{pmatrix}
42- 0 & 1 & 2 \\
43- 3 & 4 & 5 \\
37+ 1 & 2 & 3 \\
38+ 4 & 5 & 6 \\
4439\end{pmatrix}
4540```
4641
4742So can builtin number formatters:
4843
4944``` python
50- >> > print (to_matrix((A + 1 ) * 1e3 , num_format = " .2e" ))
45+ >> > print (to_matrix(A * 1e3 , num_format = " .2e" ))
5146\begin{bmatrix}
52471.00 \mathrm{e}{+03} & 2.00\mathrm{e}{+03} & 3.00\mathrm{e}{+03} \\
53484.00 \mathrm{e}{+03} & 5.00\mathrm{e}{+03} & 6.00\mathrm{e}{+03} \\
@@ -57,7 +52,7 @@ So can builtin number formatters:
5752Prefer scientific notation to e-notation? No problem:
5853
5954``` python
60- >> > print (to_matrix((A + 1 ) * 1e3 , num_format = " .2e" , scientific_notation = True ))
55+ >> > print (to_matrix(A * 1e3 , num_format = " .2e" , scientific_notation = True ))
6156\begin{bmatrix}
62571.00 \times 10^{+03} & 2.00 \times 10^{+03} & 3.00 \times 10^{+03} \\
63584.00 \times 10^{+03} & 5.00 \times 10^{+03} & 6.00 \times 10^{+03} \\
@@ -66,22 +61,17 @@ Prefer scientific notation to e-notation? No problem:
6661
6762## To tabular
6863
69- First import the ` to_tabular ` function :
64+ Basic usage :
7065
7166``` python
7267>> > from arraytex import to_tabular
73- ```
74-
75- Then run ` to_tabular ` with a ` numpy.NDArray ` as the first argument:
76-
77- ``` python
7868>> > print (to_tabular(A))
7969\begin{tabular}{c c c}
8070\toprule
8171Col 1 & Col 2 & Col 3 \\
8272\midrule
83- 0 & 1 & 2 \\
84- 3 & 4 & 5 \\
73+ 1 & 2 & 3 \\
74+ 4 & 5 & 6 \\
8575\bottomrule
8676\end{tabular}
8777```
@@ -94,8 +84,8 @@ The `num_format` and `scientific_notation` arguments are available to use:
9484\toprule
9585Col 1 & Col 2 & Col 3 \\
9686\midrule
97- 0 .00 & 1 .00 & 2 .00 \\
98- 3 .00 & 4 .00 & 5 .00 \\
87+ 1 .00 & 2 .00 & 3 .00 \\
88+ 4 .00 & 5 .00 & 6 .00 \\
9989\bottomrule
10090\end{tabular}
10191```
@@ -108,8 +98,8 @@ You can pass custom column names and column align identifiers:
10898\toprule
10999Data & More Data & Even More Data \\
110100\midrule
111- 0 & 1 & 2 \\
112- 3 & 4 & 5 \\
101+ 1 & 2 & 3 \\
102+ 4 & 5 & 6 \\
113103\bottomrule
114104\end{tabular}
115105```
@@ -122,8 +112,8 @@ Pass a list of row identifiers to be used as a table index:
122112\toprule
123113Index & Col 1 & Col 2 & Col 3 \\
124114\midrule
125- Sample 1 & 0 & 1 & 2 \\
126- Sample 2 & 3 & 4 & 5 \\
115+ Sample 1 & 1 & 2 & 3 \\
116+ Sample 2 & 4 & 5 & 6 \\
127117\bottomrule
128118\end{tabular}
129119```
@@ -136,8 +126,8 @@ Specify the name of the index column through `col_names`:
136126\toprule
137127Which Sample & A & B & C \\
138128\midrule
139- Sample 1 & 0 & 1 & 2 \\
140- Sample 2 & 3 & 4 & 5 \\
129+ Sample 1 & 1 & 2 & 3 \\
130+ Sample 2 & 4 & 5 & 6 \\
141131\bottomrule
142132\end{tabular}
143133```
0 commit comments