This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Japanese LaTeX thesis template for Miyazaki University (宮崎大学) KatLab master's theses. The environment uses Docker and supports both Docker Compose and VS Code Dev Containers workflows. Documents are written in Japanese using uplatex and compiled via latexmk.
# Docker Compose workflow (first time)
make setup
# Dev Containers workflow
# No setup needed - just run make# Compile paper.tex and watch for changes in chapters/ (most common)
make
# Compile paper.tex once without watching
make paper.pdf
# Watch chapters/ for changes and auto-compile
make watch-chapters
# Clean intermediate files
make clean
# Clean all generated files including PDFs
make clean-all
# Open the generated PDF (macOS only)
make open-pdfmake build # Build Docker image
make up # Start container
make down # Stop and remove container
make exec # Connect to container
make restart # Restart container
make rebuild # Complete rebuildThis repository serves as a template. Repositories created from this template can sync updates using:
bash scripts/sync-template.shThe script:
- Fetches latest changes from the template repository
- Shows differences between template and current repo
- Offers merge/rebase options to incorporate updates
- Handles conflicts if they occur
Manual sync method:
git remote add template https://github.com/KatLab-MiyazakiUniv/katlab-master-thesis-template.git
git fetch template
git merge template/main --allow-unrelated-histories- Compiler: uplatex (upLaTeX - Unicode-compatible Japanese LaTeX)
- DVI to PDF: dvipdfmx
- Build tool: latexmk (configured in
.latexmkrc) - Bibliography: pbibtex with junsrt style
- Watch mechanism: Uses fswatch (macOS), inotifywait (Linux), or polling fallback
paper.tex # Main thesis file (combines all chapters)
paper.bib # Bibliography database
outline.tex # Thesis outline
languages.sty # Language/code highlighting settings
chapters/ # Individual chapter .tex files
01-introduction.tex
02-preparation.tex
03-function.tex
04-implementation.tex
05-indication.tex
06-discussion.tex
07-conclusion.tex
08-acknowledgments.tex
packages/ # Custom LaTeX style files
miyazaki-u-paper.sty # University thesis style (by Prof. Katayama)
jlisting.sty # Japanese listings support
listings.sty # Code listing support
images/ # Image files referenced in thesis
build/ # Compilation artifacts (.aux, .dvi, .log, etc.)
scripts/ # Utility scripts
watch.sh # File watching script (used by Makefile)
sync-template.sh # Template synchronization script
The Makefile automatically detects whether running in:
- Dev Container (checks
/.dockerenv+.devcontainer/devcontainer.json) - Docker Compose (requires explicit container execution)
- Host machine (direct execution)
Commands adjust automatically based on the detected environment.
paper.tex is the main file that:
- Uses
jsbookdocument class (Japanese book style) - Includes various packages from
packages/directory - Inputs all chapter files from
chapters/via\input{} - Defines thesis metadata via custom commands:
\degree{m}- Master's thesis (use 'g' for graduate/bachelor)\title{},\author{},\nendo{},\major{}
- Uses
miyazaki-u-paper.styfor university-specific formatting
The languages.sty file provides syntax highlighting configurations for:
- Java (default)
- Kotlin (custom lstlisting definition)
- Swift (custom lstlisting definition)
- All chapter files must be placed in
chapters/directory - Chapter files are automatically included by
paper.texin numerical order - The build output is always
paper.pdfin the project root - Intermediate files are stored in
build/directory - The environment uses UTF-8 encoding with Japanese locale (ja_JP.UTF-8)
- When editing LaTeX: preserve indentation and line structure for proper compilation
- The Docker image is based on
paperist/texlive-ja:latestwith additional packages (algorithms, algorithmicx)
The project uses PID files to manage watch processes and prevent multiple simultaneous instances:
.watch.pid- Tracks the watch.sh process (created by scripts/watch.sh).make.pid- Reserved for future use (currently unused)
Both files are:
- Automatically created/deleted by their respective processes
- Excluded from version control (.gitignore)
- Used to ensure only one watch process runs at a time
When make is executed:
kill_watch_processeschecks for existing.watch.pid- If found, terminates the old watch process gracefully
- New watch process starts and writes its PID to
.watch.pid - On exit (Ctrl+C), the PID file is automatically cleaned up
This prevents "Terminated" errors and ensures clean single-process operation.