{"id":24746838,"url":"https://github.com/nilqed/latex2sixel","last_synced_at":"2025-10-10T16:30:44.502Z","repository":{"id":63193889,"uuid":"132351085","full_name":"nilqed/latex2sixel","owner":"nilqed","description":"LaTeX to SIXEL conversion ","archived":false,"fork":false,"pushed_at":"2025-01-04T11:37:46.000Z","size":402,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-04T12:37:37.985Z","etag":null,"topics":["computer-algebra-system","fricas","latex","maxima","pure","sixel","sixel-graphics"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilqed.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":"2018-05-06T15:23:25.000Z","updated_at":"2025-01-04T11:37:49.000Z","dependencies_parsed_at":"2022-11-14T17:33:45.416Z","dependency_job_id":null,"html_url":"https://github.com/nilqed/latex2sixel","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/nilqed%2Flatex2sixel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilqed%2Flatex2sixel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilqed%2Flatex2sixel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilqed%2Flatex2sixel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilqed","download_url":"https://codeload.github.com/nilqed/latex2sixel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235964787,"owners_count":19073478,"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":["computer-algebra-system","fricas","latex","maxima","pure","sixel","sixel-graphics"],"created_at":"2025-01-28T04:35:07.613Z","updated_at":"2025-10-10T16:30:44.495Z","avatar_url":"https://github.com/nilqed.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LaTeX to SIXEL\n\n[Sixel](https://en.wikipedia.org/wiki/Sixel) graphics is well suited to display images  on terminals (emulation) like [Mintty](https://mintty.github.io/) (Cygwin), [mlterm](http://mlterm.sourceforge.net/) or [Xterm](http://invisible-island.net/xterm/). Thanks to Hayaki Saito's [libsixel](http://saitoha.github.io/libsixel/), we can easily convert almost any format to sixel sequences (e.g. [img2sixel](http://saitoha.github.io/libsixel/#img2sixel)). \n\n![ltx1](img/ltx1.PNG)\n\n## latex2sixel\nThis simple shell script converts **(La)TeX** chunks to sixel output by the following composition of tools:\n\n![`latex [dvi] --\u003e dvipng [png] --\u003e img2sixel`](img/pipeline.png)\n\nTherefore, the requirements to render LaTex chunks to a sixel graphics capable console/terminal are as follows:\n\n* LaTeX distribution \n* dvipng (usually already included)\n* libsixel (see [Install](http://saitoha.github.io/libsixel/#install))\n* Sixel capable terminal\n\n### Usage\n\n```\nThis is latex2sixel V 1.0.2 (Mon Apr 11 15:59:19 CEST 2022)\n\nUsage: latex2sixel [OPTION]... TEXSTRING...\nOptions are chosen to be similar to dvips' options where possible:\n\n  -D #           Output resolution (default: 150 dpi)\n  -O c           Image offset (default: 1.4cm,0.8cm)\n  -T c           Image size (also accepts '-T bbox' and '-T tight')\n  -t             Remove margins (shorthand for '-T tight')\n  --preamble s   Add string 's' to the preamble before \\begin{document}\n\n  -bg s          Background color (TeX-style color or 'Transparent')\n  -fg s          Foreground color (TeX-style color)\n\n  # = number     s = string\n  c = comma-separated dimension pair (e.g., -1.2in,3.4cm)\n\n  TEXSTRING is a LaTeX expression betweeen apostrophes (not quotes).\n  Examples: '$\\alpha$' | '\\LaTeX' | 'This is math: $x+y$'.\n\nRequired applications: latex, dvipng, img2sixel.\nTerminals supporting sixel graphics: xterm -ti vt340, mintty, mlterm.\nMore info @  https://github.com/saitoha/libsixel\n```\n\nThe script is just a skeleton and may be adjusted to your needs. \n\n#### Installation\nJust copy the file(s) in the `script` directory to a folder in the path,\ne.g. `/usr/local/bin` or `.local/bin`.\n\n\n#### TeX-Live (`openout_any=p` issue)\n \n * Edit the file `/usr/share/texlive/texmf-dist/web2c/texmf.cnf` (sudo)\n * Search for openout_any=p (p for paranoid mode)\n * Replace by openout_any=r (restricted)  or openout_any=a (means always).\n\n\n#### Examples\n```\nlatex2sixel '$-\\frac{\\hbar^2}{2m}\\,\\Delta\\psi+V\\,\\psi=E\\,\\psi$'\nlatex2sixel \\\\partial{T}\\(\\\\phi\\)=T\\(d\\\\phi\\)\nlatex2sixel '$$\\int_{\\partial\\Omega}\\omega=\\int_\\Omega\\,d\\omega$$'\nlatex2sixel '\\LaTeX\\ is\\ cool :)'\n\nlatex2sixel '$$\\sum_{j=0}^N q^j=\\frac{q^{N+1}-1}{q-1}$$'\nlatex2sixel '$$\\forall x\\in\\mathbb{Z},\\exists y\\in\\mathbb{Z}:x+y=0$$'\n```\n\n![mintty](img/mintty.PNG)\n\nMore complicated latex fragments can be stored in a file and passed to\nlatex2sixel as stdin. (Example: [protocol.ltx](samples/protocol.ltx).)\n\n```bash\necho '\\Large\\LaTeX' | latex2sixel\nlatex2sixel \u003c protocol.ltx\nlatex2sixel '\\Large' \u003c protocol.ltx\nlatex2sixel -fg Dandelion '\\LARGE' \u003c protocol.ltx\n```\n\n![output of protocol.ltx in an xterm ](img/xterm.png)\n\n#### Tips\n\n* Every argument is a separate latex line\n  ```\n  latex2sixel  'Hello % comment to the end of the line'  'world!'\n  ```\n\n* Put `\\usepackage{foo}` in a separate argument\n\n  ``` bash\n  latex2sixel '\\usepackage{bm}' '$\\bm{\\mathsf{A}}\\bm x = \\bm b$'\n  ```\n\n* Colors within equations can be controlled using `\\mathcolor{}` \n\n  ``` bash\n  latex2sixel '\\Huge${\\mathcolor{Mulberry}\\wp}_\\alpha$'\n  ```\n\n* The -D / --resolution setting can be used for quick zooming\n\n  ```bash\n  latex2sixel -D 300 -t \u003c\u003c-EOF\n\t\\def\\bars#1{\\hbox to #1{\\vrule width0pt height 1mm depth 2mm%\n\t\t\\vrule\\morebars\\morebars}}\n\t\\def\\morebars{\\hfil\\vrule\\hfil\\vrule\\hfil\\vrule\\hfil\\vrule\\hfil\\vrule}\n\t\\def\\ruler#1{\\vbox{\\bars{#1}\\hrule}}\n\t\\ruler{10in}\n\tEach mark is one inch\n  EOF\n  ```\n\n* More examples are in the [samples](samples/) directory\n\n  ```bash\n  latex2sixel \u003c samples/hdotsfor.ltx\n  ```\n  In particular, see [ltx0.txt](samples/ltx0.txt) for a range of\n  useful and interesting tidbits.\n\n  ```bash\n  cd samples\n  sh ltx0.txt\n  ```\n\n\n## Applications\n\nA lot of mathematical software is able to produce **TeX** output, e.g. computer algebra systems ([CAS](https://en.wikipedia.org/wiki/Computer_algebra_system)) like FriCAS (Axiom), Maxima, Reduce, Sage, Sympy and a lot more. Many OO languages like Python or Pure have the capability to render the objects by a special representation field.  \nCertain applications, however, need a special treatment, that is for instance a preamble or macro definitions which should be prepended to the input. The script `fricas2sixel` is such an example. When we define the function\n```\nsixel(x:TexFormat):Void ==\n  cmd:=concat [\"system fricas2sixel -bg Black -D 150 -fg Orange '\",tex(x).1,\"'\"]\n  systemCommand(cmd)\n```\nwe can render almost any expression as its LaTex representation in the console:\n\n![sixel-fricas](img/fricas1.PNG)\n\nThe function can be included into the startup file (`.fricas.input`), then the usage is: `sixel expression`.\n\n![fricas-xterm](img/Selection_004.png)\n\nAnother example is [Pure](https://agraef.github.io/pure-lang/):\n\n![pure](img/pure_sixel.png)\n\nFor details consult the sample file `sixel.pure` in the `sample`folder.\n\n## GnuPlot\n[GnuPlot](http://gnuplot.info/) is a portable command-line driven graphing utility for \nLinux, OS/2, MS Windows, OSX, VMS, and many other platforms. It can produce **sixel**\noutput. It also provides an easy mean to check if your terminal is capable to display\nsixel output: `gnuplot\u003e test`\n\n![gp1](img/gp1.PNG)\n\n![gp2](img/gp2.PNG)\n\n![gp3](img/gp3.PNG)\n\n![gp4](img/gp4.PNG)\n\n![gp0](img/gnuplot_test.PNG)\n\n#### Calibration\n\n![gp5](img/calibrate.PNG)\n\n![gp6](img/2.PNG)\n\n---\n\n![p7](img/l2x.PNG)\n\n![p8](img/l2x2.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilqed%2Flatex2sixel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilqed%2Flatex2sixel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilqed%2Flatex2sixel/lists"}