{"id":17308947,"url":"https://github.com/pgrit/texsnip","last_synced_at":"2025-04-14T13:51:24.990Z","repository":{"id":57474654,"uuid":"301201021","full_name":"pgrit/texsnip","owner":"pgrit","description":"Compile \u0026 crop LaTeX to .pdf / .png / .pptx from Python","archived":false,"fork":false,"pushed_at":"2024-01-18T09:17:50.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T02:53:17.404Z","etag":null,"topics":["latex","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgrit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-04T18:41:00.000Z","updated_at":"2024-02-01T08:48:04.000Z","dependencies_parsed_at":"2023-01-21T16:45:50.150Z","dependency_job_id":null,"html_url":"https://github.com/pgrit/texsnip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2Ftexsnip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2Ftexsnip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2Ftexsnip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2Ftexsnip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgrit","download_url":"https://codeload.github.com/pgrit/texsnip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248891029,"owners_count":21178546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["latex","python"],"created_at":"2024-10-15T12:07:20.329Z","updated_at":"2025-04-14T13:51:24.964Z","avatar_url":"https://github.com/pgrit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TeXSnip\n\nA small single-module Python package to generate LaTeX text and equations for your favorite vector graphics tool, with no dependencies required! Except LaTeX, of course.\n\nTo get started, simply run:\n```\npip install texsnip\n```\n\nWith a few lines of Python code, you can create .pdf files that you can then drag'n'drop into Inkscape, Illustrator, Corel Draw, or most other vector graphics programms.\n\n\n```python\nfrom texsnip import Snip\n\n# Here, you can modify the LaTeX preamble, for example to configure fonts.\n# We use the 'libertine' package, the fonts for the current ACM SIGGRAPH template.\npreamble = r\"\\usepackage{libertine}\"\n\n# Write the rendering equation to a file called 'rendering-equation.pdf'\nSnip(\"rendering-equation\", 8,\n    r\"$L_o = L_e + \\int_\\Omega L_i f \\cos\\theta_i \\,\\mathrm{d}\\omega_i$\"\n).generate(preamble)\n```\n\nIf .pdfs are not supported, don't worry: the script allows you to easily create .png files as well.\n\n```python\nSnip(\"rendering-equation\", 8,\n    r\"$L_o = L_e + \\int_\\Omega L_i f \\cos\\theta_i \\,\\mathrm{d}\\omega_i$\"\n).generate_png(preamble)\n```\n\nIf you are using these in presentation slides, you can assemble a list of Snips in a .pptx file (uses .png conversion)\n\n```python\nfrom texsnip import Snip, pptx_snips\n\n# Here, you can modify the LaTeX preamble, for example to configure fonts.\n# We use the 'libertine' package, the fonts for the current ACM SIGGRAPH template.\npreamble = r\"\\usepackage{libertine}\"\n\nsnips = [\n    # Write the rendering equation to a file called 'rendering-equation.pdf'\n    Snip(\"rendering-equation\", 14,\n        r\"$L_o = L_e + \\int_\\Omega L_i f \\cos\\theta_i \\,\\mathrm{d}\\omega_i$\"\n    ),\n\n    # Sometimes, you need individual terms\n    Snip(\"omega_i\", 14,\n        r\"$\\omega_i$\"\n    ),\n\n    # Or you might want captions for your illustrations with LaTeX typesetting\n    Snip(\"a-caption\", 14,\n        r\"\\textsf{a) Some \\textcolor[RGB]{200,110,5}{cool} illustration}\"\n    )\n]\n\n# Lets create a snips.pptx with all these snips in it\n# This will also create the corresponding .pdf and .png files for use in other applications\npptx_snips(snips, preamble=preamble)\n```\n\n\n## Dependencies\n\n* Python \u003e= 3.6\n* LaTeX with pdfcrop (requires Perl) and xcolor, graphicx, inputenc, fontenc\n\nTo generate .png images, you will additionally need:\n```\npip install pdf2image\n```\nwhich requires Poppler to be installed and in the path.\n\nTo generate .pptx files, you will need the .png dependencies and also:\n```\npip install python-pptx PyPDF2\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgrit%2Ftexsnip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgrit%2Ftexsnip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgrit%2Ftexsnip/lists"}