readme updated

This commit is contained in:
Nicolas 2025-04-14 00:44:30 +02:00
parent 202d934d67
commit 60efb4a7da
1 changed files with 17 additions and 7 deletions

View File

@ -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.
## 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)
- PDF: [test_latex_render.pdf](https://raw.githubusercontent.com/Nonannet/pyladoc/refs/heads/main/tests/out/test_LaTeX_render.pdf)
- 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_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)
- Headings
- Tables (Pandas, Markdown or HTML)
- Matplotlib figures
- LaTeX equations
- LaTeX equations (Block or inline)
- Named references for figures, tables and equation
### Key Features
@ -53,12 +53,21 @@ It is easy to use as the following example code shows:
```python
import pyladoc
import pandas as pd
doc = pyladoc.DocumentWriter()
doc.add_markdown("""
# 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 = {
@ -67,9 +76,10 @@ some_data = {
'Row3': ['12 g/km', '> 150 g/km', '110 g/km']
}
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()
print(html_code)
doc.to_pdf('test.pdf')
```