How to insert an autoincremented number, displayed in the left margin?

 1  Something like this:
    Here a line,
 2  and an other line. And foobar
 3  etc. etc.

Here, would be the inserting points of the numbers. But I want to see the numbers displayed in the margin.

Unless I misinterpret your specification, what you want is called a numbered list. There are two ways of creating one:

  • the quick’n’dirty methods (only for test and trials)

    Click on the Toggle numbered list toolbar button or F12 or Format>Lists>Numbered list and type your text. When you hit Return, another list item is created. If you want an unnumbered entry with the same indent as numbered entry, use Format>Lists>Insert unumbered entry instead of Return.

    To return to normal paragraph mode, hit F12 or the toolbar button to disable the mode.

    When you create another list further down, numbering restarts at one. To make it a continuation of the previous one, put the cursor in the item(s) and Format>Lists>``Continue previous numbering`.

    Similarly, if you want to break a list into two independent lists, put hte cursor into the future first item and Format>Lists>Restart numbering.

As you can see, this is not user-friendly and it is also direct formatting which causes trouble when you try to modify the layout.

  • the “structured” method

    This requires the use of paragraph styles dedicated to your lists. I suggest built-in List 1 and *List 1 Cont.". The first will be used for numbered items, the second for unuumbered items within the list.

    First, customise List 1: right-click on the name in the style side-pane (F11) and Modify. Go to Outline & Numbering tab and select Numbering 123 for Numbering style. Click on Edit style. In the Position tab, note the value of *Indent at. Close. Push OK` for List 1.

    Right-click on *List 1 Cont.and go toIndents & Spacingtab. In *Before text*, set the value you noted for the indent. PushOK`.

    You are ready to enter your lists. Before or while typing your first list item, select List 1 from the paragraph style drop-down menu in the toolbar. Your paragraphs will be part of the list. If you need an unnumbered entry, style the item with List 1 Cont. Don’t forget to restyle List 1 to add a new numbered item.

    To exit from the list, style the paragraph as Text Body.

    In this method, you have a single list throughout the document, no matter intervening paragraphs. To have a new independent list, put the cursor in the new first item and Format>Lists>Restart numbering only here (no need to change formatting in other items).

Through a smart use of style properties, many layouts are possible for the list. And everything is controllable from a single location (the styles definitions) with an immediate effect on all occurrences.

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!

Sorry, I cannot upvote, I don’t have 5 points yet!
Your response is not exactly what I was looking for but it is a very helpful explanation, and it will be a workaround for my problem.