Page 1 of 1
Equation numbering methods.
Posted: 2008-01-21 12:40:04
by LongTermUser
I have many technical documents from classic Nisus that have many equations. NWP has changed the method of equation numbering to using lists. Since I needed the list number to be centered with respect to the equation (which are often several lines) I inserted a single row table with two columns. The right-most column is 1/2 inch in width and contains the list number. The remaining table column contains the equation. This seams to work well enough. However I consider it a poor replacement of NWP method.
My question is does anyone have a nicer/better/more efficient method to this problem?
When using the list number and inserting it to the right-hand side as in referred journals I can not insert the equation graphic to its left unless I change it from "inline with text" to "moves with paragraph". While this works it tends to cause formatting problems when I am adding CRs.
Thanks
Lorenz H. Menke, Jr.
Re: Equation numbering methods.
Posted: 2008-01-22 15:28:40
by martin
LongTermUser wrote:I inserted a single row table with two columns. The right-most column is 1/2 inch in width and contains the list number. The remaining table column contains the equation. This seams to work well enough. However I consider it a poor replacement of NWP method.
At this point I think this would be my recommended approach for solving this problem. But really we do need to add a variable/sequence number feature separate from the List styles.
Re: Equation numbering methods.
Posted: 2020-10-27 14:23:33
by dlrodriguez
This is quite an old post. Is there still no better way to do equation numbering with the number aligned on the right of the line?
blah blah blah in Eqn (1):
z = x + y (1)
Re: Equation numbering methods.
Posted: 2020-10-27 17:42:47
by phspaelti
If by "better way" you mean "numbers that update automatically and that can be placed elsewhere than the start of a paragraph", then the the answer is "no".
But rather than using tables, I would recommend using a character style for the equation numbers, insert them physically ("hard coded") and then use a macro to update and keep them in order. In fact I would write a macro to insert them so that they stay in sequence at all times.
If you want assistance writing such a macro, let me know.
Re: Equation numbering methods.
Posted: 2020-10-28 23:37:49
by adryan
G'day, Martin et al
Perhaps an option in the Lists Palette to choose between leading and trailing list item numbers (with following and preceding tabs respectively) could be of use in this and other contexts.
Cheers,
Adrian
Re: Equation numbering methods.
Posted: 2020-10-29 10:42:20
by martin
dlrodriguez wrote: ↑2020-10-27 14:23:33
Is there still no better way to do equation numbering with the number aligned on the right of the line?
You could use a "right-to-left" paragraph writing direction, so that automatic numbering is laid out along the right side. I'd enforce all that using a paragraph style. I'll attach an example document that hopefully makes this technique clear. Please let me know if you have any questions.
Re: Equation numbering methods.
Posted: 2020-10-30 02:29:39
by johseb
Martin, ingenious indeed but placing the equation image inline you'll end up with the equation number aligned with the bottom of the image.
The effect is apparent when inserting multiline equations.
Are there any soutions to this problem?
Re: Equation numbering methods.
Posted: 2020-10-30 04:39:17
by adryan
G'day, johseb et al
If you select an image, its dimensions are shown in the Shape Metrics Palette. Choose the Units to be Points, so you see the Height of the image in points. Now select the list item number and raise the baseline (via the Format menu) by half the number of points in the image's height. I think this will achieve what you want. There's bound to be someone out there who can wrap these steps into a nice little macro.
There's also bound to be a pedant out there who will observe that the sort of thing you have adduced is more in the nature of a set of equations than a single multi-line equation (although it actually has characteristics of both).
So another possible approach is to split the set into separate images and remove the List characteristics (via the Format menu, the Lists Palette or the List icon in the Toolbar) from all but the "middle" graphic. You can use Continue Numbering to have subsequent list items numbered in the same sequence.
Cheers,
Adrian
Re: Equation numbering methods.
Posted: 2020-10-30 05:37:44
by johseb
Hi Adrian, your method works perfectly. Thanks for the tip!
My example was purposely extreme but I guess the number of a significant proportion of equations will be off-center (even though by a small amount).
The table method automatically takes care of the vertical aligment of the numbers but Martin's method seems more "clean"; as you noticed a macro would be a nice addition.
In any case is good to have a choice.
Re: Equation numbering methods.
Posted: 2020-10-30 05:43:39
by adryan
G'day, all
While Martin's approach works well enough, it is perhaps not ideal for those unaccustomed to working with right-to-left languages, particularly when it comes to placement of the insertion point for new paragraphs.
So I think my earlier suggestion of allowing a choice between leading and trailing list item numbers, taking due cognizance of writing direction, would still be preferable.
Cheers,
Adrian
Re: Equation numbering methods.
Posted: 2020-10-30 07:08:57
by johseb
Adrian, you're right, there's for sure room for improvements when it comes to figure/table captions and equation numbering (e.g. simpler ways to create numbering per chapter or create figure/tale lists, etc; all possible now but no so smooth).
Re vertical adjustment of baseline, I noticed that hovering with the mouse over an equation image you get a pop-up showing the dimensions of the image. Unfortunately they are displayed in the unit set for the rulers, which I always set to cm.
If the image dimensions were displayed in points as well we could avoid a trip to the Shape palette and make the baseline adjustment a matter of seconds.
Re: Equation numbering methods.
Posted: 2020-10-30 08:31:49
by martin
So I think my earlier suggestion of allowing a choice between leading and trailing list item numbers, taking due cognizance of writing direction, would still be preferable.
A more proper solution is certainly still desirable. I think the most complete way to address this is custom numbering sequences that can be placed anywhere in your text.
adryan wrote: ↑2020-10-30 04:39:17
Now select the list item number and raise the baseline (via the Format menu) by half the number of points in the image's height. I think this will achieve what you want. There's bound to be someone out there who can wrap these steps into a nice little macro.

That's a great idea Adrian! I'll attach such a macro. To use it just place the selection/caret anywhere within the paragraph with the equation image and run the macro. It will detect the image and list item, and adjust the baseline as needed.
The only issue is that the macro must guess how tall the list item is by itself, in order to properly center it. There's a variable for that near the bottom:
You can adjust this value if your text height is usually more or less.
Re: Equation numbering methods.
Posted: 2020-10-30 13:35:52
by adryan
G'day, Martin et al
Thanks for that, Martin. The subtlety of accounting for the text height is a nice little touch.
Strictly speaking, of course, the macro only aligns a list item number, not an entire list item, with an image. Aligning all tab-separated text elements in a list item would obviate the need to resort to tables merely to effect vertical alignment, but I’m not sure how often such a situation would arise in the context of a list.
Cheers,
Adrian
Re: Equation numbering methods.
Posted: 2020-11-17 14:48:31
by martin
adryan wrote: ↑2020-10-30 13:35:52
Thanks for that, Martin. The subtlety of accounting for the text height is a nice little touch.
Nisus Writer Pro version 3.2 improves on this macro by using a new command to measure the list item's height:
Code: Select all
$listItemSize = $text.opticalSizeInRange($listItemRange)
This measurement allows the macro to truly center the list item with respect to the equation image, regardless of the list item's font and size. A full copy of the updated macro can be downloaded here:
•
Image, Align List Item Vertically