This guide will help you set up the LaTeX preview system for the C++ Qt Learning Book.
-
Start the preview server:
# Windows start-preview.bat # Linux/macOS ./start-preview.sh # Or manually python server.py
-
Open your browser:
- Go to
http://localhost:8000 - You'll see the preview interface with build options
- Go to
-
Build the document:
- Click on any build option in the web interface
- The PDF will be generated in the
output/directory - Click "Open Book PDF" to view the result
-
Build the document:
# Simple build make all # Build with index make index # Build with bibliography make bib # Clean auxiliary files make clean
-
View the PDF:
# Open the PDF make open # Or manually open output/book.pdf
- Python 3.6+ (for the preview server)
- LaTeX Distribution (one of the following):
- TeX Live (recommended for Linux/macOS)
- MiKTeX (recommended for Windows)
- MacTeX (for macOS)
The following LaTeX packages are required:
# Ubuntu/Debian
sudo apt-get install texlive-full texlive-latex-extra texlive-fonts-extra texlive-lang-indonesian texlive-bibtex-extra biber makeindex latexmk
# macOS (with Homebrew)
brew install --cask mactex
# Windows
# Install MiKTeX and ensure all packages are installed- Download and install MiKTeX from https://miktex.org/
- During installation, choose "Install missing packages on-the-fly = Yes"
- Add MiKTeX to your PATH environment variable
# Using Homebrew
brew install --cask mactex
# Or download from https://www.tug.org/mactex/sudo apt-get update
sudo apt-get install texlive-full texlive-latex-extra texlive-fonts-extra texlive-lang-indonesian texlive-bibtex-extra biber makeindex latexmk# The server uses only Python standard library
# No additional packages required# Check LaTeX installation
pdflatex --version
# Check Python installation
python --version
# Test build
make allIf you prefer using Docker:
# Start the Docker environment
docker-compose up -d
# Access the web interface
# Open http://localhost:8443 in your browser
# Login with password: secret
# Build from within the container
docker exec latex-full make allcpp-qt/
├── latex/ # LaTeX source files
│ ├── book.tex # Main document
│ ├── 01-pengenalan.tex # Chapter files
│ └── ...
├── output/ # Generated PDF and auxiliary files
├── preview.html # Web preview interface
├── server.py # Python web server
├── build-latex.sh # Build script
├── Makefile # Build automation
├── start-preview.bat # Windows startup script
├── start-preview.sh # Unix startup script
└── README.md # Main documentation
make all # Build the PDF document
make index # Build with index
make bib # Build with bibliography
make clean # Clean auxiliary files
make distclean # Clean everything including PDF
make open # Open the generated PDF
make watch # Watch for changes and rebuild
make help # Show help message./build-latex.sh # Build the complete documentcd latex
pdflatex -interaction=nonstopmode -output-directory=../output book.tex
pdflatex -interaction=nonstopmode -output-directory=../output book.tex
makeindex -o ../output/book.ind ../output/book.idx
pdflatex -interaction=nonstopmode -output-directory=../output book.tex-
"pdflatex: command not found"
# Install LaTeX distribution # See installation steps above
-
Missing LaTeX packages
# Install additional packages sudo apt-get install texlive-lang-indonesian sudo apt-get install texlive-fonts-extra -
Font issues
# Install Libertine font sudo apt-get install texlive-fonts-extra -
Image not found
- Ensure images are in
manuscript/images/ - Check image file names match LaTeX references
- Ensure images are in
-
Bibliography issues
# Use biber instead of bibtex biber book -
Permission denied
# Fix file permissions chmod +x build-latex.sh start-preview.sh
-
Check LaTeX log files:
# Look for errors in output/book.log cat output/book.log | grep -i error
-
Clean and rebuild:
make clean make all
-
Check file paths:
- Ensure all
\input{}files exist - Check image paths are correct
- Ensure all
-
Port already in use:
# Change port in server.py port = 8001 # or any available port
-
Python not found:
# Use python3 instead python3 server.py
If you encounter issues:
- Check the troubleshooting section above
- Look at the LaTeX log files in the
output/directory - Ensure all prerequisites are installed
- Try the Docker alternative if local installation fails
Happy LaTeX compiling! 📚✨