| View previous topic :: View next topic |
| Author |
Message |
RolloM General User


Joined: 04 Jul 2005 Posts: 26 Location: Zurich, Switzerland
|
Posted: Fri Jan 20, 2006 5:32 am Post subject: Margin numbers / "recitals" |
|
|
Hi,
I am looking for a way to create paragraph numbers (dict.leo.org calls them "recitals") that are written in the margin area for every text body paragraph of a book. See http://www.rwi.unizh.ch/oberassi_schlauris/Dissertation.pdf for an example (on the pages with arabic page numbers).
The numbers should be on the left of the text on left pages and on the right of the text on right pages, and there should only be one number on the top line of every paragraph. I am not looking for line numbers!
Up to now I have used frames anchored to the first line of each paragraph containing a text in a numbered paragraph format. But you have to insert such a frame to every paragraph by hand, it is a hassle to create cross-references and it seems impossible to create an automatic index which references the recitals instead of pages.
Does anyone know a better solution? This is a very common way of numbering german legal texts and would make Writer a killer application, as you can't easily do this with Word either...
Thanks,
R. |
|
| Back to top |
|
 |
Bhikkhu Pesala Super User


Joined: 23 Aug 2005 Posts: 2324 Location: Seven Kings, London, UK
|
Posted: Fri Jan 20, 2006 7:39 am Post subject: |
|
|
Do we really need to download a 4 Mbyte PDF file to see this example? A link to a posted image would be a lot more convenient.
Example
I can see that this would be very useful for producing legal documents where you might add or remove paragraphs and want the numbers to update. I'm not too sure if it can be done automatically in Open Office either. Getting the numbers to alternate left and right would be hard. To do that they would need to be part of the page style, like page numbers, but to increment automatically they would need to be part of a paragraph style like paragraph numbering or outlining. _________________ Fonts * Opera * Oo Tips * FAQ * New Forum
Oo 2.3.1 * Win XP |
|
| Back to top |
|
 |
RolloM General User


Joined: 04 Jul 2005 Posts: 26 Location: Zurich, Switzerland
|
Posted: Fri Jan 20, 2006 7:46 am Post subject: |
|
|
| Bhikkhu Pesala wrote: | Do we really need to download a 4 Mbyte PDF file to see this example? A link to a posted image would be a lot more convenient.
Example
|
Sorry - I looked for one quite a bit but didn't find another example. Thanks for the picture.
| Bhikkhu Pesala wrote: |
I can see that this would be very useful for producing legal documents where you might add or remove paragraphs and want the numbers to update. I'm not too sure if it can be done automatically in Open Office either. Getting the numbers to alternate left and right would be hard.
|
This is the main problem, indeed... |
|
| Back to top |
|
 |
jrkrideau Super User

Joined: 08 Aug 2005 Posts: 6733 Location: Kingston ON Canada
|
Posted: Fri Jan 20, 2006 12:27 pm Post subject: Re: Margin numbers / "recitals" |
|
|
| RolloM wrote: | Hi,
I am looking for a way to create paragraph numbers (dict.leo.org calls them "recitals") that are written in the margin area for every text body paragraph of a book. See http://www.rwi.unizh.ch/oberassi_schlauris/Dissertation.pdf for an example (on the pages with arabic page numbers).
The numbers should be on the left of the text on left pages and on the right of the text on right pages, and there should only be one number on the top line of every paragraph. I am not looking for line numbers!
Up to now I have used frames anchored to the first line of each paragraph containing a text in a numbered paragraph format. But you have to insert such a frame to every paragraph by hand, it is a hassle to create cross-references and it seems impossible to create an automatic index which references the recitals instead of pages. |
I cannot see any easy way to do this though I suspect someone who can write a decent macro might be able to.
However if you are doing things totally by hand I might have a couple of suggestions that would save a bit of work. They do notmake a good solution though.
Are you adding the paragraph number each time? I mean, for the first paragraph you insert a frame then you type 1 and then second paragraph insert frame type 2 and so on?
I think there is a better way to do this but I cannot see how to handle this by setting up a model frame inserting a number range variable into the frame, and referencing it. Then all you need to do is paste the frame. The numbering will increment and the reference seems to increment.
Edit : I think I'm wrong about the references.
I am lost on how to alternate left and right margins. It can be accomplisehd simply by setting up two frame styles left and right but you would have to apply them at the very end of the production process. Not a nice thing to have to do.
I am not sure what you mean by creating an automatic index. Do you mean you want an index that reverences something like Dodson ..... Para 3 ? _________________ jrkrideau
Kingston ON Canada
Currently using Windows 7 & OOo 3.4.0 and Ubuntu 12.04 & LibreOffice 3.5.2.2 |
|
| Back to top |
|
 |
RolloM General User


Joined: 04 Jul 2005 Posts: 26 Location: Zurich, Switzerland
|
Posted: Sat Jan 21, 2006 7:09 am Post subject: Re: Margin numbers / "recitals" |
|
|
Hi,
Thanks for your answer!
See my newest example for how I currently do it here.
There are several problems if one has a closer look:
Alternating left and right margins
This is the least problem - there's an option in the frame properties where you can choose the frame you entered to be mirrored on opposite pages.
Relative position of frames to top of paragraph
Depending on the top/bottom margin settings of the previous paragraphs (dunno how this is called - I use a German version of OOo), the top of the paragraph seems to be calculated differently, so if you define the frame type to start at a certain offset from the top of the paragraph, the number is sometimes correct (1), sometimes not (6 etc).
Automatic numbering of the recitals
Define a frame, put an automatically numbered paragraph layout inside, and autonumbering works. See the example mentioned above (btw: there is no way to send attachments in this forum, isnt there?)
Cross references:
Looks like referencing works +/- (see at the end of the first paragraph of the example), its more about the way OOo handles it. The main problem is that reference numbers are sorted alphabetically, i.e. 1, 10, 2, etc, but this is more cosmetic. Guess we can't do that any better without changing the program itself.
Automatically add recitals to paragraphs of a certain style
This does not work yet. I dont know if one could do this with a macro either, as for paragraph styles - unlike for frame stiles - you cannot define a macro which is to be executed if a paragraph of that style is created.
Currently I mark a recital frame of any other already numbered paragraph, and paste it to the beginning of the new paragraph. Automating this would be very cool, though...
Index
By creating an automatic index I mean the list of words at the end of a book referencing the positions where they appear in the text. See the last pages of my (long, sorry) example in the first post. There, the index references pages instead of recitals which is not optimal as references to recitals were more precise and therefore indexes in legal books usually refer to recitals if they are used.
I don't know if the indexing function is programmed flexible enough to implement referencing something else than pages with a macro. Ok, one could completely redesign the index function with a macro, but this seems too much work.
Regards
R. |
|
| Back to top |
|
 |
jrkrideau Super User

Joined: 08 Aug 2005 Posts: 6733 Location: Kingston ON Canada
|
Posted: Sat Jan 21, 2006 8:22 am Post subject: |
|
|
Congradulations you are making real progress.
I wonder if the problem with the placement of the frames depending on the paragraph margins might be addressed by changing the anchor point from Paragraph to Character?
Otherwise are there stylistic reasons for the differences in the margins between the paragraphs? If not why not just edit the margins in the styles.
Good luck
BTW how do you mirror the frames ? _________________ jrkrideau
Kingston ON Canada
Currently using Windows 7 & OOo 3.4.0 and Ubuntu 12.04 & LibreOffice 3.5.2.2 |
|
| Back to top |
|
 |
Bhikkhu Pesala Super User


Joined: 23 Aug 2005 Posts: 2324 Location: Seven Kings, London, UK
|
Posted: Sat Jan 21, 2006 8:45 am Post subject: |
|
|
| Quote: | Relative position of frames to top of paragraph
Depending on the top/bottom margin settings of the previous paragraphs (dunno how this is called - I use a German version of OOo), the top of the paragraph seems to be calculated differently, so if you define the frame type to start at a certain offset from the top of the paragraph, the number is sometimes correct (1), sometimes not (6 etc). |
Turning off "Register True" for the body text style seems to solve this problem.¹ Do you need your text to align to a grid?
¹ Bottom left corner of Indents and Spacing Tab on the Paragraph Format dialogue. _________________ Fonts * Opera * Oo Tips * FAQ * New Forum
Oo 2.3.1 * Win XP |
|
| Back to top |
|
 |
RolloM General User


Joined: 04 Jul 2005 Posts: 26 Location: Zurich, Switzerland
|
Posted: Sun Jan 22, 2006 4:06 am Post subject: |
|
|
The "register true" setting does solve the problem with the vertical offset. Thanks Bhikkhu Pesala. The setting makes text on both sides of the page be on the same hight, so you don't see the text on the other side through the paper. Its a cosmetical issue, but if we could solve it...
I'll try to translate the settings for the frame mirroring - as I said I use the German version pf Writer... Its on the "Type" page of the frame settings dialog, the checkbox below the "horizontal" setting.
I don't see a possibility to change the anchor point to characther. Where would that be?
| jrkrideau wrote: | Congradulations you are making real progress.
I wonder if the problem with the placement of the frames depending on the paragraph margins might be addressed by changing the anchor point from Paragraph to Character?
Otherwise are there stylistic reasons for the differences in the margins between the paragraphs? If not why not just edit the margins in the styles.
Good luck
BTW how do you mirror the frames ? |
|
|
| Back to top |
|
 |
Bhikkhu Pesala Super User


Joined: 23 Aug 2005 Posts: 2324 Location: Seven Kings, London, UK
|
Posted: Sun Jan 22, 2006 4:23 am Post subject: |
|
|
| Quote: | | I don't see a possibility to change the anchor point to characther. Where would that be? |
It does not exist in the modify frame style dialogue, only in the modify frame dialogue, on the same "Type" tab as the mirror frame checkbox. You still need to disable the "Register True" setting so I don't think changing the anchor type will help.
If you design your styles carefully you can make them register true. For heading styles with a line height of, say 0.24", use a spacing after of 0.1" to match your 0.17" line-spacing. _________________ Fonts * Opera * Oo Tips * FAQ * New Forum
Oo 2.3.1 * Win XP |
|
| Back to top |
|
 |
jrkrideau Super User

Joined: 08 Aug 2005 Posts: 6733 Location: Kingston ON Canada
|
Posted: Sun Jan 22, 2006 7:25 am Post subject: |
|
|
| RolloM wrote: | The "register true" setting does solve the problem with the vertical offset. Thanks Bhikkhu Pesala. The setting makes text on both sides of the page be on the same hight, so you don't see the text on the other side through the paper. Its a cosmetical issue, but if we could solve it...
I'll try to translate the settings for the frame mirroring - as I said I use the German version pf Writer... Its on the "Type" page of the frame settings dialog, the checkbox below the "horizontal" setting.
I don't see a possibility to change the anchor point to characther. Where would that be?
| jrkrideau wrote: | Congradulations you are making real progress.
I wonder if the problem with the placement of the frames depending on the paragraph margins might be addressed by changing the anchor point from Paragraph to Character?
Otherwise are there stylistic reasons for the differences in the margins between the paragraphs? If not why not just edit the margins in the styles.
Good luck
BTW how do you mirror the frames ? |
|
The anchor to character is on the Type tab above and tothe left of the mirror box. I looked at that tab a good three times yesterday and never saw the Mirror command ! _________________ jrkrideau
Kingston ON Canada
Currently using Windows 7 & OOo 3.4.0 and Ubuntu 12.04 & LibreOffice 3.5.2.2 |
|
| Back to top |
|
 |
Bhikkhu Pesala Super User


Joined: 23 Aug 2005 Posts: 2324 Location: Seven Kings, London, UK
|
Posted: Sun Jan 22, 2006 9:22 am Post subject: |
|
|
| jrkrideau wrote: |
The anchor to character is on the Type tab above and to the left of the mirror box.! |
It is not there, whether you look three times or a hundred times. Though the mirror checkbox is there.
Any idea why the anchor option is found only on the Frame Dialogue, but not on the Frame Style Dialogue. The logic of it escapes me for the moment.
 _________________ Fonts * Opera * Oo Tips * FAQ * New Forum
Oo 2.3.1 * Win XP |
|
| Back to top |
|
 |
RolloM General User


Joined: 04 Jul 2005 Posts: 26 Location: Zurich, Switzerland
|
Posted: Sun Jan 22, 2006 1:04 pm Post subject: |
|
|
[quote="Bhikkhu Pesala"] | jrkrideau wrote: |
Any idea why the anchor option is found only on the Frame Dialogue, but not on the Frame Style Dialogue. The logic of it escapes me for the moment.
|
No idea... probably a bug.
There seem to be even more of them, btw.: The undo function does not work: Change the vertical offset of the frame and try to undo this...
Neither seems the option to actualize automatically on the first tab of the frame type dialog (on the "manage" tab or how it might be called in English). I first thought one might circumvent the missing "anchor" buttons in the type dialog by activating automatic actualization and modifying a single frame of that type - but there is no reaction, also if you change the said vertical offset). Seems we've found a bug's nest... |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8982 Location: Lexinton, Kentucky, USA
|
Posted: Mon Jan 23, 2006 5:46 am Post subject: |
|
|
It was a dreary day yesterday and this seemed a good problem to attack with a macro so I did. Here is what I have to date and how it works.
The user needs to create a left and right page sample frame next to a paragraph near the beginning of the document that will not receive frames. These samples control the alignment of the frames to be inserted and contain nothing. They will ultimately be removed.
Next the user needs to edit the “first” line of the macro where “psn” is defined to include the names of all paragraph styles to receive frames.
The macro uses copy and paste so it can only do the right or left pages at one time, i.e., it must be run twice to do all pages. To do the right pages select the right page sample (green handles) run the macro and use the “1” option. The “2” option does left pages and the “3” option will remove any frames previously inserted by the macro.
The macro pastes the frame, inserts the number and, with the numbered selected, inserts a bookmark named “Para n” for easy cross-referencing.
What the macro doesn't do:
1) Use an auto-incrementing number field. Probably doable as I was initially copying sample frames that contained one but that led to other problems that I believe I can work around.
2) Catch any paragraphs in frames.
3) Don't know what happens if a paragraph is in a table.
4) Remove any cross-reference field(s) if you insert one and then delete the frames. May be doable.
5) Work on a selected area so you could apply frames to incremental writing. This one is very likely doable but requires a slightly different approach for iterating through the paragraphs.
6) Other things I haven't thought of. | Code: |
Sub InsertFrames
REM "psn" must contain all paragraph style names you want
' to set frames next to. "Standard" is internally equal to
' the "Default" paragraph style.
psn = "Standard Text Body"
'................................................................
oDoc = ThisComponent
a$ = "1 = Insert right page frames." & Chr(10)
a$ = a$ & "2 = Insert left page frames." & Chr(10)
a$ = a$ & "3 = Delete frames."
Do
DoWhat = InputBox(a$,"Select desired action by its number","?")
If DoWhat = "" then End 'User clicked Cancel.
Loop Until isNumeric(DoWhat) And Int(DoWhat) > 0 And Int(DoWhat) < 4
DoWhat = Int(DoWhat)
If Instr("12",DoWhat) > 0 then
If Not oDoc.CurrentSelection.supportsService("com.sun.star.text.TextFrame") then
MsgBox "No frame selected. Ending!" : End
EndIf
EndIf
oFrms = oDoc.getTextFrames
frmName = "JcvFrm"
Select Case DoWhat
case 1 : RhtPage = true
case 2 : rhtPage = false
case 3 : DelFrms(oDoc,frmName,oFrms)
End Select
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
oVC = oDoc.CurrentController.getViewCursor
Dim leftP as Boolean : ParaNum = 0
enum = oDoc.Text.createEnumeration
Do While enum.hasMoreElements
thisPara = enum.nextElement
If Len(thisPara.getString) > 0 then 'Not a blank paragraph.
oVC.gotoRange(thisPara.Anchor.getStart,false)
leftP = (oVC.getPage MOD 2) - 1 'Set leftP true or false
If Instr(psn,thisPara.ParaStyleName) > 0 then 'Is para style we want.
ParaNum = ParaNum + 1
If DoWhat = 1 And Not(leftP) then
Process(oDoc,document,dispatcher,frmName,ParaNum)
ElseIf DoWhat = 2 And leftP then
Process(oDoc,document,dispatcher,frmName,ParaNum)
EndIf
EndIf
EndIf
Loop
'If DelIniFrm = 6 then oFrms.getByName(IniFrmName).dispose '6 = Yes.
End Sub
Sub Process(oDoc,document,dispatcher,frmName,ParaNum)
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
oFrm = oDoc.CurrentSelection
oFrm.Name = frmName & ParaNum
oTC = oFrm.createTextCursor
oFrm.Text.insertString(oTC,paraNum,true)
oBookmark = oDoc.createInstance("com.sun.star.text.Bookmark")
oBookmark.Name = "Para " & oTC.String
oFrm.Text.insertTextContent(oTC,oBookmark,true)
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
End Sub
Sub DelFrms(oDoc, frmName, oFrms)
oFrmNames = oFrms.getElementNames
For i = lBound(oFrmNames) to uBound(oFrmNames)
thisFrmName = oFrmNames(i)
If Left(thisFrmName,Len(FrmName)) = frmName then
thisFrm = oFrms.getByName(thisFrmName)
thisFrm.dispose
EndIf
Next
End Sub |
|
|
| Back to top |
|
 |
RolloM General User


Joined: 04 Jul 2005 Posts: 26 Location: Zurich, Switzerland
|
Posted: Wed Jan 25, 2006 7:46 am Post subject: |
|
|
Thanks for your suggestion, JohnV
Would you see a possibility to start a macro as soon as a new paragraph of a certain type is inserted? Alternative: It would already be comfortable if one could just start a macro (with a hotkey, of course) which adds a number to the paragraph the cursor is in instead of having to copy an existing frame to the clipboard first.
Any Ideas? Thank you... |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8982 Location: Lexinton, Kentucky, USA
|
Posted: Wed Jan 25, 2006 1:00 pm Post subject: |
|
|
I undertook this macro as a learning experience and now believe that I can provide the hotkey solution. The frame inserted will still be base on right and left page frame samples you provide but other than that I don't think further user action should be required. We will see.
I have been modifing my code anyway, based on some things I have learned along the way, and I may not have to do much to put it in the form you seek. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|