This repository provides a Codespace environment for instantly and automatically building and previewing LaTeX files.
The initial goal was to develop a Visual Studio Code extension for building LaTeX files and previewing PDFs "on-the-fly" within the web IDE. However, this is impractical due to the following limitations:
The optimal approach is to create an extension using a codespace with all necessary dependencies. However, using a Docker image with Codespaces remains the simplest and most reliable solution for me at the current moment.
Code
.Create codespace on main
.latex/sample.tex
.Ctrl + Alt + B
to build the LaTeX project.sample.pdf
in the latex/PDF
directory.sample.tex
and 50% sample.pdf
..tex
file will automatically rebuild and update the PDF preview.[!NOTE] The initial PDF preview may take about 30 seconds to set up correctly. It will also open a new window for port forwarding. Once successful, this window can be closed.
Can also use Gitpod to create an environment based on this repository, click here or use the link below:
https://gitpod.io/#https://github.com/jotavare/latex-preview-container/
[!NOTE] Unlike Codespaces, Gitpod offers instant PDF previews from the start. No waiting for the first time.
The Docker image pulls the latest full version of TeX Live without documentation and source files, installs git
and perl
, and cleans unnecessary files, totalling 2.33GB. Depending on the project needs, other tags like minimal
, small
, or medium
may also be used, to reduce codespaces build time.
latex-preview-container/
│
├── .devcontainer/
│ ├── devcontainer.json # Configuration file for Codespaces devcontainer
│
├── docker/
│ ├── Dockerfile # Dockerfile for setting up the development environment
│ ├── docker-compose.yml # Docker Compose file for managing Docker containers
│
├── latex/
│ ├── sample.tex # Sample LaTeX file for testing purposes
│
├── LICENSE # Licensing information for the project
└── README.md # Project documentation
Below are links I used to create this repository and other information that may be useful in the future.
Link | Source |
---|---|
TeX Live | Website |
TeX Live Docker Image | Website |
Installing TeX Live | Website |
The Comprehensive TeX Archive Network | Website |
James-Yu/LaTeX-Workshop | GitHub |
PDFTeX | Website |
WebLaTex | GitHub |
TinyTeX | Unix |
MiKTeX | Windows |
MacTeX | Macintosh |
Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use.
Link | Source |
---|---|
Typst | GitHub |
Typst Setup | GitHub |
Typst Actions | GitHub |
Typst Live | GitHub |
devcontainer.json
to enhance the workflow, such as grammar check, code formatting, Copilot, dark mode, etc.If you find any issues or have suggestions for improvements, feel free to fork the repository and open an issue or submit a pull request.
This project is available under the MIT License. For further details, please refer to the LICENSE file.