This system automatically synchronizes your CV.tex file with your website content, ensuring that whenever you update your website, your CV is automatically updated and a new PDF is generated.
- Single Source of Truth: All your data is stored in one JSON file
- Automatic Synchronization: Changes in data automatically update both HTML and LaTeX
- PDF Generation: Automatically compiles LaTeX to PDF
- File Watching: Monitors changes and updates files in real-time
- Template-Based: Easy to customize and extend
Webpage-project/
βββ cv-data.json # Single source of data
βββ generate_cv.py # LaTeX CV generator
βββ generate_html.py # HTML pages generator
βββ auto_update.py # Auto-update watcher
βββ requirements.txt # Python dependencies
βββ assets/
β βββ styles.css # CSS styles
βββ MyPhoto.png # Your photo
βββ CV.tex # Generated LaTeX file
βββ CV.pdf # Generated PDF file
βββ home.html # Generated HTML pages
βββ education.html
βββ experience.html
βββ projects.html
βββ publications.html
βββ skills.html
βββ index.html
pip install -r requirements.txtOn Ubuntu/Debian:
sudo apt-get install texlive-latex-extra texlive-fonts-recommendedOn macOS:
brew install --cask mactexOn Windows:
- Create or update
cv-data.jsonwith your information (see the provided template) - Add your photo as
MyPhoto.pngin the root directory - Customize CSS in
assets/styles.cssif needed
# Generate HTML pages
python generate_html.py
# Generate LaTeX CV
python generate_cv.py
# Compile PDF (if you have LaTeX installed)
# This is optional - the CV generator can do this automaticallyUpdate your cv-data.json file and run:
python generate_html.py # Updates HTML pages
python generate_cv.py # Updates CV.tex and optionally compiles PDFStart the auto-update watcher:
python auto_update.pyNow, whenever you modify cv-data.json, the system will automatically:
- Regenerate all HTML pages
- Update CV.tex
- Compile the PDF
- Clean up temporary files
To force update all files regardless of changes:
python auto_update.py --forceEdit cv-data.json and add to the experience array:
{
"position": "Your New Position",
"organization": "Company Name",
"location": "City, Country",
"start_date": "Jan 2024",
"end_date": "Present",
"description": "Brief description of the role",
"responsibilities": [
"First responsibility",
"Second responsibility"
]
}Add to the publications array:
{
"title": "Your Paper Title",
"authors": ["Your Name", "Co-author"],
"venue": "Journal or Conference Name",
"year": "2024",
"doi": "https://doi.org/10.xxxx/xxxxx",
"type": "journal"
}Add to the projects array:
{
"title": "Project Name",
"organization": "Funding Organization",
"start_date": "Jan 2024",
"end_date": "Dec 2024",
"description": "Project description",
"status": "ongoing"
}The HTML generator uses Jinja2 templates embedded in the code. To customize:
- Edit the template strings in
generate_html.py - Modify CSS in
assets/styles.css - Update the base template structure as needed
To customize the CV format:
- Edit the LaTeX generation methods in
generate_cv.py - Modify the document class, packages, or styling
- Add new sections or change the layout
To add a new page (e.g., "Awards"):
- Add the data structure to
cv-data.json - Create a new generation method in
generate_html.py - Add the page to the navigation menu
- Optionally add a corresponding section to the LaTeX generator
1. "pdflatex not found"
- Install LaTeX as described in setup instructions
- Ensure
pdflatexis in your system PATH
2. "jinja2 not found"
- Install dependencies:
pip install -r requirements.txt
3. "Permission denied" errors
- Ensure you have write permissions in the directory
- Check that files aren't open in other applications
4. PDF compilation fails
- Check that all required LaTeX packages are installed
- Look at the LaTeX error messages for missing packages
- Try compiling manually:
pdflatex CV.tex
For more verbose output, you can modify the scripts to include debug information:
# Add to the beginning of any script
import logging
logging.basicConfig(level=logging.DEBUG)- Update your data: Edit
cv-data.jsonwith new information - Auto-update: If the watcher is running, files update automatically
- Review changes: Check the generated HTML pages and PDF
- Commit changes: Add all files to version control
- Add publication: Update the
publicationsarray incv-data.json - Verify formatting: Check that the publication appears correctly on the publications page
- Update CV: Ensure the publication is included in the PDF
- Deploy: Upload updated files to your website
- Add/Update project: Modify the
projectsarray - Check status: Ensure project status is correctly reflected
- Update descriptions: Keep project descriptions current
- Sync with website: Verify changes appear on the projects page
Create .github/workflows/cv-update.yml:
name: Update CV
on:
push:
paths:
- 'cv-data.json'
jobs:
update-cv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install -r requirements.txt
sudo apt-get install texlive-latex-extra
- name: Generate files
run: |
python generate_html.py
python generate_cv.py
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto-update CV and website" || exit 0
git pushCreate a Dockerfile:
FROM python:3.9-slim
RUN apt-get update && apt-get install -y \
texlive-latex-extra \
texlive-fonts-recommended \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "auto_update.py"]You could extend this system with a simple web interface for editing:
# web_editor.py
from flask import Flask, render_template, request, jsonify
import json
app = Flask(__name__)
@app.route('/')
def editor():
with open('cv-data.json', 'r') as f:
data = json.load(f)
return render_template('editor.html', data=data)
@app.route('/save', methods=['POST'])
def save_data():
data = request.json
with open('cv-data.json', 'w') as f:
json.dump(data, f, indent=2)
return jsonify({'status': 'saved'})
if __name__ == '__main__':
app.run(debug=True)This system is open source and can be freely modified and distributed.
Feel free to submit issues, feature requests, or pull requests to improve this system.
Happy CV updating! π