SwiftLaTeX, a Wysiwyg Browser-Based LaTeX Editor

theanonymousone3 pts0 comments

GitHub - SwiftLaTeX/SwiftLaTeX: SwiftLaTeX, a WYSIWYG Browser-based LaTeX Editor · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

SwiftLaTeX

SwiftLaTeX

Public

Notifications<br>You must be signed in to change notification settings

Fork<br>137

Star<br>2.3k

master

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>57 Commits<br>57 Commits

.github/workflows

.github/workflows

dvipdfm.wasm

dvipdfm.wasm

pdftex.wasm

pdftex.wasm

xetex.wasm

xetex.wasm

.gitignore

.gitignore

LICENSE

LICENSE

Makefile

Makefile

README.md

README.md

View all files

Repository files navigation

SwiftLaTeX

Demo Website https://www.swiftlatex.com

Introduction for SwiftLaTeX

SwiftLaTeX, LaTeX Engines in Browsers with optional WYSIWYG support. We are a big fan of WebAssembly and all computation is done locally.

Main Features

Speed . SwiftLaTeX engines run in browsers, all computation is done strictly locally.

Library Support . Simply include a script tag and use PdfTeX or XeTeX in your own webpage.

Compatibility . Produce exact same output you would get from TexLive or MikTeX.

WYSIWYG . SwiftLaTeX provides an optional WYSIWYG editor, allowing users to editing PDF output directly (WIP).

Quick Installation Guide

Download latest release from Github. Extract the files and put them into your webpage directory.

Include the src tag in your page.

">

Initialize the engine.

const engine = new PdfTeXEngine();<br>await engine.loadEngine();

Load the tex files/pictures/fonts to engines.

engine.writeMemFSFile("main.tex", "\documentclass{...");

Set the main file and fire the engine.

engine.setEngineMainFile("main.tex");<br>let r = await engine.compileLaTeX(); // r contains PDF binray and compilation log.

APIs

async loadEngine(): Promise.

Load the webassembly engine.

isReady(): boolean.

Check whether the engine is ready to compile documents.

writeMemFSFile(filename: string, srccode: string | Uint8Array).

Upload source codes / assets to the engine.

makeMemFSFolder(folder: string).

Create a directory.

setEngineMainFile(filename: string).

Tell the engine which latex file is the entry file.

compileLaTeX():Promise.

Start compiling LaTeX documents and return CompileResult.

flushCache().

Purge all the files uploaded.

closeWorker().

Shutdown the engine.

setTexliveEndpoint(url: string).

If you host your own texlive server, you can ask the engine to fetch files from the server.

compileFormat().

If you host your own texlive server, you may wanna generate the tex engine format file via this function.

Compile Engines by yourself

SwiftLaTeX compiles XeTeX and PdfTeX engines into WebAssembly. We recommend the XeTeX engine as it supports UTF-8 and Opentype fonts out of box.<br>The 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.

Get the emsdk repo

git clone https://github.com/emscripten-core/emsdk.git

Enter that directory

cd emsdk

Fetch the latest version of the emsdk (not needed the first time you clone)

git pull

Download and install the latest SDK tools.

./emsdk install latest

Make the latest" SDK "active" for the current user. (writes .emscripten file)

./emsdk activate latest

Activate PATH and other environment variables in the current terminal

source ./emsdk_env.sh

Compile XeTeX or PdfTeX

cd pdftex.wasm or xetex.wasm<br>make

CTAN files

LaTeX 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.<br>In SwiftLaTeX, all...

engine swiftlatex files wasm xetex latex

Related Articles