Forum Discussion

MathGeoffrey's avatar
MathGeoffrey
Copper Contributor
Jul 04, 2024

Microsoft Word - Getting rid of unused fields in equations (small dotted squares)

Dear All,

I have several Word documents containing equations, and I did not use all the proposed fields. For example, an operation can have an upper limit and a lower limit, and sometimes I don't need both. The fields I didn't need, I left them blank, so they show a small dotted square in Word.

 

Unfortuntely, the PDF and the printed version still shows those empty squares.

 

Is there any way, without editing each of my equations (😰), to get rid of all those empty squares when I export my file to a PDF, so that they don't show when printed?

 

Many thanks!

  • ChrisWilkinson's avatar
    ChrisWilkinson
    Copper Contributor
    From aother post I've seen this seems to be a feature/bug introduced around April 2024 "Placeholder boxes in Word equations are displaying when printed or converted to PDF when they did not used to. How do I fix this?" I agree its REALLY annoying, and I don't know why they wouldn't give you the option of turing this feature on or off. I can't imagine why you would want the outline of an empty box to appear in an equation? I've given feedback in word - I suggest you do to. The only workaround I've found is a manual equaiton by equation fix by inserting a space - or you might be able to right click on the equation and hide the superscipts.

    https://answers.microsoft.com/en-us/msoffice/forum/all/placeholder-boxes-in-word-equations-are-displaying/58b5caa3-66a9-4ace-aff2-dc5cab26190c

    https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-remove-empty-boxes-in-ms-word-equations-mac/8ff97ef9-ea45-4f34-b413-9a5074b2a1d4#:~:text=If%20you%20want%20to%20remove,Space%22%20when%20selecting%20the%20box.
  • MathGeoffrey 

     

    You may consider "Find and Replace" feature, Adjust Equation options, use a Macro like below:

     

    Sub RemoveEmptyFields()
    Dim eq As OMath
    For Each eq In ActiveDocument.OMaths
    If eq.Range.Text = "" Then
    eq.Range.Delete
    End If
    Next eq
    End Sub

    • ChrisWilkinson's avatar
      ChrisWilkinson
      Copper Contributor

      Kidd_Ip thanks - will give that a try. It will certainly be annoying to have to manually edit each equation.  Sometimes I use boxes as they create a bit of space in the equation to help readability, however I guess we could change eq.Range.Delete in the code below to "eq.Range = "  " 

      • MathGeoffrey's avatar
        MathGeoffrey
        Copper Contributor

        ChrisWilkinson Kidd_Ip 

        I'm trying to have a working macro, unfortunately without success yet.

        Equations are indeed detected, if I display them I see their fields (all in 1 MsgBox).

        Now, the eq itself will not be "empty", some of of the eq fields might be.

        I cannot find a way to go through each field of each equation, and then delete (or assign " ") to each empty field.

         

        Your opinion and help on this would be most welcome!

         

        Thank you!

         

        Sub SearchEmptyFields()
        Dim eq As OMath
        
        'Trying to define a range to go through eq fields
        Dim r As Range
        
        For Each eq In ActiveDocument.OMaths
            'This displays all fields of the current eq
            MsgBox ("Found: " & eq.Range.Text)
            'Trying to get through each field of the current eq... without success
            'For Each r In eq.Rang."element???"
            '    MsgBox ("Range: " & eq.Range.element.Text)
            '   Do a "delete" or put field value to " "
            'Next r
            Exit Sub
        Next eq

Resources