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

Writing a book, Automating Document Production - Discuss your special needs here

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

Postby Jadan » Mon Aug 25, 2014 6:36 am

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
Last edited by Hagar Delest on Sat Feb 14, 2015 12:17 am, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 4.1 on Windows 7
Jadan
 
Posts: 4
Joined: Tue Aug 19, 2014 3:18 am

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

Postby John_Ha » Wed Oct 01, 2014 2:35 pm

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.
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6775
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby keme » Wed Oct 01, 2014 3:47 pm

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.
Last edited by keme on Wed Oct 01, 2014 3:57 pm, edited 1 time in total.
Apache OO 3.4.1/4.1.2/4.1.3, on Ms Windows 7/10 and Mac OS-X 10.8.5 and 10.11.
LibreOffice 4.3.3.2 on Mepis Antix MX 14
User avatar
keme
Volunteer
 
Posts: 3234
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

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

Postby acknak » Wed Oct 01, 2014 3:55 pm

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.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Postby John_Ha » Wed Oct 01, 2014 4:47 pm

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.
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6775
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby qazwiz » Wed Feb 11, 2015 1:40 pm

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
OpenOffice 4.1.1 using Windows 8.1
qazwiz
 
Posts: 5
Joined: Wed Feb 04, 2015 3:57 am

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

Postby John_Ha » Wed Feb 11, 2015 1:50 pm

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.
Attachments
Clipboard02.png
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6775
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby qazwiz » Wed Feb 11, 2015 2:04 pm

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
OpenOffice 4.1.1 using Windows 8.1
qazwiz
 
Posts: 5
Joined: Wed Feb 04, 2015 3:57 am

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

Postby John_Ha » Wed Feb 11, 2015 5:27 pm

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]
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6775
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby qazwiz » Thu Feb 12, 2015 2:10 am

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 )
OpenOffice 4.1.1 using Windows 8.1
qazwiz
 
Posts: 5
Joined: Wed Feb 04, 2015 3:57 am

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

Postby John_Ha » Thu Feb 12, 2015 12:50 pm

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!
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6775
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby acknak » Thu Feb 12, 2015 6:04 pm

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.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3


Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 2 guests