Equation numbering methods.

Everything related to our flagship word processor.
Post Reply
LongTermUser
Posts: 25
Joined: 2007-10-31 05:58:12

Equation numbering methods.

Post 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.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Equation numbering methods.

Post 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.
dlrodriguez
Posts: 9
Joined: 2020-10-22 13:36:34

Re: Equation numbering methods.

Post 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)
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Equation numbering methods.

Post 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.
philip
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Equation numbering methods.

Post 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
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Equation numbering methods.

Post 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.
Attachments
equations-example.zrtf
(31.64 KiB) Downloaded 545 times
johseb
Posts: 47
Joined: 2016-02-13 10:01:29

Re: Equation numbering methods.

Post 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?
Attachments
Screen Shot 2020-10-30 at 11.13.17.png
Screen Shot 2020-10-30 at 11.13.17.png (77.33 KiB) Viewed 17280 times
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Equation numbering methods.

Post 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
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
johseb
Posts: 47
Joined: 2016-02-13 10:01:29

Re: Equation numbering methods.

Post 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.
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Equation numbering methods.

Post 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
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
johseb
Posts: 47
Joined: 2016-02-13 10:01:29

Re: Equation numbering methods.

Post 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.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Equation numbering methods.

Post 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:

Code: Select all

$textHeight = 10
You can adjust this value if your text height is usually more or less.
Attachments
Equation Image, Align List Item Vertically.nwm
(6.6 KiB) Downloaded 529 times
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Equation numbering methods.

Post 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
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Equation numbering methods.

Post 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
Post Reply