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

Layout improvements for etable, in particular for LaTex output #583

Merged
merged 33 commits into from
Aug 22, 2024

Conversation

dsliwka
Copy link
Contributor

@dsliwka dsliwka commented Aug 16, 2024

Changes to generate publication-ready LaTex Tables:

  • Use of MultiIndex for column heads
  • Allow custom model headlines
  • Allow custom table notes
  • Improved LaTex output

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@s3alfisc
Copy link
Member

s3alfisc commented Aug 16, 2024

Thank you Dirk (@dsliwka)! The examples look phenomenal. I'll review this over the weekend =)

On the testing error - I think it is obsolete now because we are now supporting "tex" with the "\n" command (this was not the case before).

        with pytest.raises(ValueError):
>           etable([fit1, fit2], coef_fmt="b (se)\nt [p]", type="tex")
E           Failed: DID NOT RAISE <class 'ValueError'>

@s3alfisc
Copy link
Member

Got the tex to run! Looks super nice:
image

pyfixest/report/summarize.py Show resolved Hide resolved
docs/latexdocs/SampleTableDoc.tex Outdated Show resolved Hide resolved
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 90.98361% with 11 lines in your changes missing coverage. Please review.

Files Patch % Lines
pyfixest/report/summarize.py 90.09% 11 Missing ⚠️
Files Coverage Δ
tests/test_errors.py 98.89% <ø> (+1.80%) ⬆️
tests/test_summarise.py 94.20% <100.00%> (-5.80%) ⬇️
pyfixest/report/summarize.py 93.70% <90.09%> (ø)

... and 26 files with indirect coverage changes

s3alfisc and others added 10 commits August 19, 2024 20:43
…bles in a separate latex file or in overleaf will likely not want to see the printed code in the notebook. Moreover, for quarto rendering it must apparently be printed in any case in the end of the code block. When print_tex=True then the rendered document will also show the latex code block in addition to the table).
@dsliwka
Copy link
Contributor Author

dsliwka commented Aug 21, 2024

Thanks for the feedback @s3alfisc! I have added the print_tex option & extended the documentation in the Stargazer notebook. Initially I had set the default option for print_tex=True but then realized that this may have unwanted side-effects. For instance, for pdf rendering to work in quarto the table must apparently be printed in the respective code chunk. When print_tex=True the pdf not only includes the table but also the latex code.

…ed some issues, I have taken this out of the notebook and instead refer to an added qmd file that gives as an eample for including tables in quarto.
@dsliwka
Copy link
Contributor Author

dsliwka commented Aug 21, 2024

I apologize @s3alfisc for the confusion I cause! Apparently the issue is caused by including a quarto example. I first had it in the Stargazer notebook. I had hoped to solve the issue by taking this out and just adding a sample qmd file and the resulting pdf. But apparently some code is running which tries to render the respective document to pdf and then misses a TeX installation. Is it possible to just keep the document as an example in the repository without having it automatically rendered? Otherwise I can of course simply erase it and take out the respective description in the Stargazer notebook.

@s3alfisc
Copy link
Member

Hi @dsliwka, no worries at all! Looks indeed like quartodoc by default runs the QuartoExample.qmd. I have now added a section to the github action to install tinytext and the docs now build properly! Do you want to try to include the quarto part into the stargazer.ipynb again? Either way, I think this is pretty close to being ready to be merged =)

@dsliwka
Copy link
Contributor Author

dsliwka commented Aug 22, 2024

Thanks @s3alfisc! I think it is perfectly fine to stick to the sample document.
When looking at the output again today I added two small features: the possibility to hide the fe and standard error type rows (this allows the user to describe both in the table notes when they are the same for all models) and the possibility to add further custom model information or statistics at the bottom of the table.

@s3alfisc
Copy link
Member

Hi Dirk, thank you! All of this looks outstanding, and I am more than happy to merge this later today. The etable() functionality and aesthetics have improved a lot, thank you so much!

@s3alfisc s3alfisc merged commit bf92748 into py-econometrics:master Aug 22, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants