From 0df5a0a64c7a0f4e26d44f640e9dfc58f0d88354 Mon Sep 17 00:00:00 2001 From: Pedro Cabral Date: Sat, 21 Feb 2026 00:15:32 +0100 Subject: [PATCH 1/3] ignoring .DS_Store --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store -- 2.49.1 From c3cbc6140622b392dfb6d095224ba31857b3e9c4 Mon Sep 17 00:00:00 2001 From: Pedro Cabral Date: Sat, 21 Feb 2026 00:15:52 +0100 Subject: [PATCH 2/3] added smart build --- .vscode/settings.json | 19 ++++++++++++++++++- build/build-latex-smart.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100755 build/build-latex-smart.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index d730f59..4e0293b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,20 @@ { - "latex-workshop.latex.recipe.default": "latexmk (xelatex)" + "latex-workshop.latex.recipes": [ + { + "name": "Smart LaTeX Build", + "tools": ["smart-build"] + } + ], + "latex-workshop.latex.tools": [ + { + "name": "smart-build", + "command": "bash", + "args": [ + "%WORKSPACE_FOLDER%/build/build-latex-smart.sh", + "%DOC%" + ] + } + ], + "latex-workshop.latex.recipe.default": "Smart LaTeX Build", + "latex-workshop.formatting.latex": "latexindent" } diff --git a/build/build-latex-smart.sh b/build/build-latex-smart.sh new file mode 100755 index 0000000..aaf9f79 --- /dev/null +++ b/build/build-latex-smart.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -euo pipefail + +# Color definitions +BOLD='\033[1m' +RED='\033[31m' +BLUE='\033[34m' +RESET='\033[0m' + +# Ensure a file parameter is passed +if [[ $# -lt 1 ]]; then + echo -e "${BOLD}${RED}Error${RESET}${RED}: No .tex file provided.${RESET}" + echo "Usage: $0 " + exit 1 +fi + +FILE="$1" + +# append .tex file extension, iff not already passed +[[ "$FILE" != *.tex ]] && FILE="${FILE}.tex" + +# Check that the file exists +if [[ ! -f "$FILE" ]]; then + echo -e "${BOLD}${RED}Error${RESET}${RED}: File '$FILE' not found.${RESET}" + exit 1 +fi + +# Detect active \usepackage{fontspec} (ignore commented lines) +if grep -Eq '^[^%]*\\usepackage\{fontspec\}' "$FILE"; then + echo -e "${BLUE}Detected fontspec → Using XeLaTeX${RESET}" + xelatex -synctex=1 -interaction=nonstopmode -file-line-error "$FILE" +else + echo -e "${BLUE}No active fontspec → Using pdfLaTeX${RESET}" + pdflatex -synctex=1 -interaction=nonstopmode -file-line-error "$FILE" +fi -- 2.49.1 From 2de6dccfa8fa662eef7f1fb2bf7940595d3fe10c Mon Sep 17 00:00:00 2001 From: Pedro Cabral Date: Sat, 21 Feb 2026 00:16:06 +0100 Subject: [PATCH 3/3] added tasks to execute manually --- .vscode/tasks.json | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..3da7606 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,34 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build Current File (XeLaTeX)", + "type": "shell", + "command": "xelatex", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "${file}" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "Build Current File (pdfLaTeX)", + "type": "shell", + "command": "pdflatex", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "${file}" + ], + "group": "build", + "problemMatcher": [] + } + ] +} -- 2.49.1