Generalspacing after periods

LaTeX specific issues not fitting into one of the other forums of this category.
darckhart
Posts: 34
Joined: Mon Jul 09, 2007 4:04 am

spacing after periods

Post by darckhart »

Well Stefan I sure am glad I ran into you! Those last two references were fantastic, although I do not quite understand what is happening with the example at the bottom of pg182 in this new book. Perhaps you can help clarify it.

Their example says that sfcode for a is 1000, thus spacefactor becomes 1000. Suppose the next character was a period, whose sfcode is 3000, thus making f=3000. Now the subsequent space will be increased. This is good since, say, the period was the end of the sentence. Now the following example has the letter A, whose sfcode is 999, thus f=999. This character is followed by the period, whose sfcode was 3000, and now he says f=1000. What?? I don't get it. How did it become 1000?

Perhaps you can also comment on my method to find the correct spacing after a period for txfonts at 12pt:
From the first reference, at the bottom of pg75 after the period he has spacing should be 4.44444 plus 4.99997 minus 0.37036. For cmr 10,

Code: Select all

fontdimen2=3.33333
fontdimen3=1.66666
fontdimen4=1.11111
fontdimen7=1.11111
From the reading, I gathered the equations should be:

if (f <= 1000)
then (Interword space = fontdimen2+fontdimen3-fontdimen4)

if (f >= 2000)
then (Interword space = (fontdimen2+fontdimen7) + (fontdimen3*f/1000) + (fontdimen4*1000/f))

Since it ended with a lowercase character then period, I assume f=3000. Using the 2nd equation, I get (3.33333+1.11111)+(1.66666*3000/1000)+(1.11111*1000/3000), which is exactly what he got.

Applying this to txfonts at 12pt (whose values I determined using that bit of code you showed me previously):

Code: Select all

fontdimen2=3.00000
fontdimen3=1.79999
fontdimen4=0.72000
fontdimen7=0.72000
spacing after a period ending a sentence should be: assume f=3000
(3.00000+0.72000)+(1.79999*3000/1000)+(0.72000*1000/3000)=9.490336.

So I conlude that I must set xspaceskip=9.949034pt to get the correct spacing after the period. This is very close to the 10pt I tried yesterday by eyeballing it!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

spacing after periods

Post by Stefan Kottwitz »

Hi darckhart!
darckhart wrote:Now the following example has the letter A, whose sfcode is 999, thus f=999. This character is followed by the period, whose sfcode was 3000, and now he says f=1000. What?? I don't get it. How did it become 1000?
See TeXbook p76 right before Exercise 12.7: In other words, f doesn't jump from a value less than 1000 to a value greater than 1000 in a single step. Uppercase letters have code 999. The result is that punctuation after an uppercase letter is treated like an abbreviation, not like the end of a sentence (dot following lowercase letter with code 1000).
darckhart wrote:Perhaps you can also comment on my method to find the correct spacing after a period for txfonts at 12pt... spacing after a period ending a sentence should be: assume f=3000
(3.00000+0.72000)+(1.79999*3000/1000)+(0.72000*1000/3000)=9.490336.
So I conlude that I must set xspaceskip=9.949034pt to get the correct spacing after the period.
That's not right, you cannot just add the values. stretch and shrink must kept separated. Calculating similar I get 3.72000pt plus5.39997pt minus 0.24000pt.

But let's also think about a different and simple way, if the exact spacing would be very important, no stretch and no shrink: one could just end sentences with quoted spaces:

Code: Select all

One sentence.\ \ Another sentence.
Stefan
LaTeX.org admin
darckhart
Posts: 34
Joined: Mon Jul 09, 2007 4:04 am

Re: spacing after periods

Post by darckhart »

Oh I see. So what it means is that if f_prev was less than 1000, the highest f_current can be is 1000.

Ah I need to keep the terms separated. Is it then possible to use that expression in setting the xspaceskip value? If so, how would I write it?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

spacing after periods

Post by Stefan Kottwitz »

Set this expression by

Code: Select all

\setlength{\xspaceskip}{3.72000pt plus5.39997pt minus 0.24000pt}
It may hard to fulfil "two spaces" if the justification algorithm should use stretch/shrink to improve justification. ;)
But a bigger base value should do it, some stretch and shrink would not be bad I think. Why not use double values. The rest is up to the layout algorithm. Even word stretches the space between words, today it's not usual anymore to write in monospaced font where each letter and every space has the same width.

Stefan
LaTeX.org admin
darckhart
Posts: 34
Joined: Mon Jul 09, 2007 4:04 am

Re: spacing after periods

Post by darckhart »

Ok I think I've got it now. Thanks for all your help!
SpectrumX
Posts: 7
Joined: Fri Dec 20, 2013 5:55 pm

Re: spacing after periods

Post by SpectrumX »

Hello,

A late reply to this post but it is linked to something I wish to have in lyx. Currently, there is no option that force a white space after every full-stop. I wonder If I can write a macro in LYX that force this behavior instead of looking for each missing space after period in the whole long document?

Any ideas??

Cheers.
Post Reply