{"id":13392792,"url":"https://github.com/SwiftLaTeX/SwiftLaTeX","last_synced_at":"2025-03-13T19:31:10.129Z","repository":{"id":36561477,"uuid":"225990209","full_name":"SwiftLaTeX/SwiftLaTeX","owner":"SwiftLaTeX","description":"SwiftLaTeX, a WYSIWYG Browser-based LaTeX Editor ","archived":false,"fork":false,"pushed_at":"2024-06-18T10:03:53.000Z","size":169738,"stargazers_count":2153,"open_issues_count":15,"forks_count":117,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-03-13T15:12:16.216Z","etag":null,"topics":["editor","latex","webassembly","wysiwyg"],"latest_commit_sha":null,"homepage":"https://www.swiftlatex.com","language":"C","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/SwiftLaTeX.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-05T01:30:07.000Z","updated_at":"2025-03-13T04:52:44.000Z","dependencies_parsed_at":"2024-06-18T11:37:22.507Z","dependency_job_id":null,"html_url":"https://github.com/SwiftLaTeX/SwiftLaTeX","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftLaTeX%2FSwiftLaTeX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftLaTeX%2FSwiftLaTeX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftLaTeX%2FSwiftLaTeX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftLaTeX%2FSwiftLaTeX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftLaTeX","download_url":"https://codeload.github.com/SwiftLaTeX/SwiftLaTeX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243469127,"owners_count":20295692,"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":["editor","latex","webassembly","wysiwyg"],"created_at":"2024-07-30T17:00:37.299Z","updated_at":"2025-03-13T19:31:10.102Z","avatar_url":"https://github.com/SwiftLaTeX.png","language":"C","funding_links":[],"categories":["C++","HarmonyOS","C","JavaScript","C (286)"],"sub_categories":["Windows Manager"],"readme":"\r\n# SwiftLaTeX\r\n\r\nDemo Website https://www.swiftlatex.com\r\n\r\n[![Building Assets](https://github.com/SwiftLaTeX/SwiftLaTeX/actions/workflows/github-actions-build.yml/badge.svg?branch=master)](https://github.com/SwiftLaTeX/SwiftLaTeX/actions/workflows/github-actions-build.yml)\r\n\r\n## Introduction for SwiftLaTeX\r\n\r\nSwiftLaTeX, LaTeX Engines in Browsers with optional WYSIWYG support. We are a big fan of WebAssembly and all computation is done locally.\r\n\r\n## Main Features\r\n\r\n1. __Speed__. SwiftLaTeX engines run in browsers, all computation is done strictly locally.\r\n2. __Library Support__. Simply include a script tag and use PdfTeX or XeTeX in your own webpage.\r\n3. __Compatibility__. Produce exact same output you would get from TexLive or MikTeX.\r\n4. __WYSIWYG__. SwiftLaTeX provides an optional WYSIWYG editor, allowing users to editing PDF output directly (WIP).\r\n\r\n## Quick Installation Guide\r\n1. Download latest release from Github. Extract the files and put them into your webpage directory.\r\n2. Include the src tag in your page.\r\n```\r\n\u003cscript src=\"PdfTeXEngine.js\"\u003e\u003c/script\u003e\r\n```\r\n3. Initialize the engine.\r\n```\r\nconst engine = new PdfTeXEngine();\r\nawait engine.loadEngine();\r\n```\r\n4. Load the tex files/pictures/fonts to engines.\r\n```\r\nengine.writeMemFSFile(\"main.tex\", \"\\documentclass{...\");\r\n```\r\n5. Set the main file and fire the engine.\r\n```\r\nengine.setEngineMainFile(\"main.tex\");\r\nlet r = await engine.compileLaTeX(); // r contains PDF binray and compilation log.\r\n```\r\n\r\n## APIs\r\n1. async loadEngine(): Promise\u003cvoid\u003e. \\\r\nLoad the webassembly engine.\r\n2. isReady(): boolean. \\\r\nCheck whether the engine is ready to compile documents.\r\n3. writeMemFSFile(filename: string, srccode: string | Uint8Array). \\\r\nUpload source codes / assets to the engine.\r\n4. makeMemFSFolder(folder: string). \\\r\nCreate a directory.\r\n5. setEngineMainFile(filename: string). \\\r\nTell the engine which latex file is the entry file.\r\n6. compileLaTeX():Promise\u003cCompileResult\u003e. \\\r\nStart compiling LaTeX documents and return CompileResult.\r\n7. flushCache(). \\\r\nPurge all the files uploaded.\r\n8. closeWorker(). \\\r\nShutdown the engine.\r\n9. setTexliveEndpoint(url: string). \\\r\nIf you host your own texlive server, you can ask the engine to fetch files from the server.\r\n10. compileFormat(). \\\r\nIf you host your own texlive server, you may wanna generate the tex engine format file via this function.\r\n\r\n## Compile Engines by yourself\r\nSwiftLaTeX compiles XeTeX and PdfTeX engines into WebAssembly. We recommend the XeTeX engine as it supports UTF-8 and Opentype fonts out of box.\r\nThe engine is almost 100% identical to XeTeX except SwiftLaTeX does not include a full ICU dataset. As a result, the locale linebreaking may not function as expected. This issue is easy to fix: we just need to initialize the ICU library with the correct dataset.  If you just need to handle English, the PdfTeX is also a nice option. It is less compilcated, thus faster and less buggy.\r\n\r\n1. Get the emsdk repo\r\n```\r\ngit clone https://github.com/emscripten-core/emsdk.git\r\n```\r\n2. Enter that directory\r\n```\r\ncd emsdk\r\n```\r\n3. Fetch the latest version of the emsdk (not needed the first time you clone)\r\n```\r\ngit pull\r\n```\r\n4. Download and install the latest SDK tools.\r\n```\r\n./emsdk install latest\r\n```\r\n5. Make the latest\" SDK \"active\" for the current user. (writes .emscripten file)\r\n```\r\n./emsdk activate latest\r\n```\r\n6. Activate PATH and other environment variables in the current terminal\r\n```\r\nsource ./emsdk_env.sh\r\n```\r\n7. Compile XeTeX or PdfTeX\r\n```\r\ncd pdftex.wasm or xetex.wasm\r\nmake\r\n```\r\n\r\n\r\n\r\n\r\n\r\n## CTAN files\r\nLaTeX is not a stand-alone typesetting program in itself, but document preparation software that runs on top of Donald E. Knuth's TeX typesetting system. TeX distributions usually bundle together all the parts needed for a working TeX system and they generally add to this both configuration and maintenance utilities. Nowadays LaTeX, and many of the packages built on it, form an important component of any major TeX distribution. \r\nIn SwiftLaTeX, all required files are fetched from CTAN (Comprehensive TeX Archive Network), https://www.ctan.org, or our mirror server https://texlive.swiftlatex.com. \r\nYou can checkout the repo https://github.com/SwiftLaTeX/Texlive-Ondemand and host your own server. \r\n\r\n## WYSIWYG Editor\r\nWe are also working hard to bring back our WYSIWYG latex editor. The editor is pretty similar to overleaf, except users are allowed to edit pdf output directly. \r\n\r\n## License\r\nThe code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the LICENSE file.\r\nCopyright (c) SwiftLab, 2018-2022.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftLaTeX%2FSwiftLaTeX","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwiftLaTeX%2FSwiftLaTeX","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftLaTeX%2FSwiftLaTeX/lists"}