From f690fe8bf831d690d5bbcca49d7e5211ac307f52 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 7 Jan 2025 09:50:37 +0100 Subject: [PATCH] First shot for using selnolig and autotype --- ...ype-for-german-ligature-correction copy.md | 15 ++++++++++++ ...elnolig-for-english-ligature-correction.md | 15 ++++++++++++ generators/app/templates/README.de.md | 4 ++++ generators/app/templates/README.en.md | 1 + generators/app/templates/main.de.tex | 24 +++++++++++++++++++ generators/app/templates/main.en.tex | 15 ++++++++++-- 6 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 docs/decisions/0008-use-autotype-for-german-ligature-correction copy.md create mode 100644 docs/decisions/0009-use-selnolig-for-english-ligature-correction.md diff --git a/docs/decisions/0008-use-autotype-for-german-ligature-correction copy.md b/docs/decisions/0008-use-autotype-for-german-ligature-correction copy.md new file mode 100644 index 00000000..799bcae1 --- /dev/null +++ b/docs/decisions/0008-use-autotype-for-german-ligature-correction copy.md @@ -0,0 +1,15 @@ +# Use `autotype` For Ligature Correction for German Documents + +## Context and Problem Statement + +Ligatures can be typeset wrongly. + +## Considered Options + +* [`autotype`](https://ctan.org/pkg/autotype) +* [`ligtype`](https://ctan.org/pkg/ligtype) +* [`selnolig`](https://ctan.org/pkg/selnolig) + +## Decision Outcome + +Chosen option: "`autotype`", because has more features and seems to be more maintained. diff --git a/docs/decisions/0009-use-selnolig-for-english-ligature-correction.md b/docs/decisions/0009-use-selnolig-for-english-ligature-correction.md new file mode 100644 index 00000000..8b728aae --- /dev/null +++ b/docs/decisions/0009-use-selnolig-for-english-ligature-correction.md @@ -0,0 +1,15 @@ +# Use `autotype` For Ligature Correction for German Documents + +## Context and Problem Statement + +Ligatures can be typeset wrongly. + +## Considered Options + +* [`autotype`](https://ctan.org/pkg/autotype) +* [`ligtype`](https://ctan.org/pkg/ligtype) +* [`selnolig`](https://ctan.org/pkg/selnolig) + +## Decision Outcome + +Chosen option: "`selnolig`", because only package supporting ligature correction for English texts (without advanced package configuration). diff --git a/generators/app/templates/README.de.md b/generators/app/templates/README.de.md index 35bb0a09..f7df4523 100644 --- a/generators/app/templates/README.de.md +++ b/generators/app/templates/README.de.md @@ -10,3 +10,7 @@ Kompiliere es mittels <% } %> + +## Features + +- Gute Worttrennung und Mikrotypographie für deutsche Texte. diff --git a/generators/app/templates/README.en.md b/generators/app/templates/README.en.md index 0991411d..dee2f479 100644 --- a/generators/app/templates/README.en.md +++ b/generators/app/templates/README.en.md @@ -108,6 +108,7 @@ Following features are enabled in this template: - <% if (githubpublish) { -%>(Optional) <% } %>LaTeX compilation using the modern lualatex compiler. <% } -%> - Ready-to-go configuration for [latexindent]. +- Proper hyphenation and microtype for English texts. <% if (howtotext) { -%> - Hints on writing an abstract and thesis by Dirk Fahland. <% } -%> diff --git a/generators/app/templates/main.de.tex b/generators/app/templates/main.de.tex index f605168c..6ed108aa 100644 --- a/generators/app/templates/main.de.tex +++ b/generators/app/templates/main.de.tex @@ -199,7 +199,19 @@ \newcommand{\hydash}{\penalty\@M-\hskip\z@skip} % Definition of "= taken from http://mirror.ctan.org/macros/latex/contrib/babel-contrib/german/ngermanb.dtx \makeatother +<% if ((latexcompiler == "lualatex") || (latexcompiler == "both")) { -%> +<% if (latexcompiler == "both") { -%> +\ifluatex +<% } -%> +% Enable correct rendering of ligatures - provided by https://ctan.org/pkg/autotype +% See ADR-0008 for alternatives +\usepackage{autotype} +<% if (latexcompiler == "both") { -%> +\fi +<% } -%> + +<% } -%> % correct bad hyphenation here \hyphenation{op-tical net-works semi-conduc-tor} <% switch (documentclass) { case "acmart": -%> @@ -246,6 +258,18 @@ <% } -%> \begin{document} +<% if ((latexcompiler == "lualatex") || (latexcompiler == "both")) { -%> +<% if (latexcompiler == "both") { -%> +\ifluatex +<% } -%> +% Enable correct rendering of ligatures - provided by https://ctan.org/pkg/autotype +% See ADR-0008 for alternatives +\autotypelangoptions{ngerman}{ligbreak} +<% if (latexcompiler == "both") { -%> +\fi +<% } -%> + +<% } -%> <% switch (documentclass) { case "lncs": -%> \title{Paper Title} diff --git a/generators/app/templates/main.en.tex b/generators/app/templates/main.en.tex index 52561665..16f631b8 100644 --- a/generators/app/templates/main.en.tex +++ b/generators/app/templates/main.en.tex @@ -221,9 +221,20 @@ % Add manual adapted hyphenation of English words % See https://ctan.org/pkg/hyphenex and https://tex.stackexchange.com/a/22892/9075 for details -% Does not work on MiKTeX, therefore disabled - issue reported at https://github.com/MiKTeX/miktex-packaging/issues/271 -% \input{ushyphex} +\input{ushyphex} +<% if ((latexcompiler == "lualatex") || (latexcompiler == "both")) { -%> +<% if (latexcompiler == "both") { -%> +\ifluatex +<% } -%> +% Enable correct rendering of ligatures - provided by https://ctan.org/pkg/selnolig +% See ADR-0009 for alternatives +\usepackage{selnolig} +<% if (latexcompiler == "both") { -%> +\fi +<% } -%> + +<% } -%> % correct bad hyphenation here \hyphenation{op-tical net-works semi-conduc-tor} <% switch (documentclass) { case "acmart": -%>