{"id":23037166,"url":"https://github.com/idlephysicist/go-latex","last_synced_at":"2026-04-28T08:31:49.911Z","repository":{"id":101089917,"uuid":"212231788","full_name":"IdlePhysicist/go-latex","owner":"IdlePhysicist","description":"A Go parser to replace LaTeX macros with Unicode characters in Go source code.","archived":false,"fork":false,"pushed_at":"2020-09-01T21:24:42.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T13:27:51.645Z","etag":null,"topics":["go","go-latex","golang","greek-alphabet","latex","latex-macros","mathematics","physics","unicode"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IdlePhysicist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-02T01:22:51.000Z","updated_at":"2022-12-26T20:54:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab881bc9-4a80-498e-80c3-8f3767431b1e","html_url":"https://github.com/IdlePhysicist/go-latex","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IdlePhysicist%2Fgo-latex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IdlePhysicist%2Fgo-latex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IdlePhysicist%2Fgo-latex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IdlePhysicist%2Fgo-latex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IdlePhysicist","download_url":"https://codeload.github.com/IdlePhysicist/go-latex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905869,"owners_count":20852820,"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":["go","go-latex","golang","greek-alphabet","latex","latex-macros","mathematics","physics","unicode"],"created_at":"2024-12-15T17:29:31.067Z","updated_at":"2026-04-28T08:31:44.872Z","avatar_url":"https://github.com/IdlePhysicist.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-latex\n\n*IdlePhysicist, 2019*\n\nGo-latex is a simple parser that reads Go source files, extracts LaTeX commands and replaces them with their unicode equivalents.\n\n### Usage\n\nGo-latex can take a directory, or a `.go` file as its input argument. Currently the program accepts upper and lowercase Greek letters, as well as ∇ (nabla) and ℏ (h-bar) the reduced Planck's constant, both symbols heavily used in physics.\n\n#### Limitations\n\nA variable can contain LaTeX macros provided the immediate following character is one of the following:\n- A backslash i.e. another LaTeX macro\n- An underscore\n- A space\n- Or a Capital letter\n\nThe only kind of character that cannot follow a macro is a lowercase letter! While this is an annoyance to some it can promote the writing of more readable code by using `_` and capitalisations to break up variable names containing several words.\n\n**Note on string literals**\n\nIt was pointed out to me that `go-latex` will replace anything that *looks* like a LaTeX macro in the parsed source code, even if it is inside a string literal. This is by design so that the user can print unicode characters to the terminal.\n\nThe example used to bring this to my attention was string formatted as a Windows file path, while this is not an issue to me as a UNIX user but if you are a Windows user who wishes to use this software, then please be careful of the directory names in your paths.\n\n### Example\nTake for example the following Go source file.\n\n```Go\npackage test\n\nfunc \\Xi() {\n  return \\`\\xi latex is \\pi \\phi\\`\n}\n\nfunc \\gammaDot() {\n  return \\`\\gammaDot`\n}\n\nfunc Frat() {\n  return \"\\kappa\\gamma\\eta\"\n\nfunc main() {\n  \\hbar_star := 0.0562\n  x := \\Xi()\n  y := \\gammaDot()\n\n}\n\n```\n\nWell after running `go-latex` on it you would get the following.\n\n```Go\npackage test\n\nfunc Ξ() {\n  return \\`ξ latex is π φ\\`\n}\n\nfunc γDot() {\n  return \\`γDot`\n}\n\nfunc Frat() {\n  return \"κγη\"\n\nfunc main() {\n  ℏ_star := 0.0562\n  x := Ξ()\n  y := γDot()\n\n}\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidlephysicist%2Fgo-latex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidlephysicist%2Fgo-latex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidlephysicist%2Fgo-latex/lists"}