I answer only now because the question crept to the top active questions due to an update.
Don’t know if you are still interested in a simple solution, but I had exactly the same concern and this is how I solved it (without dmath extension). Remember that an equation is just an object like any others.
- Insert your variable (or any equation) as a formula.
- Once you return to your main stream (in Writer after leaving Math), right-click the variable (or equation) and select
Object...
from the pop-up menu.
- Click on the
Wrap
tab. You can now set the spacing around the object. Since the variable is considered a character in the paragrah, you can adjust only the left and right spacings. Set them to 0 to get the effect of a “standard” glyph so that appended punctuations will have the traditional appearance.
- Click OK.
You are done.
If you find this answer useful, please tick its check mark at left and, why not, upvote it.
EDIT: Answer to @Zeca 's question in the comment below
Yes, this spacing can be made default. Formulas live in a frame with a style of their own: Formula. You can access this frame style in the Format
→ Styles and Formatting
panel (or F11
). Click on the middle (third) icon in the toolbar (frame styles). One of the styles is Formula. Right-click on it and select Modify...
.
If you need several different “styles” for your formulas (spacing, background colour, borders, …), create them with a right-click and New...
. To style the formula, select it and double click on the required frame style name.
Doing so (multiple formula styles), you can take advantage of the “hierarchical styles” feature: modification of a property in the “master” style automatically propagates down in the hierarchy if it is not overridden in a lower style.