Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow rendering of tables to LaTeX #481

Merged
merged 198 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
6c1d6b2
Get components in place for LaTeX rendering
rich-iannone Oct 1, 2024
07fc311
Merge branch 'main' into feat-latex-rendering
rich-iannone Oct 1, 2024
f16e9c5
Add two `latex*` options in `tab_options()`
rich-iannone Oct 2, 2024
53477b5
Add the `check_quarto()` util function
rich-iannone Oct 2, 2024
9344487
Define logic in `create_wrap_start_l()`
rich-iannone Oct 2, 2024
84f40c5
Add WIP LaTeX table component building fns
rich-iannone Oct 2, 2024
5af2702
Create test_utils_render_latex.py
rich-iannone Oct 2, 2024
a0b1b8f
Tweak logic of performing length conversions
rich-iannone Oct 2, 2024
b34f7ce
Add WidthDict class to store LaTeX colwidth data
rich-iannone Oct 2, 2024
c22a9b2
Modify names dealing with colwidth metadata
rich-iannone Oct 2, 2024
3dd29bf
Use WidthDict class within util fn
rich-iannone Oct 2, 2024
59c070f
Add untranslated code as commented code
rich-iannone Oct 2, 2024
dbf4951
Make corrections to fn and arg names
rich-iannone Oct 2, 2024
1a81ae1
Add several unit tests
rich-iannone Oct 2, 2024
d185604
Remove print statement
rich-iannone Oct 2, 2024
4296be9
Add logic to derive_table_width_statement_l()
rich-iannone Oct 2, 2024
a19dc8f
Update LENGTH_TRANSLATIONS_TO_PX dict with px val
rich-iannone Oct 3, 2024
ad0c45f
Add util functions for LaTeX rendering
rich-iannone Oct 3, 2024
941b72c
Add logic for `create_fontsize_statement_l()`
rich-iannone Oct 3, 2024
60edef5
Add several tests
rich-iannone Oct 3, 2024
0da0746
Merge branch 'main' into feat-latex-rendering
rich-iannone Oct 3, 2024
1bb1da5
Add logic for `create_columns_component_l()`
rich-iannone Oct 3, 2024
b54e528
Update .gitignore
rich-iannone Oct 15, 2024
a094fb8
Update .gitignore
rich-iannone Oct 15, 2024
d8d5e8f
Add to imports for LaTeX rendering
rich-iannone Oct 15, 2024
856e636
Remove unneeded code
rich-iannone Oct 15, 2024
69e7d6e
Remove terminating newline from heading row stmt
rich-iannone Oct 15, 2024
831299f
Make correction to dict comprehension
rich-iannone Oct 15, 2024
4f25112
Remove terminating newline from table start stmt
rich-iannone Oct 15, 2024
63fdd63
Use pass instead of returning "" for a caption
rich-iannone Oct 15, 2024
5b27b35
Add logic for creating a LaTeX table heading
rich-iannone Oct 15, 2024
7a1040c
Add logic for creating a LaTeX table body
rich-iannone Oct 15, 2024
acf6e87
Add logic for creating a LaTeX table footer
rich-iannone Oct 15, 2024
43345cf
Remove unnecessary newlines
rich-iannone Oct 15, 2024
07ce01f
Remove unnecessary newlines in tbl start stmt
rich-iannone Oct 15, 2024
26e477f
Remove all newlines in wrap_end stmt
rich-iannone Oct 15, 2024
e7f07c3
Raise NotImplemented if using a stub or row groups
rich-iannone Oct 15, 2024
cc8c858
Remove stmt that creates a caption component
rich-iannone Oct 15, 2024
08b6c78
Obtain the 'use_longtable' option
rich-iannone Oct 15, 2024
f5875e4
Remove redundant variable from 'finalized_table'
rich-iannone Oct 15, 2024
269825c
Remove 'caption_component' from built LaTeX table
rich-iannone Oct 15, 2024
350cb9d
Make corrections to two LaTeX test cases
rich-iannone Oct 15, 2024
33c987e
Replace non-functional statements with TODOs
rich-iannone Oct 16, 2024
204f8ef
Merge branch 'main' into feat-latex-rendering
rich-iannone Oct 16, 2024
ad35bdf
Add the `escape_latex()` util function
rich-iannone Oct 16, 2024
ef88710
Add basic tests for `escape_latex()`
rich-iannone Oct 16, 2024
927e4ac
Add the `_context_minus_mark()` util fn
rich-iannone Oct 16, 2024
dd92e10
Add the `_context_percent_mark()` util fn
rich-iannone Oct 16, 2024
09215b6
Add the `_context_dollar_mark()` util fn
rich-iannone Oct 16, 2024
4738acb
Remove temporary version of `_context_minus_mark()`
rich-iannone Oct 16, 2024
fd228a6
Create temp copies of fmt fns for html/latex contexts
rich-iannone Oct 16, 2024
6270957
Apply `escape_latex()` to column labels
rich-iannone Oct 16, 2024
fa596c8
Make correction to erroneous context mark
rich-iannone Oct 16, 2024
b5fb89b
Define more contexts in `_context_exp_marks()`
rich-iannone Oct 16, 2024
33c72a7
Add to imports list
rich-iannone Oct 16, 2024
65a2826
Use context-aware functions for many fmt methods
rich-iannone Oct 16, 2024
6343d98
Replace body of function with 'pass'
rich-iannone Oct 16, 2024
823fdfc
Redefine function signature
rich-iannone Oct 16, 2024
695490d
Remove unneeded variable
rich-iannone Oct 16, 2024
27c1a32
Remove unused code from LaTeX column building
rich-iannone Oct 16, 2024
9811079
Comment unused code
rich-iannone Oct 16, 2024
8f4f490
Add GroupRowInfo to imports list
rich-iannone Oct 16, 2024
f6800b9
Remove type of Any for `cell_content`
rich-iannone Oct 16, 2024
82328f6
Add LaTeX examples page to docs site
rich-iannone Oct 16, 2024
ff8051c
Add LaTeX examples page to top navbar
rich-iannone Oct 16, 2024
82433a2
Move LaTeX examples to lower alphanumeric dir name
rich-iannone Oct 16, 2024
f34f2b1
Ensure that tinytex is installed after quarto install
rich-iannone Oct 16, 2024
0dd0109
Pull table_width from width_dict
rich-iannone Oct 16, 2024
7606069
Update LaTeX examples .qmd file
rich-iannone Oct 16, 2024
30625c4
Update LaTeX examples .qmd file
rich-iannone Oct 16, 2024
8385bd9
Add TODO for UnitStr conversion to LaTeX
rich-iannone Oct 16, 2024
0061441
Enlarge scope of `process_text()` to multiple contexts
rich-iannone Oct 17, 2024
874e792
Implement spanners logic in LaTeX tables
rich-iannone Oct 17, 2024
f9f1a8a
Update LaTeX examples .qmd file
rich-iannone Oct 17, 2024
6835cd5
Move away from f-string when not necessary
rich-iannone Oct 17, 2024
74ea075
Simplify example with spanner label
rich-iannone Oct 17, 2024
1caf472
Make corrections to spanner formatting in LaTeX
rich-iannone Oct 17, 2024
703fa37
Update LaTeX examples in .qmd file
rich-iannone Oct 17, 2024
ad0c4f5
Add tests for creating LaTeX table heading
rich-iannone Oct 17, 2024
98fed5c
Raise NotImplementedError for md-to-latex conversion
rich-iannone Oct 17, 2024
7697bd3
Raise NotImplementedError for using units w/ LaTeX
rich-iannone Oct 17, 2024
934a6dc
Remove certain TODOs and commented code
rich-iannone Oct 17, 2024
e99b512
Add several tests for spanners in LaTeX outputs
rich-iannone Oct 17, 2024
5913f3b
Add complicated test of spanners in LaTeX render
rich-iannone Oct 17, 2024
53cf254
Add several tests for formatting in LaTeX
rich-iannone Oct 17, 2024
3b86a57
Add several tests for formatting in LaTeX
rich-iannone Oct 18, 2024
7fb7fb9
Add fn to selectively escape for LaTeX (for pattern str)
rich-iannone Oct 18, 2024
5809987
Add tests for `escape_pattern_str_latex()`
rich-iannone Oct 18, 2024
b162aee
Add test for `escape_pattern_str_latex()`
rich-iannone Oct 18, 2024
d936f5e
Perform LaTeX-escaping of pattern in several fmt methods
rich-iannone Oct 18, 2024
07b39d4
Use context-aware fns for more fmt methods
rich-iannone Oct 18, 2024
a8c0c8d
Add example to LaTeX .qmd file
rich-iannone Oct 18, 2024
0785401
Make correction to LaTeX examples .qmd file
rich-iannone Oct 18, 2024
a70890e
Move `process_string()` fn to `_utils.py`
rich-iannone Oct 18, 2024
97a7096
Add docstring for the `process_string()` util fn
rich-iannone Oct 18, 2024
cbf0929
Add docstrings for several LaTeX-rendering fns
rich-iannone Oct 18, 2024
9235d97
Add tests for creation of LaTeX table footer
rich-iannone Oct 18, 2024
2f132c8
Add DataFrame fixture for datetime formatting
rich-iannone Oct 18, 2024
baccce1
Add tests for date and time formatting in LaTeX
rich-iannone Oct 18, 2024
4a21981
Add test for datetime formatting in LaTeX
rich-iannone Oct 18, 2024
3d9b486
Add the `_latex_escape()` util fn
rich-iannone Oct 19, 2024
ffc1889
Use `_latex_escape()` within `_process_text()`
rich-iannone Oct 19, 2024
c5ccc34
Add the `_get_visible_cells()` util fn
rich-iannone Oct 19, 2024
a545adb
Add `migrate_unformatted_to_output()` util fn
rich-iannone Oct 19, 2024
0c77a50
Add to imports list
rich-iannone Oct 19, 2024
76c0298
When building LaTeX table, process unformatted text
rich-iannone Oct 19, 2024
61719be
Use `_process_text()` when rendering LaTeX
rich-iannone Oct 19, 2024
363e13c
Create test_text.py
rich-iannone Oct 19, 2024
7872b37
Remove unneeded tests
rich-iannone Oct 19, 2024
649aa73
Ensure source notes are processed for LaTeX
rich-iannone Oct 19, 2024
a99a3d6
Ensure context is set in `_process_text()` call
rich-iannone Oct 19, 2024
7cdd8da
Modify text in comments
rich-iannone Oct 19, 2024
f38f9cd
Reorganize LaTeX escaping functions and tests
rich-iannone Oct 20, 2024
6a6d38f
Make correction to import statement
rich-iannone Oct 21, 2024
6a738e8
Move _render_as_latex() out of gt.py
rich-iannone Oct 21, 2024
638980e
Add docstring
rich-iannone Oct 21, 2024
1778949
Use variable instead of hardcoded value
rich-iannone Oct 21, 2024
68416b0
Remove unneeded import
rich-iannone Oct 21, 2024
640933a
Modify docstring of `as_latex()`
rich-iannone Oct 21, 2024
f35ffc7
Ensure that title/subtitle undergo text processing
rich-iannone Oct 21, 2024
2b1f868
Remove unneeded comment
rich-iannone Oct 21, 2024
b1284b1
Create and use methods of Text/Md/Html
rich-iannone Oct 21, 2024
1b83c6a
Update index.qmd
rich-iannone Oct 21, 2024
e401793
Add tests for generation of tbl fontsize stmt
rich-iannone Oct 21, 2024
50a8c4e
Add tests for deriving tbl width stmts
rich-iannone Oct 21, 2024
73616ea
Add test for creation of tbl fontsize stmt
rich-iannone Oct 21, 2024
c18e851
Add test for LaTeX tbl width statement
rich-iannone Oct 21, 2024
562d4b2
Change main arg of `_render_as_latex()`
rich-iannone Oct 21, 2024
9cc10f5
Add TODOs to LaTeX body component fn
rich-iannone Oct 21, 2024
ac0d002
Add tests for `create_table_end_l()`
rich-iannone Oct 21, 2024
6cc139d
Add snapshot test using `as_latex()`
rich-iannone Oct 21, 2024
027f76f
Add snapshot test for `_render_as_latex()`
rich-iannone Oct 22, 2024
3bd3d56
Modify function call
rich-iannone Oct 22, 2024
40da213
Add tests for Text, Md, Html class methods
rich-iannone Oct 22, 2024
4fb78cf
Add tests for `_process_text()`
rich-iannone Oct 22, 2024
145dd49
Add more tests with text processing
rich-iannone Oct 22, 2024
9b0d8bc
Add an `as_latex()` snapshot test
rich-iannone Oct 22, 2024
81ab03e
Add more tests for `utils_render_latex.py`
rich-iannone Oct 22, 2024
774e6bb
Add test of `UnitStr.to_latex()`
rich-iannone Oct 22, 2024
744442e
Add more LaTeX fmt tests; check pattern is escaped
rich-iannone Oct 22, 2024
3868099
Add more complete documentation to `as_latex()`
rich-iannone Oct 23, 2024
8030fa5
Add `as_latex()` to the API reference guide
rich-iannone Oct 23, 2024
d0a40f1
Add to the `as_latex()` limitations docs
rich-iannone Oct 23, 2024
8aea9e5
Update docs of `as_latex()` method
rich-iannone Oct 23, 2024
f80b424
Remove duplicated test
rich-iannone Oct 23, 2024
fa7294f
Add test of `fmt_bytes()` in LaTeX output table
rich-iannone Oct 23, 2024
855c146
Add to docs of the `as_latex()` method
rich-iannone Oct 23, 2024
24612e4
Remove unused import
rich-iannone Oct 28, 2024
6aa16c4
Make `_migrate_unformatted_to_output()` a fn
rich-iannone Oct 28, 2024
94e1340
Make fn name more descriptive
rich-iannone Oct 28, 2024
574f830
Remove unused code
rich-iannone Oct 28, 2024
ecc67e3
Improve documentation of `process_string()`
rich-iannone Oct 28, 2024
3ed25d2
Further tweak docstring of `process_string()`
rich-iannone Oct 28, 2024
29fe6d9
Add more tests of CSS length strings
rich-iannone Oct 28, 2024
a5fac64
Add tests that verify stub/group rendering raises
rich-iannone Oct 28, 2024
e9e5654
Add snapshot test of floating LaTeX table
rich-iannone Oct 28, 2024
ac9579c
Remove unneeded statement
rich-iannone Oct 28, 2024
ba4bc57
Remove two unneeded statements
rich-iannone Oct 28, 2024
f5e3735
Remove several unneeded statements
rich-iannone Oct 28, 2024
e033444
Add tests for `create_table_start_l()` util fn
rich-iannone Oct 28, 2024
e533a3d
Remove unneeded statement
rich-iannone Oct 28, 2024
9d53991
Remove unused `width_dict` arg from LaTeX fns
rich-iannone Oct 28, 2024
0ab2f60
Allow for partial[FormatFn] type in FormatFns
rich-iannone Oct 28, 2024
9ec690f
Refactor formatters to use a double-`partial()`
rich-iannone Oct 28, 2024
f46c6a8
Refactor formatting with `fmt_by_context()` wrapper
rich-iannone Oct 28, 2024
0893bde
Exit early from `_migrate_...()` fn if not LaTeX output
rich-iannone Oct 29, 2024
33eb4bc
Move longtable/pos opts to args in LaTeX render fn
rich-iannone Oct 29, 2024
bb79eb3
Include type annotations for `_migrate_...()`
rich-iannone Oct 29, 2024
290100d
Create BaseText class and methods
rich-iannone Oct 30, 2024
9bef202
Add tests for BaseText class
rich-iannone Oct 30, 2024
8a322f1
Ignore type in test that raises
rich-iannone Oct 30, 2024
329af1b
Use specific types in WidthDict
rich-iannone Oct 30, 2024
496c0cc
Add TblWidthLatex class for making a tbl width str
rich-iannone Oct 30, 2024
d1c299a
Remove WidthDict as not used currently
rich-iannone Oct 30, 2024
a9511c6
Use BaseText type annotation in SpannerInfo
rich-iannone Oct 30, 2024
cd0575e
Use BaseText in `tab_spanner()` method
rich-iannone Oct 30, 2024
95673c5
Add docstring for BaseText
rich-iannone Oct 30, 2024
4e16b24
Add to LaTeX examples .qmd file
rich-iannone Oct 30, 2024
68cd527
Remove unneeded TblWidthLatex class
rich-iannone Oct 30, 2024
dfb5ba2
Remove unneeded imports
rich-iannone Oct 30, 2024
fdbc248
Add more tests of `create_table_start_l()`
rich-iannone Oct 30, 2024
306b880
Modify ValueError text
rich-iannone Oct 30, 2024
55e5b8f
Add tests of `_migrate_unformatted_to_output()`
rich-iannone Oct 30, 2024
647ae17
Update example LaTeX .qmd file
rich-iannone Oct 30, 2024
df93456
Make correction to Polars code
rich-iannone Oct 31, 2024
5b9cb57
Add docstring to `is_quarto_render()`
rich-iannone Oct 31, 2024
d923076
Clean up implementation of Text classes
rich-iannone Nov 1, 2024
6236f6c
Hide LaTeX examples from top nav
rich-iannone Nov 1, 2024
379be82
Make changes based on code review
rich-iannone Nov 4, 2024
97acbe4
Update .gitignore
rich-iannone Nov 4, 2024
b74b361
Raise when using `fmt_markdown()` in LaTeX context
rich-iannone Nov 4, 2024
35f7e88
Correct string used in error message
rich-iannone Nov 4, 2024
dfe43e2
Make fmt_image() raise NotImplemented for LaTeX
rich-iannone Nov 4, 2024
aefcae2
Only warn when using fmt_image() in LaTeX output
rich-iannone Nov 4, 2024
b1b2b64
Remove fmt_image_not_implemented()
rich-iannone Nov 4, 2024
a50e9ff
Update docstring for as_latex()
rich-iannone Nov 4, 2024
923d8c9
Add more LaTeX examples to existing .qmd file
rich-iannone Nov 4, 2024
c2f7c81
Fix paths to data files in LaTeX .qmd examples
rich-iannone Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
run: |
python -m pip install ".[all]"
- uses: quarto-dev/quarto-actions/setup@v2
with:
tinytex: true
- name: Build docs
run: |
make docs-build
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ docs/source/generated/
docs/source/reference/

# Playground Scripts and temporary outputs
.DS_Store
playground*.py
playground*.qmd
playground.html
playground_files
manual-testing.py
manual-testing.ipynb
.DS_Store
latex_testing.qmd
latex_testing.pdf
latex_examples.qmd
latex_examples.pdf
1 change: 1 addition & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ quartodoc:
- GT.save
- GT.show
- GT.as_raw_html
- GT.as_latex
- title: Value formatting functions
desc: >
If you have single values (or lists of them) in need of formatting, we have a set of
Expand Down
Loading
Loading