From 0beb790a6a19458f3dcf1b17e7796533410c363d Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 8 Sep 2024 19:07:44 +0200 Subject: [PATCH] Handle space issue with refstyle more downstream It is not necessarily, and infers with some usages, to generally escape spaces in labels and references --- src/insets/InsetRef.cpp | 7 ++++++- src/support/lstrings.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index d2a5e72c80..29a8c52831 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -288,7 +288,12 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const os << fcmd; if (use_refstyle && use_plural) os << "[s]"; - os << '{' << label << '}'; + if (contains(label, ' ')) + // refstyle bug: labels with blanks need to be grouped + // otherwise the blanks will be gobbled + os << "{{" << label << "}}"; + else + os << '{' << label << '}'; } else if (cmd == "labelonly") { docstring const & ref = getParam("reference"); diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index 5d0c37694d..6cc99ad176 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -1237,7 +1237,7 @@ docstring const escape(docstring const & lab) for (char_type const c : lab) { if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$' || c == '}' || c == '{' || c == ']' || c == '[' || c == '&' - || c == '\\' || c == ' ') // refstyle doesn't support spaces + || c == '\\') { // Although char_type is a 32 bit type we know that // UCS4 occupies only 21 bits, so we don't need to