Skip to content

Commit 2c8abf4

Browse files
authored
Merge pull request #44 from dbatten5/docs
docs update
2 parents 7f10423 + 23a18e4 commit 2c8abf4

File tree

2 files changed

+29
-33
lines changed

2 files changed

+29
-33
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
name: Tests
22

33
on:
4-
- push
5-
- pull_request
4+
push:
5+
paths-ignore:
6+
- "docs/**"
7+
- "*.md"
8+
pull_request:
9+
paths-ignore:
10+
- "docs/**"
11+
- "*.md"
612

713
jobs:
814
tests:

docs/usage.md

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4742
So 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}
5247
1.00\mathrm{e}{+03} & 2.00\mathrm{e}{+03} & 3.00\mathrm{e}{+03} \\
5348
4.00\mathrm{e}{+03} & 5.00\mathrm{e}{+03} & 6.00\mathrm{e}{+03} \\
@@ -57,7 +52,7 @@ So can builtin number formatters:
5752
Prefer 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}
6257
1.00 \times 10^{+03} & 2.00 \times 10^{+03} & 3.00 \times 10^{+03} \\
6358
4.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
8171
Col 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
9585
Col 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
10999
Data & 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
123113
Index & 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
137127
Which 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

Comments
 (0)