Differing Sized Multi-column Pages Change Across Even & Odd

Everything related to our flagship word processor.
Post Reply
weiphotoarts
Posts: 14
Joined: 2015-07-27 23:16:02

Differing Sized Multi-column Pages Change Across Even & Odd

Post by weiphotoarts »

I have a question on how to create a document with two different-sized columns over even and odd pages. Nisus 2.1.6 has the columns are maintained over all pages, not changing from even to odd pages.

For example, on page 1 imagine the different-sized columns, the left column being a 4.19” column and the right column being a 2.25” column. For Page 2, these same sized columns are the same. They don't change when going from odd to even pages.

Instead, I want Page 2 to have the left column being a 2.25” column and the right column being a 4.19” column. So that the pictures are the same size, both on the “inside” towards the book’s gutter, as one has adjacent even and odd facing pages open together.

But I don’t want to create separate sections for each even or odd page. If I did, that would mean I would need to create new sections every page. For a multi-hundred page document, that would mean managing that many sections, which, as you can understand, is intolerable.

What are some solutions?

Wei Chong
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Differing Sized Multi-column Pages Change Across Even &

Post by phspaelti »

Hello Wei Chong,
Nisus is great for many things, but if you really want columns of the kind you describe, you are out of luck. For the kind of thing you want I really think you would need book layout type software (or use things like LaTeX, or mark-up.)

Having said that, let's say you really want to do it in Nisus, I would suggest the following. As you describe it, you have flowing text in one column and pictures in the other. I would make the document one column, 2.25" wide, odd-even. Then I would put the images in the wide space as floating content, linked to the relevant paragraphs. But of course you would need to always adjust the placement of the pictures -- from left to right, and vice versa -- when content spills from an odd page to an even one, etc.. I think it might be possible to write a macro that fixed this type of placement issue.

Hope this helps
philip
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Differing Sized Multi-column Pages Change Across Even &

Post by adryan »

G’day, Wei Chong, Philip et al

I see that Philip has posted a reply while I was composing this one. I think I’m pretty much on the same page (left? right?) as he is.

To the best of my knowledge, too, any alteration of column parameters within a Section will apply throughout the whole Section. The same goes for page margins, except that here you can have the margins of facing pages reflected across the center of the book.

I don’t think I quite understand the book design you have in mind. Image size is independent of column width, so you don’t need to create columns just to keep images the same size on odd and even pages. It depends on how you want to position main body text with respect to the images.

If you don’t mind images mixing it with your main text, just use the Alignment and Text Wrap options in the Shape Wrap palette to flick the image to the left or the right. However, inserting or deleting text before the image anchor could see the image move from an odd page to an even one (or vice versa), and it would then have to be shifted left or right as the case may be. Unfortunately, I can find no alignment commands for Image Objects in the Macro Language Reference, so it seems it would have to be done manually. This being so, it’s best to leave these left/right shifts until the document is all but complete: at least you would then know where each image needs to be on the page. You would click on an image, then choose the appropriate options from the Alignment and Text Wrap options in the Shape Wrap palette.

If you envisage a column that contains only images (with no surrounding text), I can think of two ways to achieve this:–

(1) Set the document to Use Facing Pages, move the inner or outer margin as desired to leave yourself room for the images, then insert each image into that empty space. (Text has to be within the margins, but images do not!) If an image requires a caption, you can use the same procedure to insert a text box (from the Insert Shape menu) below the image. This method suffers from a similar disadvantage to the one previously mentioned: you may have to drag images to the right or the left at some stage. The point, though, is that they remain the same size on both odd and even pages.

(2) Insert your image amongst the text between margins, then in the Shape Wrap palette set the Placement option to “Moves with paragraph”, set the Alignment option to “Align Left (or Right)”, and set the Text Wrap option to “Text never appears to the left (or right) of the shape”. Set the Horizontal Padding to something that looks nice, then increase the Vertical Padding until no text remains in the same “column” as the image. This method has a similar disadvantage to the other two, but with added complexity when dealing with multiple images in the same “column” of the same page. To get around this, one might consider inserting a “full-height” blank rectangle with appropriate Alignment and Text Wrap settings to banish body text from this privileged area within which one could overlay images at will. You would group the images and the underlying rectangle into a single Shape to make any required left/right shifting easier.

I’m not sure how helpful any of this is. It would be interesting to see whether anyone else can think of an elegant solution within Nisus Writer. I guess I’ve always felt that some page layout problems fall outside the scope of (even really good!) word processor capability and may require use of adjunct software after the word processor has done its job.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
weiphotoarts
Posts: 14
Joined: 2015-07-27 23:16:02

Re: Differing Sized Multi-column Pages Change Across Even &

Post by weiphotoarts »

Synergy: When 1 + 1 = 3

I rarely use this forum, but when I do, I’m always amazed by the helpful ideas members generously provide.

In this case, Phillip’s caution was appreciated. But his idea of the single column (which I tried) made for lots of work (even with a macro), as it would have to be repeated for every other page (I anticipate my instruction book will have 80% of these.)

On the other hand, Andrian’s suggestion that within a section the column(s) attributes did not change, and picture size was independent of column width. I did a sample, and it got me thinking.

:arrow: Then it hit me! Why not have 3 columns for the entire section that I wanted left and right pages to be different with pictures placed toward the gutter on the right and left, respectively.

Whenever I wanted to write on the even pages (left side of an open book), I would use column 1 of 2.25”, and just drag the picture to the right (towards the gutter), once I tied it to a paragraph. The picture would be 4” wide. Then, on the next (odd) page, I would just write on the 3rd column of 2.25” and drag the next picture to the left (towards the gutter), once it was tied to the paragraph on the 3rd column. The 2nd column would not be used, so it’s width would be determined by the widths of the 1st and 3rd columns.

Hope my example jpgs are included in this answer.

Thanks for you ideas, Phillip & Andrian.

PS: Any ideas how I can skip from the 1st column to the top of the 3rd column without inserting a whole bunch of carriage returns?
Attachments
Test-3column-Page_right-odd.jpg
Test-3column-Page_right-odd.jpg (62.58 KiB) Viewed 9018 times
Test-3column-Page_left-even.jpg
Test-3column-Page_left-even.jpg (63.63 KiB) Viewed 9018 times
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Differing Sized Multi-column Pages Change Across Even &

Post by adryan »

G’day, Wei Chong et al

The attachments you posted are very helpful in showing us the book design you are aiming for. Thanks for that.

Law of Nature: If you find yourself using multiple consecutive paragraph returns, you’re doing something wrong!

In the present case, use Insert > Column Break instead.

Given that you don’t seem to mind manually shifting images right and left, I would recommend my method “(1)“ in my previous posting. I congratulate you on the ingenuity of your approach, but I don’t think it offers any advantages, and in fact dealing with multiple columns in this situation is likely to prove unnecessarily unwieldy. And I repeat my assertion that you don’t need to create a text container (column or whatever) in order to achieve a constant image size: instead, drag an image handle or use the Shape Metrics palette.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Differing Sized Multi-column Pages Change Across Even &

Post by phspaelti »

weiphotoarts wrote:In this case, Phillip’s caution was appreciated. But his idea of the single column (which I tried) made for lots of work (even with a macro), as it would have to be repeated for every other page (I anticipate my instruction book will have 80% of these.)
Well, I'm glad you found a solution that suits your needs, but I think you misunderstood what I was suggesting. My idea was to set the margins of the single column asymmetrically. After that "Use facing pages" does the rest. So it's actually no work at all. You don't even need to insert column breaks, and you can have text which flows from one page to the next.
Odd_even_test.jpg
Odd_even_test.jpg (42.32 KiB) Viewed 9004 times
Odd_even_test2.jpeg
Odd_even_test2.jpeg (92.59 KiB) Viewed 9004 times
Admittedly there is one downside to this approach. Nisus unfortunately limits the header and footer along with the margins. So if you want centered headers or footers over the whole page width, your approach is probably the way to go.
philip
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Differing Sized Multi-column Pages Change Across Even &

Post by adryan »

G’day, Philip et al

Yes, Philip has demonstrated exactly what we have in mind.

However, although text will flow properly from page to page, images will not. That is to say, if text alteration forces an image to move to another page (specifically, one that is an odd number of pages beyond the original), it may end up overlying text, so it will have to be displaced manually to the left/right. Depending on where the image anchor ends up, the image may also have to be displaced in a vertical direction as well.

The AppleScript dictionary for Nisus Writer Pro leaves a lot to the imagination when it comes to properties of images, so any attempt to use AppleScript to automate the process is likely to prove frustrating. (I have already mentioned that the Nisus Macro Language probably can’t help us here either.)

With respect to Philip’s astute observation regarding header/footer width, possible workarounds include:–

(1) Watermarks: Lower the top margin of the document and note that negative Vertical Offset values will probably be needed for correct placement for a header. Use 0% Transparency. I haven’t examined this whole idea in great detail, but I see that one can set different watermarks for odd and even pages. In my cursory experiment without such distinction, I observed considerable horizontal shift from one page to the next, so some tinkering may be required to get this to work properly.

(2) Text Boxes: Again, lower the top margin of the document to allow space for a text box to function as a header; obvious similar procedure for a footer. Note that insertion of an automatic page number into a text box does indeed give the correct page number; moreover, one that functions correctly even if the box is moved to a different page.

However, I do notice that the header and footer of the first page in Philip’s sample document do in fact stretch across the whole page, which is curious.

I hope this helps. It’s certainly an intriguing exercise we’ve been set!

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Differing Sized Multi-column Pages Change Across Even &

Post by phspaelti »

adryan wrote: (I have already mentioned that the Nisus Macro Language probably can’t help us here either.)
I have no idea why you say this. The macro language will be able to fix this kind of thing easily.
adryan wrote: However, I do notice that the header and footer of the first page in Philip’s sample document do in fact stretch across the whole page, which is curious.
That's just because there is a section break on that page, so the headers and footers are those from the previous section, which is full page.
philip
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Differing Sized Multi-column Pages Change Across Even &

Post by adryan »

G’day, Philip et al

As I said, I could find no alignment commands for Image Objects in the Macro Language Reference. But I’m very happy to learn otherwise. Another perusal of that document seems to suggest that Image Objects may be addressed through Text Object commands, but I’m afraid that’s getting well outside my comfort zone.

The relevance of all of this is that it would be nice to find some way to automate the positioning of images to left/right, depending on whether they occur on odd/even (or vice versa) pages. As I have observed, vertical positioning may also have to be adjusted.

Any macro that did all this would probably need to be run after any new image was inserted or substantial alteration to text was made. It would run through every image in the document and position it appropriately. If suitable commands exist in the macro language, the dimensions of each image could be altered to ensure consistency. Ideally, one could insert or plonk an image of any size anywhere on a page and then rely on the macro to adjust size and position.

From my perspective, none of this is trivial and it is outside the scope of my own expertise. However, I believe that a macro along the lines I have suggested would accomplish what Wei Chong wishes to achieve.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Differing Sized Multi-column Pages Change Across Even &

Post by phspaelti »

Hi Adrian,

I can't say that doing this is 'trivial', but it isn't too hard.

The way to adjust the position of a floating image is to change the anchor offset. Assuming you have such an image object, the command looks like this:

Code: Select all

$img.floatingContent.anchorOffset = $newPosition
For this to work correctly you will have to be sure that the image is indeed a floating image (check with $img.isFloating), and then the variable $newPosition will have to have the correct value. That value is going to be a Size object, where the "width" is the horizontal offset in points, and the height the vertical one.

You can get the odd/even page information by asking for the pageNumberAtIndex. The index will be the location of the image's anchorTextRange. You'll then have to take the modulo of the page number divided by 2:

Code: Select all

$oddEven = $img.anchorText.pageNumberAtIndex($img.anchorTextRange.location) % 2
This will return '0' for even and '1' for odd.

The final issue will be determining the proper anchor offset. This anchor offset is relative to the margin, which in my case, would be positive for even pages, and negative for odd ones (since on odd pages the image is to the left of the margin). With Wei Chong's set-up it would be '0' for images on odd pages and something positive (in the 200 range?) for even ones. Assuming you want the images to be nicely aligned, it would probably be best to just hard code in values that check that all relevant images are set to the relevant value, and if they have the wrong one, set them correctly.

Vertical placement is probably best handled by hand. If you really wanted you could try to figure out if the image still fits on the page, but the problem is that Nisus can only tell you the offset relative to the anchor, and there is no easy way to know where on the page the anchor is. You'd have to ask which line, and then multiply by the line height. If that height + the vertical offset + the height of the image is greater than the page height you have to fix the placement of the image. So something to do on a slow day :)

But here is the basic code for doing the horizontal bit:

Code: Select all

$doc = Document.active
# Set appropriate values
$oddPagePosition = …
$evenPagePosition = …

foreach $img in $doc.allImages
   if $img.isFloating
      $pos = $img.floatingContent.anchorOffset
      $oddEven = $img.anchorText.pageNumberAtIndex($img.anchorTextRange.location) % 2
      if ($oddEven == 1) && ($pos.width != $oddPagePosition)
         $newPos = Size.new $oddPagePosition, $pos.height
         $img.floatingContent.anchorOffset = $newPos
      elsif ($oddEven == 0) && ($pos.width != $evenPagePosition)
         $newPos = Size.new $evenPagePosition, $pos.height
         $img.floatingContent.anchorOffset = $newPos
      end
   end
end
[Code fixed. Thanks, Adrian]
Last edited by phspaelti on 2017-02-12 00:55:26, edited 1 time in total.
philip
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Differing Sized Multi-column Pages Change Across Even &

Post by adryan »

G’day, Philip et al

That was quick! Goodonya! Lots for me to study in that. But not tonight!

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
weiphotoarts
Posts: 14
Joined: 2015-07-27 23:16:02

Re: Differing Sized Multi-column Pages Change Across Even &

Post by weiphotoarts »

Hi Phillip & Andrian,

Thank you for your deep insights into how I can better use Nisus Pro. I'm learning more and more about how best to use it.

I'm going with Phillip's solution, which is more elegant than mine. I will figure how to hassle through image placements, but initially I won't be using macros, unless the placements are a real problem. In that case I may come back for questions regarding the macro, but that's sometimes away.

I appreciate both of you spending the time & effort to provide useful suggestions to a Nisus Pro newbie.


Wei
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Differing Sized Multi-column Pages Change Across Even &

Post by adryan »

G’day, all

You’re welcome, Wei.

And thanks for that macro and the explanation, Philip. I now see how to access the required parameters. With two modifications and some tinkering with the intial values of the position variables, the macro is a joy to behold in action.

The first modification is addition of the standard access line:–

Code: Select all

$doc = Document.active
The second is replacing the two occurrences of the “<>” comparison operator (from Numbers and such) with “!=” (which Nisus uses).

Great fun to see images move into those margins on odd and even pages!

One subtlety to be aware of is that Text Wrap in the Shape Wrap palette needs to be set to “Text placement is not affected by shape” (ie, middle button in top row) when inserting an image. Otherwise, the image will displace text and perhaps lead to confusion until the macro is run.

As Philip says, the vertical situation gets a bit complicated and may well be better done manually (which would be a pity!). One thing that is not quite clear to me yet is how the choice of Placement in the Shape Wrap palette will affect things. We know it can’t be “Inline with text”, but I’m not sure which of the other two options is best in this situation. Another day….

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
Post Reply