commit 8d80b3ca3bc4fc4a96feb4f2513464465640f371
Author: Enrico Forestieri <[email protected]>
Date:   Thu May 1 12:44:08 2025 +0200

    Remove spaces after '%' when input is for maxima
    
    Maxima prefixes with the %-sign many mathematical constants.
    LyX can do this only for \pi and not for the imaginary unit 'i'
    or the Euler's number 'e' because there is no way to distinguish
    such constants from mere variables. In mathed one can prefix
    those constants with a %-sign but LyX adds a space after it,
    preventing Maxima from recognizing them.
    
    (cherry picked from commit 4ce2a0c07c9e5cfb9955abedee064236585ea326)
---
 src/mathed/MathExtern.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
index ba5405a812..e8c1f4134a 100644
--- a/src/mathed/MathExtern.cpp
+++ b/src/mathed/MathExtern.cpp
@@ -1123,6 +1123,10 @@ namespace {
                int preplen = comm_left.length();
                int headlen = header.length();
 
+               // remove spaces after '%' sign
+               while (expr.find(from_ascii("% ")) != docstring::npos)
+                   expr = subst(expr, from_ascii("% "), from_ascii("%"));
+
                string out;
                for (int i = 0; i < 100; ++i) { // at most 100 attempts
                        // try to fix missing '*' the hard way
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to