Ask Your Question

Source code line endings in Writer [closed]

asked 2014-03-17 17:56:46 +0200

notinlist gravatar image

updated 2015-09-27 18:52:01 +0200

Alex Kemp gravatar image

I have a paragraph style called "Source". It has no spacing above and below, and it uses a mono-space font and gray background. I want to paste text with some longer lines into my document and it would be important to see in print where the "enters" (paragraph endings, option A) or the automatic line wrappings (option B) are, so the reader won't get confused on it.

Is there any setting for A or B? Workarounds?

I don't want to format anything by hand because it would be fragile and hard to maintain. Tried numbering and got a problematic use case: When reading the document on computer it makes hard to copy sources from the document, because the numbering gets copied too.

EDIT: Increasing the spacing between paragraphs is not good enough. Not obvious enough. Looks weird and consumes lot of space in the general case when there are no long lines.

(LibreOffice Writer English; Windows 7 64bit English; Hungarian and English texts)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-20 16:03:51.623707



How about huge indents or smart background images? See the attached document. example.odt

Edit: sorry, now it should be the right one.

mahfiaz gravatar imagemahfiaz ( 2014-03-31 16:36:40 +0200 )edit

I think you inserted a wrong example. It is a table not a text document and there is no source code in there.

notinlist gravatar imagenotinlist ( 2014-03-31 23:52:26 +0200 )edit

Of course the background image could be on the left as well, I just thought I might like it more on the right, but who knows.

mahfiaz gravatar imagemahfiaz ( 2014-04-01 15:51:37 +0200 )edit

Cannot upvote, at least 5 points is required. I will be back some day.

notinlist gravatar imagenotinlist ( 2014-04-03 16:13:14 +0200 )edit

Glad it helped. You should be able to mark it as accepted answer. Also have some points :)

mahfiaz gravatar imagemahfiaz ( 2014-04-03 22:47:13 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-04-01 00:00:00 +0200

notinlist gravatar image

A also asked this at SuperUser [1], and I had the reputation to set up a bounty there. There were good ideas.

  • Set a vertical border on the left and turn on "Merge with next paragraph" at "Borders" tab. So every logical row will have one vertical line on the left side. I consider this the best
  • Set "Befor text" to x cm and "First line" to -x cm.
  • Add space before and after the paragraph so if a line breaks it will be nearer to its beginning than the next line.
  • There was also an idea to use macro which I would not start learning just for this as it is not necessary now.


edit flag offensive delete link more


1) I don't think this would work without space between paragraphs

2) that would work, also included in my example

3) this is reversed version of 2), but would not work at all with indented lines (nicely formatted code)

mahfiaz gravatar imagemahfiaz ( 2014-04-01 15:50:23 +0200 )edit

(1) True. A minimal margin is needed. But margins as final solution (3) is not good, because they are not obvious enough.

notinlist gravatar imagenotinlist ( 2014-04-03 16:18:40 +0200 )edit

Question Tools

1 follower


Asked: 2014-03-17 17:56:46 +0200

Seen: 277 times

Last updated: Apr 01 '14