Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camilla D. K. Harris

October 2018

texformatter

This module contains functions for printing numbers and tables in TeX format.

Examples

Use it like this:

import texformatter as texf
x = 3.14

# decimal
texstr = texf.decimal("{:4.2f}".format(x)) # -> $3.14$
# scientific notation
texstr = texf.scinot("{:1.0E}".format(x)) # -> $3\times10^{+00}$

# Then write the number to a file:
with open("x.tex","w") as text_file:
    print(texstr, file=text_file)

Then reference the number in your tex source with \input{} like:

The value of $\pi$ is \input{x.tex}.

Print a table:

import texformatter as texf
a = {"b":["1","2","3"],"c":["1","2","3"]}
print(texf.dict2tab(a,columns=False))

Output will be:

\begin{tabular}{clll}
b&1&2&3\\
c&1&2&3\\
\end{tabular}

About

A python module for integrating script output with TeX.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages