diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-03 18:59:02 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-03 18:59:02 +0200 |
commit | 86de16dd27c67732a0e163c46c23314fcddfce5f (patch) | |
tree | 5f8a9e5a5d1c2e7a6daa9aa3fa17d56d6ee8296d /templates | |
parent | feat(common/init): Support template specific drop-in scripts (diff) | |
download | flake-templates-86de16dd27c67732a0e163c46c23314fcddfce5f.tar.gz flake-templates-86de16dd27c67732a0e163c46c23314fcddfce5f.zip |
feat(templates/latex/academia): Support changing the language
Diffstat (limited to 'templates')
-rw-r--r-- | templates/latex/academia/%INIT_APPLICATION_NAME.tex | 2 | ||||
-rw-r--r-- | templates/latex/academia/headers/preamble.tex | 9 | ||||
-rwxr-xr-x | templates/latex/academia/init.local | 28 | ||||
-rw-r--r-- | templates/latex/academia/lpm.toml | 5 |
4 files changed, 35 insertions, 9 deletions
diff --git a/templates/latex/academia/%INIT_APPLICATION_NAME.tex b/templates/latex/academia/%INIT_APPLICATION_NAME.tex index e7934fe..5484bc6 100644 --- a/templates/latex/academia/%INIT_APPLICATION_NAME.tex +++ b/templates/latex/academia/%INIT_APPLICATION_NAME.tex @@ -1,4 +1,4 @@ -% LTeX: language=en-GB +% LTeX: language=%INIT_LANGUAGE %\documentclass[a4paper, 12pt, nosolutions]{report} % \documentclass[a4paper, 12pt, onecolumn]{report} \documentclass[a4paper, 12pt, twocolumn]{scrartcl} diff --git a/templates/latex/academia/headers/preamble.tex b/templates/latex/academia/headers/preamble.tex index bc8aa8a..d87943d 100644 --- a/templates/latex/academia/headers/preamble.tex +++ b/templates/latex/academia/headers/preamble.tex @@ -9,8 +9,7 @@ % \usepackage{textcomp} % support for yen and so on, not needed since latex2e(2020) % references -\usepackage[british]{babel} % For English language support, with reformed orthography! -% \usepackage[brithish]{babel} % For English language support, with reformed orthography! +\usepackage[%INIT_BABLE_LANGUAGE]{babel} % For English language support, with reformed orthography! \usepackage{csquotes} % required by biblatex % \usepackage{biber} % required by biblatex @@ -35,7 +34,7 @@ % \bibliography{res/reference} % Set the location of the references % dates, time -\usepackage[de-DE, showdow]{datetime2} % make handling dates easier +\usepackage[%INIT_DATE_TIME_LANGUAGE, showdow]{datetime2} % make handling dates easier % index % \usepackage{index} % Helps to create an index TODO compare with other such packages @@ -49,7 +48,7 @@ \usepackage{mathrsfs} % support for the RSFS fonts (through \mathscr command) \usepackage{cancel} % allows to cancel a part in math mode, for example to shorten a term \usepackage{bm} % bold mode in math, but better than \boldsymbol command from ams. \bm -\usepackage[locale = DE]{siunitx} % For easy unit representation +\usepackage[locale = %INIT_SIUNITX_LANGUAGE]{siunitx} % For easy unit representation \sisetup{per-mode = fraction} \usepackage[version=4]{mhchem} % for \ce command @@ -89,7 +88,7 @@ % links % \usepackage[hidelinks]{hyperref} % Links in the pdf \usepackage[nospace]{varioref} -\usepackage[pdflang=de-DE]{hyperref} +\usepackage[pdflang=%INIT_DATE_TIME_LANGUAGE]{hyperref} % \hypersetup{ % colorlinks, % linkcolor={black}, diff --git a/templates/latex/academia/init.local b/templates/latex/academia/init.local new file mode 100755 index 0000000..ae57756 --- /dev/null +++ b/templates/latex/academia/init.local @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +prompt LANGUAGE "The language to use in the latex documents" "en_GB" + +bable_language="" +case "$LANGUAGE" in +"en_GB") + bable_language="british" + ;; +en_*) + bable_language="english" + ;; +de_DE | de_*) + bable_language="ngerman" + ;; + +*) + echo "'$LANGUAGE' is not yet recognized by the init.local script! Please open an issue." 1>&2 + echo "set 'BABLE_LANGUAGE' to 'NOT_YET_RECOGNIZED_PLEASE_REPLACE' to help you find instances of the variable use." 1>&2 + bable_language="NOT_YET_RECOGNIZED_PLEASE_REPLACE" + ;; +esac + +prompt BABLE_LANGUAGE "The language to use for the bable package" "$bable_language" "dont_ask" +prompt DATE_TIME_LANGUAGE "The language to use for the datetime2 package" "$(echo "$LANGUAGE" | sed 's/_/-/g')" "dont_ask" +prompt SIUNITX_LANGUAGE "The language to use for the siunitx package" "$(echo "$LANGUAGE" | sed 's/\(\w\w\).*/\U\1/')" "dont_ask" + +# vim: ft=sh diff --git a/templates/latex/academia/lpm.toml b/templates/latex/academia/lpm.toml index 0925886..d72f80f 100644 --- a/templates/latex/academia/lpm.toml +++ b/templates/latex/academia/lpm.toml @@ -3,15 +3,14 @@ main_file = "%INIT_APPLICATION_NAME.tex" [templates] section = ''' %! TEX root = ../../../%INIT_APPLICATION_NAME.tex -% LTeX: language=en-GB +% LTeX: language=%INIT_LANGUAGE \section{REPLACMENT_SECTION_TITLE} % DATE -This is some text ''' chapter = ''' %! TEX root = ../../%INIT_APPLICATION_NAME.tex -% LTeX: language=en-GB +% LTeX: language=%INIT_LANGUAGE \chapter{REPLACEMENT_CHAPTER} ''' |