diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3eeabc3..d62f732 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ "dockerComposeFile": "docker-compose.yml", "service": "teamtex", "workspaceFolder": "/workspace", - "updateContentCommand": "latexmk -pdf -outdir=build main.tex", + "updateContentCommand": "mkdir -p build && latexmk -pdf -outdir=build -interaction=nonstopmode main.tex || true", "customizations": { "vscode": { "extensions": [ @@ -21,4 +21,4 @@ } } } -} +} \ No newline at end of file diff --git a/.github/workflows/latex-check.yml b/.github/workflows/latex-check.yml index c02f852..4df926d 100644 --- a/.github/workflows/latex-check.yml +++ b/.github/workflows/latex-check.yml @@ -19,6 +19,7 @@ jobs: uses: xu-cheng/latex-action@v3 with: root_file: main.tex + compiler: latexmk args: -pdf -file-line-error -halt-on-error -interaction=nonstopmode -outdir=build - name: Verify build artifacts diff --git a/.latexmkrc b/.latexmkrc new file mode 100644 index 0000000..95c2f38 --- /dev/null +++ b/.latexmkrc @@ -0,0 +1,3 @@ +$pdflatex = 'pdflatex -interaction=nonstopmode -file-line-error -synctex=1 %O %S'; +$force_mode = 1; +$bibtex = 'bibtex %O %B'; diff --git a/.vscode/settings.json b/.vscode/settings.json index 905226b..132f393 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "latex-workshop.latex.outDir": "%DIR%/build", "latex-workshop.latex.autoClean.run": "onBuilt", + "latex-workshop.latex.autoBuild.run": "onSave", + "latex-workshop.latex.recipe.default": "lastUsed", "latex-workshop.view.pdf.viewer": "tab", "latex-workshop.latex.magic.args": [ "-output-directory=%DIR%/build", @@ -9,9 +11,34 @@ "files.exclude": { ".devcontainer": true, ".github": true, + ".latexmkrc": true, "docs": true, "LICENSE": true }, + "latex-workshop.latex.recipes": [ + { + "name": "latexmk", + "tools": [ + "latexmk" + ] + } + ], + "latex-workshop.latex.tools": [ + { + "name": "latexmk", + "command": "latexmk", + "args": [ + "-f", + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "-pdf", + "-outdir=%OUTDIR%", + "%DOC%" + ], + "env": {} + } + ], "editor.formatOnSave": true, "ltex.language": "en-US", "ltex.enabled": false diff --git a/README.md b/README.md index 70878b5..331c8ad 100644 --- a/README.md +++ b/README.md @@ -69,11 +69,12 @@ The project is specifically configured to keep the root directory clean by routi If you prefer the command line, use `latexmk` directly: ```bash -# Compile +# Full Compile (handles bibliography, multiple passes automatically) latexmk -pdf -outdir=build main.tex # Clean -latexmk -c -outdir=build main.tex && rm -rf build/ +latexmk -C -outdir=build +rm -rf build/ ``` --- diff --git a/docs/usage-details.md b/docs/usage-details.md index af3e8c4..98aa02a 100644 --- a/docs/usage-details.md +++ b/docs/usage-details.md @@ -18,6 +18,11 @@ Instead of cloning or forking, you can use TeamTex as a blueprint to mint comple - **GitHub Copilot:** Supported out-of-the-box. - **Grammar Options:** Enable LTeX by editing `.devcontainer/devcontainer.json` and uncommenting `valentjn.vscode-ltex`. +- **SyncTeX (Code <-> PDF Navigation)** + The environment is already configured to synchronize the code with the generated PDF: + - **From PDF to Code (Inverse Search):** Hold `Ctrl` (or `Cmd` on Mac) and click on any text in the PDF viewer to jump straight to the source code. + - **From Code to PDF (Forward Search):** Place your cursor in the `main.tex` code and press `Ctrl+Alt+J` to jump to the corresponding paragraph in the PDF. + --- ## Important Note on Docker Image @@ -49,7 +54,7 @@ If you rename your main file (e.g., `thesis.tex`): 1. **Automation:** Update `.devcontainer/devcontainer.json` (change `main.tex` in `updateContentCommand`). 2. **VS Code:** If needed, update `.vscode/settings.json`. -3. **Manual:** Run `latexmk -pdf -outdir=build thesis.tex`. +3. **Manual:** Run `mkdir -p build && pdflatex -interaction=nonstopmode -output-directory=build thesis.tex`. ### Missing Folders (.vscode, .devcontainer, .github, docs) diff --git a/export_source.sh b/export_source.sh index 73c8432..2764b02 100644 --- a/export_source.sh +++ b/export_source.sh @@ -20,15 +20,16 @@ rm -f "$OUTPUT_NAME" # Create the zip with exclusions zip -r "$OUTPUT_NAME" . \ - -x "build/*" \ - -x ".git/*" \ - -x ".vscode/*" \ -x ".devcontainer/*" \ - -x ".github/*" \ + -x ".git/*" \ -x ".gitignore" \ + -x ".github/*" \ + -x ".latexmkrc" \ + -x ".vscode/*" \ + -x "build/*" \ -x "docs/*" \ - -x "README.md" \ + -x "export_source.sh" \ -x "LICENSE" \ - -x "export_source.sh" + -x "README.md" echo "Done! You can now download '$OUTPUT_NAME'."