[Issue] Cross-reference to line numbers
-
Mr. Harrison
- Posts: 6
- Joined: Mon Sep 10, 2018 10:37 am
[Issue] Cross-reference to line numbers
First post and a question, naturally.
I am writing a book in which I would like to reference line numbers in notes at the end of each chapter. Posts from several years ago suggest that this is not possible without inserting the numbers manually, and looking around the settings seems to confirm that this is still the case.
Is there any way to automatically reference line numbers elsewhere in the same document? Is there a feasible workaround? A Macro? The document is very long and I would not like to have to edit all of the line number references manually should the text change.
If this is not possible - and this is probably not the place to ask - are members aware of any other program in which this can be achieved?
Many thanks
I am writing a book in which I would like to reference line numbers in notes at the end of each chapter. Posts from several years ago suggest that this is not possible without inserting the numbers manually, and looking around the settings seems to confirm that this is still the case.
Is there any way to automatically reference line numbers elsewhere in the same document? Is there a feasible workaround? A Macro? The document is very long and I would not like to have to edit all of the line number references manually should the text change.
If this is not possible - and this is probably not the place to ask - are members aware of any other program in which this can be achieved?
Many thanks
Last edited by MrProgrammer on Sat Jun 29, 2024 3:58 pm, edited 1 time in total.
Reason: Tag as issue -- MrProgrammer, forum moderator
Reason: Tag as issue -- MrProgrammer, forum moderator
OpenOffice 4.1.2 on Windows 10
Re: Cross-reference to line numbers
Use bookmarks.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Cross-reference to line numbers
To do this using the line numbers will need a macro. A quick search threw up the following, which may give you some useful information for your macro
Search by line number
I think there is also some information in
Andrew Pitonyak's books on OO macro programming
Search by line number
I think there is also some information in
Andrew Pitonyak's books on OO macro programming
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
-
Mr. Harrison
- Posts: 6
- Joined: Mon Sep 10, 2018 10:37 am
Re: Cross-reference to line numbers
Thanks for the replies. Bookmarks almost do what is required except that cross-references to them cannot automatically be made to their line numbers, as far as I can tell.
So it seems that, as mentioned, I need to write a macro, which I don't know how to do and don't really have time to investigate at the moment as I need to get this book done!
I may fall back on footnotes but I wanted to avoid them as they clutter up the text and distract the reader.
Being able to reference line numbers seems like a functionality that would be very useful though.
So it seems that, as mentioned, I need to write a macro, which I don't know how to do and don't really have time to investigate at the moment as I need to get this book done!
I may fall back on footnotes but I wanted to avoid them as they clutter up the text and distract the reader.
Being able to reference line numbers seems like a functionality that would be very useful though.
OpenOffice 4.1.2 on Windows 10
Re: Cross-reference to line numbers
I only use footnotes for something that is relevant to the understanding of the text - typically translation of a foreign phrase. For all other notes I use Endnotes; which can be quite extensive, in a way that, if it were a footnote, would interfere with the flow of the text.
Note that you can place endnotes at end of Section (if you use OO Sections), or at end of text.
Placing each Chapter in an OO Section allows one to put endnotes at end of Chapter.
Note that you can place endnotes at end of Section (if you use OO Sections), or at end of text.
Placing each Chapter in an OO Section allows one to put endnotes at end of Chapter.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
-
Mr. Harrison
- Posts: 6
- Joined: Mon Sep 10, 2018 10:37 am
Re: Cross-reference to line numbers
The book is a sort of 'reader', intended for language students. The use of line number references is common in these kind of books, where notes can be extensive. The use of line number references has the advantage that the reader is not distracted all the time by superscript numbers littering the text, which they naturally want to look up, distracting them from the text and the target language. With line number notes, if the reader doesn't understand something they can refer to the notes at the end of the chapter or page and see if there is a note for that line. It is also useful for verse.
Perhaps something for the developers to consider.
Perhaps something for the developers to consider.
OpenOffice 4.1.2 on Windows 10
Re: Cross-reference to line numbers
Given the developers don't visit here, they need to be made aware of your proposal through the appropriate channels - see [Tutorial] Reporting bugs or suggestions
Slackware 15 (current) 64 bit
Apache OpenOffice 4.1.16
LibreOffice 26.2.3.2; SlackBuild for 26.2.3 by Eric Hameleers
---------------
I hate this damn computer, I wish that I could sell it.
It won't do what I want it to, Only what I tell it.
Apache OpenOffice 4.1.16
LibreOffice 26.2.3.2; SlackBuild for 26.2.3 by Eric Hameleers
---------------
I hate this damn computer, I wish that I could sell it.
It won't do what I want it to, Only what I tell it.
Re: Cross-reference to line numbers
I’m in the same boat as OP Mr. Harrison. I am writing a Norwegian language course in the spirit of Hans H. Ørberg’s Lingua Latīna per sē illūstrāta. In the end of his book, he has a glossary with references to the line number of each word’s first occurrence. I find this very helpful and want to do the same thing in my course, but have found it necessary to hard-type these as per now. A way to cross-reference line numbers would be very useful.Mr. Harrison wrote: ↑Mon Sep 10, 2018 5:17 pm Thanks for the replies. Bookmarks almost do what is required except that cross-references to them cannot automatically be made to their line numbers, as far as I can tell.
So it seems that, as mentioned, I need to write a macro, which I don't know how to do and don't really have time to investigate at the moment as I need to get this book done!
I may fall back on footnotes but I wanted to avoid them as they clutter up the text and distract the reader.
Being able to reference line numbers seems like a functionality that would be very useful though.
LibreOffice 7.6.7.2 (X86_64) on Windows 10.0 (19045)
- Hagar Delest
- Moderator
- Posts: 33633
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: Cross-reference to line numbers
As said:
robleyd wrote: ↑Tue Sep 11, 2018 1:03 am Given the developers don't visit here, they need to be made aware of your proposal through the appropriate channels - see [Tutorial] Reporting bugs or suggestions
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Re: Cross-reference to line numbers
A possible method of doing this would be to use a suitable macro editor, such as M4, and use it to process content.xml in the .odt file. This would not be dynamic, occurring at the time of writing, but post-processing on the finished file.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
Re: Cross-reference to line numbers
If instead of line numbering, you convert every line to a paragraph by replacing each line wrap with a paragraph mark, and use paragraph numbering, then you can then cross reference to the paragraph numbers.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Cross-reference to line numbers
Below is a simple script to replace wrapping with paragraphs.
To make it easily reversable, it could be modified by inserting something like a zero-width space in front of the paragraph mark to mark the amended paragraphs.
Edit: oops changed to the version without the zero-width space.
Code: Select all
Sub replaceSoftBreaksWithParagraphMarks
vc =thiscomponent.currentcontroller.viewcursor
vc.gotorange(vc.text.start,false)
ret = -1
on error goto hr
do
if ret = 0 then exit do
vc.gotoendofline(false)
tc = vc.text.createtextcursorbyrange(vC)
tc.goright(1,true)
if asc(tc.string) <>13 then
'vc.string ="" & chr(13) 'zero width space and paragraph
vc.string =chr(13) 'paragraph
end if
vc.collapsetostart
vc.gotostartofline(false)
ret =vc.godown(1,false)
loop
hr:
End Sub
To make it easily reversable, it could be modified by inserting something like a zero-width space in front of the paragraph mark to mark the amended paragraphs.
Edit: oops changed to the version without the zero-width space.
Last edited by JeJe on Thu Jun 20, 2024 12:27 pm, edited 2 times in total.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Cross-reference to line numbers
Hagar Delest wrote: ↑Wed Jun 19, 2024 11:35 am As said:
robleyd wrote: ↑Tue Sep 11, 2018 1:03 am Given the developers don't visit here, they need to be made aware of your proposal through the appropriate channels - see [Tutorial] Reporting bugs or suggestions
- Apache OpenOffice: Issue 127888 ("Suggestion: use line numbers in footnotes and bookmarks etc.")
⠀ - LibreOffice: Bug 146905 ("Allow cross-references to bookmarks to show the line number")
Status: RESOLVED WONTFIX
OpenOffice 1.1.5 – 4.1.16
LibreOffice 3.3.0.4 – 26.2
Windows 7,10,11 64-bit
LibreOffice 3.3.0.4 – 26.2
Windows 7,10,11 64-bit