Page LayoutEnding page with fullstop

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
llewellyn
Posts: 17
Joined: Mon Feb 04, 2008 8:20 pm

Ending page with fullstop

Post by llewellyn »

I am using memoir class in LyX to write story books.

I want to make TeX always end a page at a full stop or period. In the book »TeX for the impatient« I found the following.
\brokenpenalty [ (number) parameter ]

This parameter specifies the penalty for breaking a page just after a line that ends in a discretionary item (usually a hyphen). \brokenpenalty applies to page breaking, while \hyphenpenalty (p. 125) applies to line breaking. Plain TEX sets \brokenpenalty to 100.
Please could some kind and knowledgeable person tell me how I get this command to look for a full stop. I believe that I can use it in the Latex preamble with a negative number for the penalty so as to strongly encourage the page break to occur at a full stop.I am not clever enough to know how to tell it to use a full stop as the criteria. I will of course also put \Raggedbottom in the preamble to facilitate the variations in page length that this will cause.

Thanks
llewellyn Lee.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Ending page with fullstop

Post by josephwright »

A discretionary item is a hyphen, not a full stop, so \brokenpenalty will not help. I think you'd have to make "." active to encourage a line break. Something like

Code: Select all

\let\savedfullstop.
\catcode`\.=\active
\def.{\savedfullstop\penalty-1000\relax}
You'll need to adjust the \penalty value here to be 'right' for what you want.
Joseph Wright
llewellyn
Posts: 17
Joined: Mon Feb 04, 2008 8:20 pm

Re: Ending page with fullstop

Post by llewellyn »

A heartfelt thanks Josephwright. I do not know enough to formulate the code that you have given me but I do know enough to know it will work, I will Post here to let all know when I have it working.
I will also see if I can get this put in the manual for memoireclass because with this added I expect to have very near perfect page breaking.
Thank you so much.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Ending page with fullstop

Post by localghost »

llewellyn wrote:[…] I will also see if I can get this put in the manual for memoireclass because with this added I expect to have very near perfect page breaking. […]
The provided code is a general approach thus has nothing to do in a specific manual.


Thorsten
llewellyn
Posts: 17
Joined: Mon Feb 04, 2008 8:20 pm

Re: Ending page with fullstop

Post by llewellyn »

Perhaps then in the tips and tricks section of the LYX manual ???

As a person who justs want to write books without getting too embedded in the technical stuff I find LYX and Latex with Memoir class make it so very easy to produce fantastic looking manuscripts.
From my roaming on "writers" community websites there are thousands of others like me
and I would like to ensure they can all get this neat extra trick.

BECAUSE I ASKED THE WRONG QUESTION in this thread any one who wants to solve the same problem will not find this answer by searching this site and I wonder if there is anyway for me to help others who are looking for this answer to find it. ???
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Ending page with fullstop

Post by localghost »

llewellyn wrote:Perhaps then in the tips and tricks section of the LYX manual ??? […]
Not really. Perhaps the LyX Wiki. But I think a search engine will be able to find this thread here.
llewellyn wrote:[…] As a person who justs want to write books without getting too embedded in the technical stuff I find LYX and Latex with Memoir class make it so very easy to produce fantastic looking manuscripts. […]
You advertised this repeatedly. Now everybody should know.
llewellyn wrote:[…] From my roaming on "writers" community websites there are thousands of others like me and I would like to ensure they can all get this neat extra trick. […]
See remarks above. Finally you can refer to this thread. From my experience LyX users are in the single-digit percent range from those working with LaTeX. You seem to know almost the whole LyX community.
llewellyn wrote:[…] BECAUSE I ASKED THE WRONG QUESTION in this thread any one who wants to solve the same problem will not find this answer by searching this site and I wonder if there is anyway for me to help others who are looking for this answer to find it. ???
I don't think this is the wrong question in the wrong place.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Ending page with fullstop

Post by meho_r »

I don't think it's a good idea to limit LaTeX breaking mechanism so much. Preventing hyphenation at the end of a page sounds as a reasonable request (although I think that even that isn't really necessary), but requesting that a page ends with a full stop may be overkill and will almost certainly lead to suboptimal word spacing. So, be ready to use \sloppy command a lot as well as to encounter abnormally large spacing between words as a result. A long way from perfect page breaking...
llewellyn
Posts: 17
Joined: Mon Feb 04, 2008 8:20 pm

Re: Ending page with fullstop

Post by llewellyn »

Sadly I have to report that the code provided by Josephwright does not work
\let\savedfullstop.
\catcode`\.=\active
\def.{\savedfullstop\penalty-1000\relax}

I entered this in the preamblen found under settings in LYX.
When I tried to see the DVI
I got two error messages
Latex error: missing \begin(document)
Latex error:file "English\savedfullstop\penalty-1000\relax ldf.tex" not found

I could go rambeling on about what I tried, to fix this but it will only cloud the issue. Can anybody see what might be throwing up the error please.

Meho_r your comment noted. However as this will be worked in conjunction with \ragged bottom I hope it will not have too much effect on the lines and just cause latex to make the page one or two lines shorter. To help it I will try reducing the \widowpenalty and \clubpenalty that I currently have in the preamble.
llewellyn
Posts: 17
Joined: Mon Feb 04, 2008 8:20 pm

Re: Ending page with fullstop

Post by llewellyn »

I still have not solved this problem Please won't someone help
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Ending page with fullstop

Post by josephwright »

Making . active is risky, and should probably happen after the start of the document. In normal LaTeX I'd do

Code: Select all

\AtBeginDocument{
 \let\savedfullstop.
 \catcode`\.=\active
 \def.{\savedfullstop\penalty-1000\relax}
}
Joseph Wright
Post Reply