Can I add some predefined text before and after a paragraph automatically

Can I create a style of text that automatically introduce me some characters before and after text paragraph?
For example: I want to define a paragraph to put triple quotes automatically before and after every paragraph. I type with this style I go anywhere and on document it appears “”“I go anywhere”"" automatically.
It can be possible in LibreOffice?

As a workaround:
Find: ^(.*)$
Replace: text before $1 text after
[x] Current selection only
[x] Regular expressions

You can combine a style that you create, intended to have the triple quotes, and @LeroyG 's Find and Replace.

  1. Create your unique style and write your text without any quotes around the unique paragraph style
  2. When complete open Find and Replace dialogue and tick Paragraph styles box, make sure current selection is unticked. Select your uniquely named style in the Find box and click the button Find All
  3. Do not click in the text, it will unselect your selection
  4. Untick the Paragraph styles box and enter LeroyG’s suggestions, Find ^(.*)$, Replace """$1""", tick Current selection only and Regular expressions then click Replace All button

Note that you could use " around your unique style and replace with just two “” but there might be complications between straight double quotes and curly ones.

This is partly possible.

You can prefix your paragraph with some sequence of characters by abusing the list feature. There is no way to suffix a paragraph.

The freedom to choose a prefix is rather limited and imperfect. If you want to have a try:

  • define a custom list style
    The Number: attribute must be set to *, †, ‡, §, **, ††, … and separators Before and After to ".
    This means your prefix will be "*" and not a triple quote. This may be acceptable if you add a note to your book to mention your choice for this unusual “delimiter”.

  • create a custom paragraph style
    Assigning it your custom list style in the Outline & List tab.

  • using all this
    When you want your prefixed paragraph, give it your custom paragraph style. It creates a list item with auto-numbering. To avoid changing the * “number” in consecutive items, always Format>Lists>Restart Numbering when typing your items. You can assign this command a keyboard shortcut to make entry more user-friendly.

A note of warning: if your intent is to type some kind of Python code (or other language where triple quotes delimit multiline strings), you can’t use this trick because there is no way 1) to have """ as a prefix, and 2) to suffix any paragraph.

Thank you very much, but I am waiting for implementation a more practicable solution by developers for it, what you say it’s ok, but it cannot be put in practice.

You can create an AutoText with the predefined text and a blank paragraph (or a space to insert text) in the middle. You can create the AutoText with the styles you need or apply the styles later.

1 Like