{"id":16642033,"url":"https://github.com/make-github-pseudonymous-again/texshake","last_synced_at":"2026-05-16T08:31:52.180Z","repository":{"id":53590406,"uuid":"115711911","full_name":"make-github-pseudonymous-again/texshake","owner":"make-github-pseudonymous-again","description":":leaves: Shake your LaTeX syntax tree!","archived":false,"fork":false,"pushed_at":"2021-03-22T18:54:44.000Z","size":1520,"stargazers_count":1,"open_issues_count":16,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-08T11:27:11.356Z","etag":null,"topics":["abstract-syntax-tree","agpl","javascript","latex","parser","tree-shaking"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/make-github-pseudonymous-again.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":"2017-12-29T10:12:21.000Z","updated_at":"2021-12-20T23:41:06.000Z","dependencies_parsed_at":"2022-09-11T09:10:53.483Z","dependency_job_id":null,"html_url":"https://github.com/make-github-pseudonymous-again/texshake","commit_stats":null,"previous_names":["aureooms/texshake"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/make-github-pseudonymous-again/texshake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-github-pseudonymous-again%2Ftexshake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-github-pseudonymous-again%2Ftexshake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-github-pseudonymous-again%2Ftexshake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-github-pseudonymous-again%2Ftexshake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/make-github-pseudonymous-again","download_url":"https://codeload.github.com/make-github-pseudonymous-again/texshake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/make-github-pseudonymous-again%2Ftexshake/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269518563,"owners_count":24430635,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["abstract-syntax-tree","agpl","javascript","latex","parser","tree-shaking"],"created_at":"2024-10-12T07:48:40.895Z","updated_at":"2026-05-16T08:31:52.106Z","avatar_url":"https://github.com/make-github-pseudonymous-again.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":":leaves: texshake\n==\n\n\u003e Shake your LaTeX syntax tree!\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://scribblesinstitute.com/drawing-lesson-tree\"\u003e\n\u003cimg src=\"https://ipfs.io/ipfs/QmdosfjJmHtiWtSTVtQcKQp1bWj5hn5JCDuYD2P2spMTZE\" width=\"600\"\u003e\n\u003c/a\u003e\u003cbr/\u003e\n© \u003ca href=\"https://scribblesinstitute.com\"\u003eThe Scribbles Institute\u003c/a\u003e\n\u003c/p\u003e\n\n```shell\n$ echo '\\\\newif\\\\ifah\\\\ahtrue\\\\ifah Shake it! :) \\\\else Do not shake it... :( \\\\fi' | texshake\n Shake it! :)\n```\n\n[![License](https://img.shields.io/github/license/aureooms/texshake.svg)](https://raw.githubusercontent.com/aureooms/texshake/main/LICENSE)\n[![Version](https://img.shields.io/npm/v/texshake.svg)](https://www.npmjs.org/package/texshake)\n[![Build](https://img.shields.io/travis/aureooms/texshake/main.svg)](https://travis-ci.org/aureooms/texshake/branches)\n[![Dependencies](https://img.shields.io/david/aureooms/texshake.svg)](https://david-dm.org/aureooms/texshake)\n[![Dev dependencies](https://img.shields.io/david/dev/aureooms/texshake.svg)](https://david-dm.org/aureooms/texshake?type=dev)\n[![GitHub issues](https://img.shields.io/github/issues/aureooms/texshake.svg)](https://github.com/aureooms/texshake/issues)\n[![Downloads](https://img.shields.io/npm/dm/texshake.svg)](https://www.npmjs.org/package/texshake)\n\n[![Code issues](https://img.shields.io/codeclimate/issues/aureooms/texshake.svg)](https://codeclimate.com/github/aureooms/texshake/issues)\n[![Code maintainability](https://img.shields.io/codeclimate/maintainability/github/aureooms/texshake.svg)](https://codeclimate.com/github/aureooms/texshake/trends/churn)\n[![Code coverage (cov)](https://img.shields.io/codecov/c/github/aureooms/texshake.svg)](https://codecov.io/gh/aureooms/texshake)\n[![Code coverage (clim)](https://img.shields.io/codeclimate/coverage-letter/aureooms/texshake.svg)](https://codeclimate.com/github/aureooms/texshake/trends/test_coverage_new_code)\n[![Code technical debt](https://img.shields.io/codeclimate/tech-debt/aureooms/texshake.svg)](https://codeclimate.com/github/aureooms/texshake/trends/technical_debt)\n\u003c!--[![Documentation](https://aureooms.github.io/texshake/badge.svg)](https://aureooms.github.io/texshake/source.html)--\u003e\n\n\n## Install it\n\n```shell\n$ npm i -g texshake\n```\n\n\n## Shake away\n\n```shell\n$ texshake \u003c 'my-awesome-latex-file-before.tex' \u003e 'my-awesome-latex-file-after.tex'\n```\n\n\n##  Shake what?\n\n### `\\if...` `\\else` `\\fi` conditionals\n\nPrunes dead branches for `\\iftrue`'s, `\\iffalse`'s, and user-defined `\\if...` variables.\n\n\u003e `\\abctrue\\ifabc ah\\else oh\\fi` ~ ` ah`\n\n### `%` comments\n\nOnly keeps the first `%` character of each comment.\n\n\u003e `hello, world % Lorem ipsum dolor sit amet` ~ `hello, world %`\n\n### `\\def` and `\\newcommand` user-defined macros\n\nExpands each user-defined macro and removes their definition.\n\n\u003e `\\newcommand\\swap[2]{#2#1}\\swap{a}{b}` ~ `ba`\n\n### `\\newenvironment` user-defined environments\n\n\u003e `\\newenvironment{items}{\\begin{itemize}}{\\end{itemize}}\\begin{items}\\end{items}` ~ `\\begin{itemize}\\end{itemize}`\n\n### Altogether now!\n\n\u003e `\\myfalse\\ifmy\\def\\xyz{A cat.}\\else\\def\\xyz{A dog.}\\fi\\xyz% $#@!` ~ `A dog.%`\n\n\n## What for?\n\nI use it for scientific publications. I often need different versions of\nthe same paper for different occasions: conference proceedings, journal\nversion, arXiv preprint. I just write the content once, with the right\nconditionals, macro definitions and `\\input` calls. I flatten everything using\n[`flatex`](https://github.com/aureooms/dotfiles/blob/main/.bin/flatex),\nshake the document with `texshake`, and finally get rid of all extraneous\nblanks with\n[`textrim`](https://github.com/aureooms/dotfiles/blob/main/.bin/textrim).\n\n\n## How does it work?\n\nIt uses\n[@aureooms/js-tape](https://github.com/aureooms/js-tape)\nand\n[@aureooms/js-grammar](https://github.com/aureooms/js-grammar)\nunder the hood.\n\nThe tokens are produced according to\n[this file](https://github.com/aureooms/texshake/blob/main/src/tokens.js)\nand\nthe shaking logic lies in\n[this file](https://github.com/aureooms/texshake/blob/main/src/transform/shaker.js).\n\n## Related\n\n  - [alvinwan/TexSoup](https://github.com/alvinwan/TexSoup)\n  - [michael-brade/LaTeX.js](https://github.com/michael-brade/LaTeX.js)\n  - [WikiToLearn/texla](https://github.com/WikiToLearn/texla)\n  - [Parsing TeX is Turing-complete](https://tex.stackexchange.com/questions/4201/is-there-a-bnf-grammar-of-the-tex-language)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmake-github-pseudonymous-again%2Ftexshake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmake-github-pseudonymous-again%2Ftexshake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmake-github-pseudonymous-again%2Ftexshake/lists"}