Compare commits
3 Commits
95e8a944a7
...
49b33fdbd4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49b33fdbd4 | ||
|
|
be2a389edf | ||
|
|
fbb9e400a1 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
||||||
19
.vscode/settings.json
vendored
19
.vscode/settings.json
vendored
@@ -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"
|
||||||
}
|
}
|
||||||
34
.vscode/tasks.json
vendored
Normal file
34
.vscode/tasks.json
vendored
Normal file
@@ -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": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
35
build/build-latex-smart.sh
Executable file
35
build/build-latex-smart.sh
Executable file
@@ -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 <file.tex>"
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user