{"id":32136812,"url":"https://github.com/bartp5/libtexprintf","last_synced_at":"2026-03-13T10:05:22.729Z","repository":{"id":43104718,"uuid":"510519360","full_name":"bartp5/libtexprintf","owner":"bartp5","description":"Library providing printf-style formatted output routines with tex-like syntax support. ","archived":false,"fork":false,"pushed_at":"2026-03-06T17:17:23.000Z","size":335,"stargazers_count":63,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-06T20:51:33.539Z","etag":null,"topics":["ascii-art","ascii-graphics","tex","unicode"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartp5.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-04T22:33:38.000Z","updated_at":"2026-03-02T20:53:24.000Z","dependencies_parsed_at":"2024-02-19T11:06:55.571Z","dependency_job_id":null,"html_url":"https://github.com/bartp5/libtexprintf","commit_stats":{"total_commits":44,"total_committers":3,"mean_commits":"14.666666666666666","dds":0.06818181818181823,"last_synced_commit":"77595060141ac1da3d146c62eed5fe3113811cc7"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/bartp5/libtexprintf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartp5%2Flibtexprintf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartp5%2Flibtexprintf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartp5%2Flibtexprintf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartp5%2Flibtexprintf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartp5","download_url":"https://codeload.github.com/bartp5/libtexprintf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartp5%2Flibtexprintf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30464988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T06:34:02.089Z","status":"ssl_error","status_checked_at":"2026-03-13T06:33:49.182Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ascii-art","ascii-graphics","tex","unicode"],"created_at":"2025-10-21T04:40:36.337Z","updated_at":"2026-03-13T10:05:22.690Z","avatar_url":"https://github.com/bartp5.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libtexprintf \u0026 utftex\n=====================\n[![CI](https://github.com/bartp5/libtexprintf/workflows/CI/badge.svg)](https://github.com/bartp5/libtexprintf/actions?query=workflow%3ACI)\n\nThe utftex program and underlying libtexprintf library provide tools to\npretty print math in mono-space fonts, using a tex-like syntax. It \nproduces UTF-8 encoded text. The program was inspired by \n[asciiTeX](http://asciitex.sourceforge.net/), and the improved \n[asciiTeX fork](https://github.com/larseggert/asciiTeX). However, \nutftex supports much more TeX syntax and contains extensive Unicode \ntables to map latex commands to Unicode symbols. Use \nlibtexprintf/utftex to unlock the math capabilities of Unicode in \nmono-space text applications.\n\nNote that how the equations look depends strongly on the font you use. \nNaturally, one needs a monospace font with good Unicode support for the \nsymbols you use. A good monospace font for math is, for example,  \n[JuliaMono](https://juliamono.netlify.app/).\n\nlibtexprintf\n------------\nThe core library to pretty print math in mono-space font. Use it to \nenable your c or c++ code to print out formatted math. The calls are \nmodeled after the printf family to produce formatted output.\n\nutftex\n------\nThe utftex program uses libtexprinf to implement a command-line utility \nto format math. For example:  \n\n    \u003e utftex '\\frac{\\alpha}{\\beta+x}'  \ngives\n \n     α   \n    ───  \n    β+x  \n\n\nThe texprintf library provides a fairly full featured tex-like syntax\nwith arrays, brackets, many symbols, and even font style (note that \ntexprintf outputs UTF-8 and as such cannot change the fonts. However,\nUnicode does provide several font-styles like mathematical calligraphic\nstyle, or italic). For example:\n\n    \u003e utftex -F mathnormal '\\frac{1}{a+x}' \ngives  \n\n     1\n    ───\n    𝑎+𝑥\n\nIt also supports some diacritical combining marks, to do things like\n\n    utftex '\\vec x' \nto get\n \n    x⃗.\n\nA bit more elaborate example is this small table of Laplace transforms:\n\n    \u003e utftex '\\begin{array}{|l|l|}  \n    \\hline  \n    f(t) \u0026 \\mathscr{L}[f(t)]=F(s) \\\\\\hline  \n    1 \u0026 \\frac{1}{s} \\\\\\hline  \n    e^{at}f(t) \u0026 F(s-a) \\\\\\hline  \n    \\delta\\left(t\\right) \u0026 1 \\\\\\hline  \n    \\delta\\left(t-t_0\\right) \u0026 e^{-st_0} \\\\\\hline  \n    \\int_0^t f(x)g(t-x)dx \u0026 F(s)G(s)\\hline  \n    \\end{array}'  \n\n    ┌────────────────┬──────────────┐ \n    │f(t)            │ 𝓛[f(t)]=F(s) │  \n    ├────────────────┼──────────────┤  \n    │                │ 1            │  \n    │1               │ ─            │  \n    │                │ s            │  \n    ├────────────────┼──────────────┤  \n    │ at             │              │  \n    │e  f(t)         │ F(s-a)       │  \n    ├────────────────┼──────────────┤  \n    │δ(t)            │ 1            │  \n    ├────────────────┼──────────────┤  \n    │                │  -st         │  \n    │                │     0        │  \n    │δ⎛t-t ⎞         │ e            │  \n    │ ⎝   0⎠         │              │  \n    ├────────────────┼──────────────┤  \n    │ t              │              │  \n    │⌠               │              │  \n    │⎮  f(x)g(t-x)dx │ F(s)G(s)     │  \n    │⌡               │              │  \n    │ 0              │              │  \n    └────────────────┴──────────────┘  \n\n\nNote that if the table borders do not properly align you are not viewing \nthe table in monospace fonts. \n\nutfstringinfo\n-------------\nUtility to analyze UTF-8 strings. The utfstringinfo  program reads \narguments or, if no arguments are provided, stdin and for every single \ncharacter it finds it shows  the  UTF-8  byte sequence, the Unicode \ncode-point and, if applicable, the utftex command that can be used to \ngenerate the symbol.  \n\nSoftware using libtexprintf/utftex\n----------------------------------\nSeveral projects use libtexprintf or utftex. Some projects that I am aware of are (in arbitrary order):\n\n* [LibTeXPrintf](https://github.com/JuliaStrings/LibTeXPrintf.jl): a \nwrapper around libtexprintf to use the library directly from the \njulia programming language\n* [kramdown-rfc](https://github.com/cabo/kramdown-rfc): (a backend for\n[kramdown](https://kramdown.gettalong.org/)) uses utftex to format \nlatex equations\n* [utftex-gui](https://github.com/wpeaton/utftex-gui/): a simple \ngraphical user interface to utftex (much like the gui that came with \nasciiTeX)\n* [utftexbot](https://github.com/LRDPRDX/utftexbot): a telegram bot to\npretty print LaTeX\n* [render-markdown.nvim](https://github.com/MeanderingProgrammer/render-markdown.nvim): \na markdown plugin for Neovim which can use utftex to format LaTeX \nequations\n* [euporie](https://euporie.readthedocs.io/en/stable/index.html): a \nterminal based interactive computing environment for Jupyter.\n\n\nNode.js binding to libtexprintf\n-------------------------------\n\nan npmjs package is available which links libtexprintf to Node.js. To install do\n\n```sh\nnpm install libtexprintf\n```\n\nUsage:\n---------------\nAfter installation\n\n```js\nimport { loadInstance, createRender } from \"libtexprintf\";\n\nconst instance = await loadInstance();\nconst render = createRender(instance);\nconsole.log(render(\"\\\\frac{\\\\alpha}{\\\\beta+x}\"));\n```\nFurther details can be found in the npmjs directory of this repository.\n\n\nQuestions One Might Ask (QOMA)\n------------------------------\n\n* Why is my equation all misaligned?\n\t- Make sure you are using mono-space fonts.\n\t\n* I am using mono-space fonts, why are my equations still poorly aligned?\n\t- Most fonts do not support all Unicode characters. Your program \n\t   may use some variable-width fallback fonts.\n\t   \n* Why are some symbols are not displayed (properly)?\n\t- Most fonts do not support all Unicode characters. Perhaps your \n\t   font engine just gave up? This also often happens when using \n\t   combining diacritical marks. Find the right set of font engine \n\t   and fonts to use.\n\t   \n* Can you recommend a good mono-space symbol font?\n\t- Best is if the monospace font you use supports lots of symbols by\n\t  itself. There are various fonts that support a great deal of \n\t  Unicode. See for example \n\t  [this discussion](https://stackoverflow.com/a/73313342/3662120).\n\t  As mentioned before I recommend \n\t  [JuliaMono](https://juliamono.netlify.app/).\n\t- Make your own out of your favorite (variable-space) fonts! The \n\t   great \"monospacifier\" will do that for you. Get it at \n\t   https://github.com/cpitclaudel/monospacifier\n\n* How do I specify the fallback fonts in \u003cinsert some program/system\u003e?\n\t- This will depend on your system and/or program you are using. If \n\t   your system uses fontconfig you may try that to set up an \n\t   appropriate mono-space fallback font.\n\n* How do I specify the fallback fonts in with fontconfig?\n\t- Let us assume you use some mono-space font called \"MONO\" and we \n\t   have some symbol mono-space fallback font for it \"SYMBOLMONO\". \n\t   Here are the steps:\n\t   1. Install all fonts (e.g. copy font files to \n\t      ~/.local/share/fonts and run \"fc-cache -f -v\")\n\t   2. Then create a fontconfig file in \n\t      ~/.config/fontconfig/fonts.conf\n\t      It could look something like (replace the font names with the \n\t      appropriate values):\n\t      \n```\n\u003c?xml version=\"1.0\"?\u003e\n\u003c!DOCTYPE fontconfig SYSTEM \"fonts.dtd\"\u003e\n\u003cfontconfig\u003e\n \u003calias\u003e\n   \u003cfamily\u003emonospace\u003c/family\u003e\n   \u003cprefer\u003e\n     \u003cfamily\u003eMONO\u003c/family\u003e\n     \u003cfamily\u003eSYMBOLMONO\u003c/family\u003e\n   \u003c/prefer\u003e\n \u003c/alias\u003e\n\u003c/fontconfig\u003e\t   \n```\t     \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartp5%2Flibtexprintf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartp5%2Flibtexprintf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartp5%2Flibtexprintf/lists"}