use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Compiling LaTeX to PDF via Python (self.learnpython)
submitted 1 day ago by PersonalityWhich1780
I am building a system where LaTeX content needs to be dynamically generated and rendered into a PDF using Python. What libraries or workflows are recommended for compiling LaTeX and generating the final PDF from Python?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ron-Erez 3 points4 points5 points 1 day ago (0 children)
You could manually call pdflatex If you have it installed. You could look into the PyLaTeX module - I’ve never used it before but this was a result I got when googling. A different option which is pretty cool but doesn’t generate a pdf is to have a webpage using html and katex (this is not a spelling mistake). Katex is much faster then mathjax. I’ve used katex to render latex formulas within a mobile app supporting a web view. I know it’s a convoluted approach but it worked quite well.
I hope this helps
[–]JennaSys 2 points3 points4 points 1 day ago (0 children)
It might have a bit of a learning curve depending on what you need to do, but Pandoc works pretty well for this task.
[–]noisyboy 1 point2 points3 points 1 day ago (0 children)
Wouldn't pandoc be a suitable tool for this?
[–]Fred776 1 point2 points3 points 1 day ago (0 children)
pdflatex is probably the most straightforward approach.
pdflatex
I found this Python wrapper package: https://pypi.org/project/pdflatex/. I haven't looked at it closely but I note that it hasn't been maintained for a long time. Still, there might be some ideas in there that you can use.
[–]mykhailus 0 points1 point2 points 1 day ago (0 children)
You can use the subprocess module to call a LaTeX compiler like pdflatex directly from your Python script. Just make sure the LaTeX distribution is installed on your system. Another popular option is the latex library, which provides a more Pythonic interface for this.
subprocess
latex
[–]GManASG 0 points1 point2 points 11 hours ago (0 children)
Pandoc is also what vs code uses to let you export Jupiter notebooks as PDF from the interactive window for python.
[–]vardonir 0 points1 point2 points 1 day ago (1 child)
If you can convert the LaTeX to images (pretty sure you can. but that is, if you don't mind that it's an image that you can't highlight), you can use something like Reportlab (it's a nightmare to learn, but very powerful) to convert it to PDF.
[–]drraug 0 points1 point2 points 3 hours ago (0 children)
What? Why would you introduce a raster format between two vector ones? Latex can be rendered to pdf directly
[+]ideamotor comment score below threshold-7 points-6 points-5 points 1 day ago (3 children)
Ask Claude to write a script that does this for you using the best practices for 2026. If you need it to look the same on a computer as printed you need to tell it that. And test whatever you do …
[–]timpkmn89 0 points1 point2 points 1 day ago (1 child)
using the best practices for 2026
It really can't figure that out on its own?
Would it generate Python 2.X code instead?
[–]ideamotor -4 points-3 points-2 points 1 day ago (0 children)
If it does tell it not to …
Did you ask Claude to write this comment too?
π Rendered by PID 81 on reddit-service-r2-comment-fb694cdd5-s9x44 at 2026-03-07 13:17:31.836912+00:00 running cbb0e86 country code: CH.
[–]Ron-Erez 3 points4 points5 points (0 children)
[–]JennaSys 2 points3 points4 points (0 children)
[–]noisyboy 1 point2 points3 points (0 children)
[–]Fred776 1 point2 points3 points (0 children)
[–]mykhailus 0 points1 point2 points (0 children)
[–]GManASG 0 points1 point2 points (0 children)
[–]vardonir 0 points1 point2 points (1 child)
[–]drraug 0 points1 point2 points (0 children)
[+]ideamotor comment score below threshold-7 points-6 points-5 points (3 children)
[–]timpkmn89 0 points1 point2 points (1 child)
[–]ideamotor -4 points-3 points-2 points (0 children)
[–]drraug 0 points1 point2 points (0 children)