File tree 2 files changed +10
-17
lines changed
2 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Use it like this:
16
16
# decimal
17
17
texstr = texf.decimal("{:4.2f}".format(x)) # -> $3.14$
18
18
# scientific notation
19
- texstr = texf.scinot("{:1E }".format(x)) # -> $3\times10^{0 }$
19
+ texstr = texf.scinot("{:1.0E }".format(x)) # -> $3\times10^{+00 }$
20
20
21
21
# Then write the number to a file:
22
22
with open("x.tex","w") as text_file:
Original file line number Diff line number Diff line change 4
4
5
5
This module contains functions for printing numbers and tables in TeX format.
6
6
7
- Use it like:
7
+ Functions
8
+ ----------
8
9
9
- import texformatter as texf
10
- x = 3.14
10
+ decimal: Returns a decimal string formatted for TeX math mode.
11
11
12
- # decimal
13
- texstr = texf.decimal("{:4.2f}".format(x)) -> $3.14$
14
- # scientific notation
15
- texstr = texf.scinot("{:1E}".format(x)) -> $3\t imes10^{0}$
12
+ scinot: Returns a scientific notation string formatted for TeX math mode.
16
13
17
- # Then write the number to a file:
18
- with open("x.tex","w") as text_file:
19
- print(texstr, file=text_file)
14
+ dict2tab: Returns a table string formatted for TeX.
20
15
21
- Then reference the number in your tex source with \input{} like:
22
- The value of $\pi$ is \input{x.tex}.
23
16
"""
24
17
25
18
MATH_DELIM = "$"
26
- SCINOT = ["\t imes10^{" ,"}" ]
27
- TABENV = [r"\begin{tabular}{" ,"}" ,"\end{tabular}" ]
28
- NEWLINE = "\n "
29
- HLINE = "\hline"
19
+ SCINOT = [r "\times10^{" ,"}" ]
20
+ TABENV = [r"\begin{tabular}{" ,"}" ,r "\end{tabular}" ]
21
+ NEWLINE = r "\n"
22
+ HLINE = r "\hline"
30
23
ROW_DELIM = r"\\"
31
24
COL_DELIM = "&"
32
25
You can’t perform that action at this time.
0 commit comments