Equation editor variable with underscore in name

How do I represent a variable which uses an “_” in it’s name?

Example: i_sar_data = 3967

If I use the “_”, equation writer thinks the following characters are subscript.

If I use i"“sar”"data, the variable name doesn’t look right with the added spaces between the other characters and the “_”.

Enclose in double quotes, i.e. "i_sar_data" = 3967. If you also want to preserve the italic attribute of the variable name (as enclosing in quotes switches that off) then prefix it such, so

italic "i_sar_data" = 3967

iˍsarˍdata = 3967 (with Unicode modifier letter low macron: U+02CD)

Not a preferred option: i underline{ }sar underline{ }data = 3967

Tested with LibreOffice 6.3.6.2 (x86); OS: Windows 6.1.

EDIT: I compare the four proposals, not in order (ajlittoz’s one with spacing set to 0%). At some zoom level italicized underscore is seen thinner.

image description


Add Answer is reserved for solutions.

Press edit below your question if you want to add more information; also can comment an answer.

Check the mark (Correct answer mark) to the left of the answer that solves your question.

That underline{ } is an underlined EM SPACE though, not an underscore, which looks odd.

The Math Guide gives the solution: just enclose the offending characters in double quotes ".

Your formula is therefore i"_"sar"_"data = 3967. This preserves the styling for i, sat and data which are still considered as variables. Since the underscore is a simple horizontal stroke, it makes no difference whether it is italics or not.

You may notice a slightly wider space between the letters and the underscore compared to the inter-letter spacing. If you don’t like it, you can Format>Spacing and set Spacing to 0%. This tuning is valid only for the currently edited formula and won’t affect existing or future formulae. Since it has effect on the whole formula, you must manually force spacing between the elements, like in:

i"_"sar"_"data ~ = ~ 3967

This is more sophisticated than @erAck’s solution and preserves the formatting defined in Format>Fonts.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

@erAck, Yes, I tried with spaces of different widths, none convinced me. I think your answer is simpler, that’s why I upvoted it. Regards.

If I use i"_"sar"_"data, the variable name doesn’t look right with the added spaces between the other characters and the “_”.

Try nospace {i"_"sar"_"data} = 3967