Page 1 of 1

[Solved] Set text justification based on L/R page?

Posted: Mon Aug 25, 2014 6:36 am
by Jadan
Hi all,

I asked this in the main forum, but it seems like it would be better posed here.

I am writing a phone/address directory, with one entry on each page. I have two paragraph styles - Destination Heading [with a header link for ToC purposes] and Destination Information [basically using this instead of Text Body so that I can change the font for these pages easily]. Is there a way to set these two paragraph styles to be left-justified on left/even numbered pages, and right-justified on right/odd-numbered pages?

Thank you in advance for any assistance,
Jadan

Re: Automatically set text justification based on L/R page?

Posted: Wed Oct 01, 2014 2:35 pm
by John_Ha
I cannot think of a way to do this as you write the document.

However, I'm pretty sure (but I don't know how) that you could create a macro which you could run on the completed document to check whether it was a left or right page and formatt the text left or right justified accordingly.

You might be best asking in the Macro and API forum :-).

If you are only doing it a few times, it is probably quicker to do it manually.

Re: Automatically set text justification based on L/R page?

Posted: Wed Oct 01, 2014 3:47 pm
by keme
AFAIK, text alignment is not a property for page or frame style in Writer, so you can't have it fully automated. You could create a sequence of paragraph styles for initial typing, but when you later insert an entry in the middle the subsequent entries will be offset by one page while keeping their style. This will give the exact opposite of what you asked for...

In Scribus I believe you can set text alignment property for a frame, which will then come into play if the paragraph does not have an alignment property set.
http://wiki.scribus.net/canvas/Working_ ... :_Text_Tab

Using DTP may be cumbersome in other respects, so unless you are building a huge directory and expect lots of edits, I guess John is right: The manual approach is your best choice.

Re: Automatically set text justification based on L/R page?

Posted: Wed Oct 01, 2014 3:55 pm
by acknak
As far as I know, Writer cannot do this.

I'm not sure how a conditional paragraph style would work. What happens when a paragraph flows over two pages? The paragraph style would have to switch in the middle of a paragraph.

But I believe the way this might work is that the text alignment would change depending on the text direction. So a left-alligned paragraph in a RtL environment would actually align to the right.

You can see this is just what happens, even with a plain (English/Western LtR text--dt, F3, for example):
Format > Paragraph > Alignment > Properties > Text direction: Right-to-Left
(You have to enable complex text layout to get this option).

The text (left aligned by default) will align at the right side of the page, even though the text itself is still LtR.

The page style can set the text direction to RtL, and the paragraph can (apparently) use the page setting (the "superordinate" setting, I presume), so alternating page styles switching between LtR and RtL could take care of the alternating left and right alignment.

However, it doesn't work--at least for me. Changing the page to RtL does not seem to affect the paragraph text at all, and changing the paragraph setting leads to some jumbled/strange layout problems.

I know nothing about Writer's complex text layout features or how they're supposed to work, so I don't know if there's a bug or I've misunderstood something.

Re: Automatically set text justification based on L/R page?

Posted: Wed Oct 01, 2014 4:47 pm
by John_Ha
On further thought, it shouldn't be too difficult. All you need to do is to find the page number that the paragraph is on. If the page number is odd, then that is a Right page and the paragraph(s) need to be aligned right. That should be a fairly simple macro - you parse through the entire document paragraph by paragraph, and align each according to the page number.

[Solved] How to get the Page Number of Text Fields shows how to find the page number for given text.

Re: Automatically set text justification based on L/R page?

Posted: Wed Feb 11, 2015 1:40 pm
by qazwiz
I'm making an assumption as i read this so i should ask u first: will the justified file then be printed?
I'm assuming yes.
if so, i believe you can get your printer to print the page adjusted to the left or right based on even/odd page numbers.
although "Book style formatting" which this is called, should be offered in every writing program. but i will admit that OOW is lacking in some basic Global Formatting commands.
it was decades ago that i remember having the opposite problem with a mainframe text manipulating program both the writing and the printing justified the text so i had to find how to turn off the justification in one of the processes.
i wont give additional details since We are OpenOffice not that program but i believe that this feature should be added if not available as this question implies.

notes to the programmers:
the page formatting should check for this as opposed to the paragraph formatting and i suggest a check box called "use Book-style justification" in the margins section of Format->Page->Page. a single field of "odd/even offset" could be the additional offset for the conditional justification. in which case the check-box could be redundant as setting this offset to zero would result in the current symmetrical output for left/right margins of equal reserve. (i like the idea of both though. the unchecked check-box would then grey out the odd/even offset field for a visual reminder that the page will be same unless the book style is selected

Re: Automatically set text justification based on L/R page?

Posted: Wed Feb 11, 2015 1:50 pm
by John_Ha
qazwiz wrote: "Book style formatting" which this is called, should be offered in every writing program
Writer has "book formatting" with Format > Page > Page > Mirrored, which allows you to set a wider 'inner' margin at the spine to allow for binding. However, it does not align the paragraphs at the inner or outer margin - paragraphs align left or right justification on each page according to the paragraph style.

Re: Automatically set text justification based on L/R page?

Posted: Wed Feb 11, 2015 2:04 pm
by qazwiz
Thank you, i thought it queer that OOW didnt have book style there are so many options it is getting hard to find what you want

Re: Automatically set text justification based on L/R page?

Posted: Wed Feb 11, 2015 5:27 pm
by John_Ha
qazwiz wrote:there are so many options it is getting hard to find what you want
When all else fails, RTM ** usually works!

[** RTM - Read The Manual]

Re: Automatically set text justification based on L/R page?

Posted: Thu Feb 12, 2015 2:10 am
by qazwiz
John_Ha wrote:
qazwiz wrote:there are so many options it is getting hard to find what you want
When all else fails, RTM ** usually works!

[** RTM - Read The Manual]
i got news for you I spent thirty minutes looking in the help for the feature i wanted to mention... never in a million years would I have tried searching for mirror. so reading the manual only works if the manual has the information connected to the average mans vocabulary.
BTW: i never use a mirror, I'm not that vain (or pretty :P )

Re: Automatically set text justification based on L/R page?

Posted: Thu Feb 12, 2015 12:50 pm
by John_Ha
Actually, I agree with you - the Help is poorly indexed and it is quite difficult to find things unless you know their precise names.

The manual is somewhat better organised and there is a whole chapter (4) devoted to formatting the page - my RTM suggestion was not just in jest!

Re: Automatically set text justification based on L/R page?

Posted: Thu Feb 12, 2015 6:04 pm
by acknak
LlibreOffice has the built-in help online, here: help.libreoffice.org

A search for: page left right site:help.libreoffice.org
shows (Writer) Alternating Page Styles on Odd and Even Pages
as the first result.

At least it's a good start.