[LyX/master] Some more shorthands

Juergen Spitzmueller spitz at lyx.org
Wed Feb 18 13:54:25 UTC 2026


commit c44c619b3bc2e6c22c2a7c0c410941d674a4c3f7
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Feb 18 14:54:06 2026 +0100

    Some more shorthands
---
 development/FORMAT     |   6 ++
 lib/languages          | 159 +++++++++++++++++++++++++++++++++++++++++++++++++
 lib/lyx2lyx/lyx_2_6.py |  88 ++++++++++++++++++++++++++-
 src/version.h          |   4 +-
 4 files changed, 254 insertions(+), 3 deletions(-)

diff --git a/development/FORMAT b/development/FORMAT
index 45ba47d9ec..4b23733887 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -7,6 +7,12 @@ changes happened in particular if possible. A good example would be
 
 -----------------------
 
+2026-02-18 Jürgen Spitzmüller <spitz at lyx.org>
+	* Format incremented to 649:
+	  New (language-specific) SpecialChars gendermark,
+	  thinspacebreakpoint and splithyphen that are supported in some languages
+	  via babelshorthands ("x, ", and "=).
+
 2025-11-25 Jürgen Spitzmüller <spitz at lyx.org>
 	* Format incremented to 648:
 	  New (language-specific) SpecialChars extrasofthyphen
diff --git a/lib/languages b/lib/languages
index 8d45523159..0be511c73e 100644
--- a/lib/languages
+++ b/lib/languages
@@ -431,6 +431,19 @@ Language austrian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar gendermark
+	    Type	specialchar
+	    MenuString	"Gender Mark|G"
+	    Tooltip     "Gender mark that keeps hyphenation points"
+	    LyXOutput	*
+	    LatexOutput	\"x
+	    IsLetter	1
+	    PlaintextOutput *
+	    XHTMLOutput	*
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 	AltLanguage austrian-legacy
 	AltLangIfNot babel-german3
 End
@@ -498,6 +511,19 @@ Language naustrian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar gendermark
+	    Type	specialchar
+	    MenuString	"Gender Mark|G"
+	    Tooltip     "Gender mark that keeps hyphenation points"
+	    LyXOutput	*
+	    LatexOutput	\"x
+	    IsLetter	1
+	    PlaintextOutput *
+	    XHTMLOutput	*
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 	AltLanguage naustrian-legacy
 	AltLangIfNot babel-german3
 End
@@ -616,6 +642,19 @@ Language belarusian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar thinspacebreakpoint
+	    Type	formatting
+	    MenuString	"Thin Space for Initials|I"
+	    Tooltip     "Thin space that keeps predefined hyphenation possibilities"
+	    LyXOutput	0x02cc
+	    LatexOutput	"\","
+	    IsLetter	1
+	    XHTMLOutput	&#x2009;
+	    CanBreakAfter   1
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
 End
 
 # supported by polyglossia but not babel:
@@ -840,6 +879,20 @@ Language czech
 	FontEncoding	 T1|OT1
 	DateFormats      "d. MMMM yyyy|d. MMM. yyyy|d.M.yyyy"
 	LangCode         cs_CZ
+	SpecialChar splithyphen
+	    Type	specialchar
+	    MenuString	"Split Hyphen|H"
+	    Tooltip     "Hyphen that is repeated at next line when hyphenated"
+	    LyXOutput	0x2010
+	    LatexOutput	\"=
+	    IsLetter	1
+	    PlaintextOutput -
+	    XHTMLOutput	-
+	    CanBreakAfter   1
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 End
 
 Language danish
@@ -1106,6 +1159,19 @@ Language georgian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar thinspacebreakpoint
+	    Type	formatting
+	    MenuString	"Thin Space for Initials|I"
+	    Tooltip     "Thin space that keeps predefined hyphenation possibilities"
+	    LyXOutput	0x02cc
+	    LatexOutput	"\","
+	    IsLetter	1
+	    XHTMLOutput	&#x2009;
+	    CanBreakAfter   1
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
 End
 
 # german does not use a country code (due to the variety)
@@ -1166,6 +1232,19 @@ Language german
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar gendermark
+	    Type	specialchar
+	    MenuString	"Gender Mark|G"
+	    Tooltip     "Gender mark that keeps hyphenation points"
+	    LyXOutput	*
+	    LatexOutput	\"x
+	    IsLetter	1
+	    PlaintextOutput *
+	    XHTMLOutput	*
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 	AltLanguage german-legacy
 	AltLangIfNot babel-german3
 End
@@ -1234,6 +1313,19 @@ Language ngerman
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar gendermark
+	    Type	specialchar
+	    MenuString	"Gender Mark|G"
+	    Tooltip     "Gender mark that keeps hyphenation points"
+	    LyXOutput	*
+	    LatexOutput	\"x
+	    IsLetter	1
+	    PlaintextOutput *
+	    XHTMLOutput	*
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 	AltLanguage ngerman-legacy
 	AltLangIfNot babel-german3
 End
@@ -1304,6 +1396,19 @@ Language german-ch
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar gendermark
+	    Type	specialchar
+	    MenuString	"Gender Mark|G"
+	    Tooltip     "Gender mark that keeps hyphenation points"
+	    LyXOutput	*
+	    LatexOutput	\"x
+	    IsLetter	1
+	    PlaintextOutput *
+	    XHTMLOutput	*
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 	AltLanguage german-ch-legacy
 	AltLangIfNot babel-german3
 End
@@ -1373,6 +1478,19 @@ Language german-ch-old
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar gendermark
+	    Type	specialchar
+	    MenuString	"Gender Mark|G"
+	    Tooltip     "Gender mark that keeps hyphenation points"
+	    LyXOutput	*
+	    LatexOutput	\"x
+	    IsLetter	1
+	    PlaintextOutput *
+	    XHTMLOutput	*
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 	AltLanguage german-ch-old-legacy
 	AltLangIfNot babel-german3
 End
@@ -1837,6 +1955,19 @@ Language mongolian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar thinspacebreakpoint
+	    Type	formatting
+	    MenuString	"Thin Space for Initials|I"
+	    Tooltip     "Thin space that keeps predefined hyphenation possibilities"
+	    LyXOutput	0x02cc
+	    LatexOutput	"\","
+	    IsLetter	1
+	    XHTMLOutput	&#x2009;
+	    CanBreakAfter   1
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
 End
 
 Language newzealand
@@ -2012,6 +2143,20 @@ Language polish
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar splithyphen
+	    Type	specialchar
+	    MenuString	"Split Hyphen|H"
+	    Tooltip     "Hyphen that is repeated at next line when hyphenated"
+	    LyXOutput	0x2010
+	    LatexOutput	\"=
+	    IsLetter	1
+	    PlaintextOutput -
+	    XHTMLOutput	-
+	    CanBreakAfter   1
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 End
 
 Language portuguese
@@ -2265,6 +2410,20 @@ Language slovak
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar splithyphen
+	    Type	specialchar
+	    MenuString	"Split Hyphen|H"
+	    Tooltip     "Hyphen that is repeated at next line when hyphenated"
+	    LyXOutput	0x2010
+	    LatexOutput	\"=
+	    IsLetter	1
+	    PlaintextOutput -
+	    XHTMLOutput	-
+	    CanBreakAfter   1
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
 End
 
 Language slovene
diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index c34e7d14b1..8f060f6230 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -743,6 +743,90 @@ def revert_hyphen_shorthands(document):
         i += 1
         continue
 
+
+def revert_shorthands2(document):
+    "Revert SpecialChar gendermark, thinspacebreakpoint and splithyphen to ERT"
+
+    mainlang = get_value(document.header, "\\language")
+    if mainlang == "":
+        document.warning("Malformed LyX document! No \\language header found!")
+        return
+
+    langs_gendermark = [
+        "austrian",
+        "naustrian",
+        "german",
+        "ngerman",
+        "german-ch",
+        "german-ch-old"
+    ]
+    
+    langs_thinspacebreakpoint = [
+        "belarusian",
+        "georgian",
+        "mongolian"
+    ]
+
+    langs_splithyphen = [
+        "czech",
+        "polish",
+        "slovak"
+    ]
+
+    i = 0
+    while True:
+        i = find_substring(document.body, "\\SpecialChar gendermark", i)
+        if i == -1:
+            break
+        document.body[i] = document.body[i].replace("\\SpecialChar gendermark", "")
+        lang = mainlang
+        l = find_token_backwards(document.body, "\\lang", i) != -1
+        if l > 0:
+            line = document.body[l]
+            tokenend = len("\\lang ")
+            lang = line[tokenend:].strip()
+        if lang in langs_gendermark:
+            cmd = put_cmd_in_ert("\"x")
+            document.body[i + 1 : i + 1] = cmd
+        i += 1
+        continue
+
+    i = 0
+    while True:
+        i = find_substring(document.body, "\\SpecialChar thinspacebreakpoint", i)
+        if i == -1:
+            break
+        document.body[i] = document.body[i].replace("\\SpecialChar thinspacebreakpoint", "")
+        lang = mainlang
+        l = find_token_backwards(document.body, "\\lang", i) != -1
+        if l > 0:
+            line = document.body[l]
+            tokenend = len("\\lang ")
+            lang = line[tokenend:].strip()
+        if lang in langs_thinspacebreakpoint:
+            cmd = put_cmd_in_ert("\",")
+            document.body[i + 1 : i + 1] = cmd
+        i += 1
+        continue
+
+    i = 0
+    while True:
+        i = find_substring(document.body, "\\SpecialChar splithyphen", i)
+        if i == -1:
+            break
+        document.body[i] = document.body[i].replace("\\SpecialChar splithyphen", "")
+        lang = mainlang
+        l = find_token_backwards(document.body, "\\lang", i) != -1
+        if l > 0:
+            line = document.body[l]
+            tokenend = len("\\lang ")
+            lang = line[tokenend:].strip()
+        if lang in langs_splithyphen:
+            cmd = put_cmd_in_ert("\"=")
+            document.body[i + 1 : i + 1] = cmd
+        i += 1
+        continue
+
 ##
 # Conversion hub
 #
@@ -753,11 +837,13 @@ convert = [
     [645, []],
     [646, []],
     [647, [convert_textbreaks]],
-    [648, []]
+    [648, []],
+    [649, []]
 ]
 
 
 revert = [
+    [648, [revert_shorthands2]],
     [647, [revert_hyphen_shorthands]],
     [646, [revert_textbreaks]],
     [645, [revert_contextual_breaks]],
diff --git a/src/version.h b/src/version.h
index f64cd916a9..a97dda20e0 100644
--- a/src/version.h
+++ b/src/version.h
@@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 648 // spitz: shorthands
-#define LYX_FORMAT_TEX2LYX 648
+#define LYX_FORMAT_LYX 649 // spitz: more shorthands
+#define LYX_FORMAT_TEX2LYX 649
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER


More information about the lyx-cvs mailing list