Here is some python code. It includes a loop so that the code requires some formatting.
#!/usr/bin/python
#
for i in range(1):
print("Hello, World!")
If I cut&paste this into a text editor from LibreOffice itself, it works.
If I export it as an html file, and cut&paste from that, it works.
But if I export it as a PDF file then a cut&paste of that will fail, as the PDF no longer retains the information about spaces. The result is:
[parent]: python2 hw-PDF.py File "hw-PDF.py", line 3 in range(1): ^ SyntaxError: invalid syntax
I would like PDF exports to contain real spaces formatting in those document sections which are pre-formatted.
The lack of this ability means that you cannot write code sections into a PDF file and expect them to be usable for someone cut&pasting out a section of the code, which defeats the object of using a (basically) non-editable format for publishing a final work.