195 lines
6.7 KiB
Markdown
195 lines
6.7 KiB
Markdown
# LaTeX Book Template
|
|
|
|
A professional LaTeX book template with automated CI/CD pipeline for generating multiple output formats including PDF, ePub, ODT, and DOCX. This template provides a clean, modern layout with customizable styling and automatic release generation.
|
|
|
|
## Features
|
|
|
|
- 📚 Multiple output formats: PDF (one-sided, two-sided, ebook), ePub, ODT, DOCX
|
|
- 🎨 Professional typography using Libertine font with microtype improvements
|
|
- 📄 Custom page layouts with headers, footers, and margins optimized for different formats
|
|
- 🖼️ Cover page support with background images and work-in-progress watermarks
|
|
- ⚡ Automated CI/CD pipeline with timestamped releases
|
|
- 🔧 Easy customization through structured LaTeX files
|
|
- 🐳 Docker-based build environment for consistent compilation
|
|
|
|
## Quick Start
|
|
|
|
### Prerequisites
|
|
|
|
- **Local build**: LaTeX distribution (TeX Live, MiKTeX) with `pdflatex` and `pandoc`
|
|
- **Docker build**: Docker (recommended for consistent results)
|
|
- **CI/CD**: Gitea instance with Actions enabled
|
|
|
|
### Usage
|
|
|
|
1. **Clone this template:**
|
|
```bash
|
|
git clone <your-repo-url>
|
|
cd template
|
|
```
|
|
|
|
2. **Customize your book:**
|
|
- Edit `src/book.tex` to set author, title, and subtitle
|
|
- Add/modify chapters in `src/chapters/`
|
|
- Replace `src/graphics/cover.jpg` with your cover image
|
|
- Remove `\workinprogress` command when ready for final version
|
|
|
|
3. **Build locally:**
|
|
```bash
|
|
# Build all formats
|
|
make book
|
|
|
|
# Or build specific formats
|
|
make oneside.pdf # One-sided PDF
|
|
make twosides.pdf # Two-sided PDF
|
|
make ebook.pdf # eBook PDF
|
|
make book.epub # ePub format
|
|
make book.odt # OpenDocument Text
|
|
make book.docx # Microsoft Word
|
|
```
|
|
|
|
4. **Clean build artifacts:**
|
|
```bash
|
|
make clean
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── Makefile # Build automation
|
|
├── README.md # This file
|
|
├── src/ # LaTeX source files
|
|
│ ├── book.tex # Main book file (edit this)
|
|
│ ├── chapters/ # Individual chapters
|
|
│ │ └── one.tex # Example chapter
|
|
│ ├── graphics/ # Images and cover art
|
|
│ │ └── cover.jpg # Book cover image
|
|
│ └── .formats/ # LaTeX formatting templates
|
|
│ ├── structure.tex # Core styling and layout
|
|
│ ├── ebook.tex # eBook format template
|
|
│ ├── oneside.tex # One-sided format template
|
|
│ └── twosides.tex # Two-sided format template
|
|
├── out/ # Generated output files
|
|
└── .github/
|
|
└── workflows/
|
|
└── ci.yaml # CI/CD pipeline
|
|
```
|
|
|
|
## Customization
|
|
|
|
### Book Metadata
|
|
Edit `src/book.tex`:
|
|
```latex
|
|
\author{Your Name}
|
|
\title{Your Book Title}
|
|
\subtitle{Your Subtitle}
|
|
```
|
|
|
|
### Removing Work-in-Progress Watermark
|
|
Comment out or remove this line from `src/book.tex`:
|
|
```latex
|
|
%\workinprogress
|
|
```
|
|
|
|
### Removing Title Box from Cover
|
|
Use the `\removetitlebox` command to remove the white semi-transparent title box overlay from the cover page, leaving only the background image. This creates a cleaner cover design where the background image is fully visible without any text overlay. Add this line to `src/book.tex`:
|
|
```latex
|
|
\removetitlebox
|
|
```
|
|
|
|
**Note:** When `\removetitlebox` is active, only the work-in-progress watermark (if enabled) will be displayed on the cover. The book title, author, and subtitle will not appear on the cover page.
|
|
|
|
### Adding Chapters
|
|
1. Create new `.tex` files in `src/chapters/`
|
|
2. Include them in `src/book.tex`:
|
|
```latex
|
|
\include{chapters/your-new-chapter}
|
|
```
|
|
|
|
### Custom Styling
|
|
Modify `src/.formats/structure.tex` to customize:
|
|
- Fonts and typography
|
|
- Page layouts and margins
|
|
- Chapter and section formatting
|
|
- Colors and styling
|
|
|
|
## CI/CD Pipeline
|
|
|
|
The template includes automated building and releasing:
|
|
|
|
- **Triggers:** Push to any branch, pull requests
|
|
- **Build Environment:** Custom LaTeX Docker image (`git.arindy.de/arindy/latex-runner:1.0.1`)
|
|
- **Output:** Automatic releases with timestamped names containing all formats
|
|
- **Files Released:** All generated files from the `out/` directory
|
|
|
|
### Customizing CI/CD
|
|
|
|
Edit `.github/workflows/ci.yaml` to:
|
|
- Change the Docker image
|
|
- Modify release naming
|
|
- Add additional build steps
|
|
- Configure different triggers
|
|
|
|
## Download Latest Release
|
|
|
|
- [EBook as ePub](/../../../releases/download/latest/ebook.epub)
|
|
- [EBook as PDF](/../../../releases/download/latest/ebook.pdf)
|
|
- [Book as a one-sided PDF](/../../../releases/download/latest/oneside.pdf)
|
|
- [Book as a two-sided PDF](/../../../releases/download/latest/twosides.pdf)
|
|
- [Book as ODT](/../../../releases/download/latest/book.odt)
|
|
- [Book as DOCX](/../../../releases/download/latest/book.docx)
|
|
|
|
## Contributing
|
|
|
|
1. Fork this repository
|
|
2. Create a feature branch
|
|
3. Make your changes
|
|
4. Test the build process
|
|
5. Submit a pull request
|
|
|
|
## License
|
|
|
|
This LaTeX Book Template is licensed under the **Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (CC BY-NC-SA 3.0)**. See the [LICENSE](LICENSE) file for the complete license text.
|
|
|
|
### What the License Covers
|
|
|
|
The CC BY-NC-SA 3.0 license applies to **all template files**, including:
|
|
- LaTeX source files (`src/` directory)
|
|
- Build configuration (`Makefile`, CI/CD workflows)
|
|
- Documentation and examples
|
|
- Styling and formatting templates
|
|
|
|
### License Terms Summary
|
|
|
|
**You are free to:**
|
|
- ✅ **Share** — Copy and redistribute the template in any medium or format
|
|
- ✅ **Adapt** — Modify, remix, and build upon the template for your own books
|
|
|
|
**Under these conditions:**
|
|
- 📝 **Attribution** — Credit the original creators (Vel from LaTeXTemplates.com and Arindy)
|
|
- 🚫 **NonCommercial** — You may not use this template for commercial purposes
|
|
- 🔄 **ShareAlike** — If you distribute modified versions, use the same CC BY-NC-SA 3.0 license
|
|
|
|
### Important Notes
|
|
|
|
- **Your book content** (text, images you add) is **not covered** by this license
|
|
- You retain full rights to your own written content
|
|
- The license only applies to the template structure and code
|
|
- For commercial use, please contact the maintainers
|
|
|
|
This template is based on the eBook template from LaTeXTemplates.com, originally created by Vel, with modifications by Arindy.
|
|
|
|
## Troubleshooting
|
|
|
|
### Build Errors
|
|
- Check LaTeX logs in `out/*.log` files
|
|
- Ensure all required packages are installed
|
|
- Verify image files exist and are accessible
|
|
|
|
### Missing Fonts
|
|
The template uses Libertine font. Install it or modify `src/.formats/structure.tex` to use different fonts.
|
|
|
|
### Docker Issues
|
|
If using the CI pipeline, ensure your Gitea instance has access to the specified Docker image or modify the workflow to use a public LaTeX image.
|