From 60efb4a7da09ab7b60ff6651764f93bdee403e38 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 14 Apr 2025 00:44:30 +0200 Subject: [PATCH] readme updated --- README.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a61ce28..c6ce1b2 100644 --- a/README.md +++ b/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. ## 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') ```