mirror of https://github.com/Nonannet/pyladoc.git
readme updated
This commit is contained in:
parent
202d934d67
commit
60efb4a7da
24
README.md
24
README.md
|
@ -18,17 +18,17 @@ composition and element sizes on fixed size pages without manual intervention
|
||||||
is a hard problem that LaTeX is very capable of.
|
is a hard problem that LaTeX is very capable of.
|
||||||
|
|
||||||
## Example outputs
|
## Example outputs
|
||||||
The following documents are generated by [tests/test_rendering_example_doc.py](tests/test_rendering_example_doc.py):
|
The following documents are generated by [tests/test_rendering_example1_doc.py](tests/test_rendering_example1_doc.py):
|
||||||
|
|
||||||
- HTML: [test_html_render.html](https://html-preview.github.io/?url=https://github.com/Nonannet/pyladoc/blob/main/tests/out/test_html_render.html)
|
- HTML: [test_html_render1.html](https://html-preview.github.io/?url=https://github.com/Nonannet/pyladoc/blob/main/tests/out/test_html_render1.html)
|
||||||
- PDF: [test_latex_render.pdf](https://raw.githubusercontent.com/Nonannet/pyladoc/refs/heads/main/tests/out/test_LaTeX_render.pdf)
|
- PDF: [test_latex_render1.pdf](https://raw.githubusercontent.com/Nonannet/pyladoc/refs/heads/main/tests/out/test_latex_render1.pdf)
|
||||||
|
|
||||||
### Sported primitives
|
### Supported primitives
|
||||||
- Text (can be Markdown or HTML formatted)
|
- Text (can be Markdown or HTML formatted)
|
||||||
- Headings
|
- Headings
|
||||||
- Tables (Pandas, Markdown or HTML)
|
- Tables (Pandas, Markdown or HTML)
|
||||||
- Matplotlib figures
|
- Matplotlib figures
|
||||||
- LaTeX equations
|
- LaTeX equations (Block or inline)
|
||||||
- Named references for figures, tables and equation
|
- Named references for figures, tables and equation
|
||||||
|
|
||||||
### Key Features
|
### Key Features
|
||||||
|
@ -53,12 +53,21 @@ It is easy to use as the following example code shows:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import pyladoc
|
import pyladoc
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
doc = pyladoc.DocumentWriter()
|
doc = pyladoc.DocumentWriter()
|
||||||
|
|
||||||
doc.add_markdown("""
|
doc.add_markdown("""
|
||||||
# Example
|
# Example
|
||||||
This is an example. The @table:pandas_example shows some random data.
|
This is inline LaTeX: $$\\lambda$$
|
||||||
|
|
||||||
|
This is a LaTeX block with a number:
|
||||||
|
$$
|
||||||
|
\\label{eq:test1}
|
||||||
|
\\lambda_{\text{mix}} = \\sum_{i=1}^{n} \\frac{x_i \\lambda_i}{\\sum_{j=1}^{n} x_j \\Phi_{ij}}
|
||||||
|
$$
|
||||||
|
|
||||||
|
This is an example table. The table @table:pandas_example shows some random data.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
some_data = {
|
some_data = {
|
||||||
|
@ -67,9 +76,10 @@ some_data = {
|
||||||
'Row3': ['12 g/km', '> 150 g/km', '110 g/km']
|
'Row3': ['12 g/km', '> 150 g/km', '110 g/km']
|
||||||
}
|
}
|
||||||
df = pd.DataFrame(some_data)
|
df = pd.DataFrame(some_data)
|
||||||
dw.add_table(df, 'This is a pandas example table', 'pandas_example')
|
doc.add_table(df, 'This is a pandas example table', 'pandas_example')
|
||||||
|
|
||||||
html_code = doc.to_html()
|
html_code = doc.to_html()
|
||||||
|
print(html_code)
|
||||||
|
|
||||||
doc.to_pdf('test.pdf')
|
doc.to_pdf('test.pdf')
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue