Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Nov 16, 2023 3:55 pm

I'd like to display the 'Not Greater Than', 'Not Greater Than Or Equal To', 'Not Less Than' and
Not Less Than Or Equal To' symbols using LaTex formatting and office math. When I use the latex text for these symbols (\ngtr, \ngeq, \nleq and \nless), the correct symbol is not included in the document. Can you confirm this is a bug or there is additional formatting I can include?

Posts: 13
Joined: Tue Oct 03, 2023 4:45 pm

Fri Nov 17, 2023 2:23 am


Thank you for your inquiry.
I put the complete code below for your reference:
Code: Select all
            // Define an array of LaTeX math code strings
            string[] latexMathCode = {
              "{0}>={-1} \\not\\geq{10}",
              "{0}<{11} \\not\\leq{10}",

            // Create a new document object
            Document doc = new Document();

            // Add a section to the document
            Spire.Doc.Section section = doc.AddSection();

            // Create a paragraph and add text to it
            Spire.Doc.Documents.Paragraph textPara = section.AddParagraph();
            textPara.AppendText("Creating equations from LaTeX code");
            textPara.Format.HorizontalAlignment = HorizontalAlignment.Center;

            // Iterate through the LaTeX math code array
            for (int i = 0; i < latexMathCode.Length; i++)
                // Create a new OfficeMath object
                OfficeMath officeMath = new OfficeMath(doc);

                // Convert the LaTeX math code to Office Math format

                // Create a new paragraph and add the OfficeMath object to it
                Paragraph paragraph = section.AddParagraph();

                // Add a blank paragraph after each equation

            // Save the document to a file
            doc.SaveToFile(@"add.docx", FileFormat.Docx2013);

            // Dispose the document object to free resources

If you have any issue just feel free to contact us.

E-iceblue support team
User avatar

Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.Doc