Inserting newlines in user fields/variables

Is it possible to insert a line break in a user field or variable value? If so, how? When inserting or editing a user field or variable, the “Value” entry field seems to be single line entry only.

I’ve tried:

  • holding various key modifiers when hitting the “return” key with focus on the “Value” entry, but the modifiers make no difference (LO performs the same action as if no modifiers were held, the same as clicking the primary button)
  • slash escapes ("\n"), but this is displayed as-is, rather than getting interpreted
  • copy-and-pasting hard and soft line breaks from LO, and newlines from other applications)

While I could create separate user fields/variables for each line and insert a line break each time I insert all lines, this would be messy in both concept and practice.

Software info:

  • OS X 10.14
  • LibreOffice 7.1.6, 7.2.2

“While I could create separate user fields/variables for each line and insert a line break each time I insert all lines,”
My tip - if you want fix position line breaks in the long text content - : do it.

Another tip: the LibreOffice can break the long texts of the User fields into more than one line automatically. Use this feature if it not matter where the text will be breaked…
Line breaked User field.odt (13.9 KB)

Fields are meant to insert short sequences of characters within a paragraph. One implicit assumption about this sequence is it is made of raw characters without any formatting, meaning it will receive its formatting from the style(s) in effect at the point of insertion.

This is severe limitation as very often we need to enhance a part of field content. Think, for example, of cross-references to headings where one or several words may have been emphasised with a character style. The character style or direct-formatting is wiped out by the insertion process.

A line break or paragraph break (also page break) is not a character. It is formatting information and the key press (Shift+Enter or Enter) is translated into internal encoding when typed. Consequently, this formatting request is never forwarded to field contents.

And I suppose that a filter scans data pasted into the Value: box for fields. Anyway a filter is necessary because pasted data may be a fully formatted sequence and this needs to be removed.

As a consequence, I don’t think you can add breaks in a field value by any trick.

Remember that field are not supposed to extend beyond a paragraph, beginning with captures (Set reference will be unconditionally terminated at first paragraph mark).

You didn’t describe the goal of your “lengthy” field insertion. Have you tried Insert>Text from File? It requires the use of external files, which is not user-friendly, but circumvents the limitation of fields at the cost of some reliability.