Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MikTeX and hanging punctuation

177 views
Skip to first unread message

William F. Adams

unread,
Jul 25, 1999, 3:00:00 AM7/25/99
to
I tried using the hanging punctuation code from the TeXBook and it failed with
a bizarre series of error messages---any idea why?

I'm using
\input hangingpunctuation.tex

with a file copied over from my NeXT (it works there in TeXView.app)
\newdimen\commahang \setbox0=\hbox{,} \commahang=\wd0
\newdimen\periodhang \setbox0=\hbox{.} \periodhang=\wd0
\newdimen\quotehang \setbox0=\hbox{`} \quotehang=\wd0
\newdimen\qquotehang \setbox0=\hbox{``} \qquotehang=\wd0
\newskip\zzz \def\allowhyphens{\nobreak\hskip\zzz}
\def\lqq{``} \def\rqq{''} \def\pnt{.}
\def\comma{,\kern-\commahang\kern\commahang}
\def\period{.\kern-\periodhang\kern\periodhang}
\def\rquote{'\kern-\quotehang\kern\quotehang}
\def\lquote{\ifhmode\kern\quotehang\vadjust{}\else\leavevmode\fe\kern-\quo
tehang`\allowhyphens}
\catcode`,=\active \let,=\comma \catcode`.=\active \let.=\period
\catcode`'=\active \def'{\futurelet\next\rqtest}
\catcode``=\active \def`{\futurelet\next\lqtest}
\def\rqtest{\ifx\next'\let\next=\rquotes\else\let\next=\rquote\fi\next}
\def\lqtest{\ifx\next`\let\next=\lquotes\else\let\next=\lquote\fi\next}
\def\rquotes'{\rqq\kern-\qquotehang\kern\qquotehang}
\def\lquotes`{\ifhmode\kern\qquotehang\vadjust{}\else\leavevmode\fi\kern-\
qquotehang\lqq\allowhyphens}

Here's the beginning of the log:
This is TeX, Version 3.14159 (MiKTeX 1.20b) (preloaded format=plain 1999.7.5)
25 JUL 1999 15:43
**1type
(1type.tex (hangingpunctuation.tex
\commahang=\dimen16
\periodhang=\dimen17
\quotehang=\dimen18
\qquotehang=\dimen19
\zzz=\skip18
)
! Illegal unit of measure (pt inserted).
<to be read again>
\kern
.->.\kern
-\periodhang \kern \periodhang
l.13 \vsize=3.
125in
?
! Illegal unit of measure (pt inserted).
<to be read again>
\kern
.->.\kern
-\periodhang \kern \periodhang
l.16 \hoffset=-.
5in
?
! Illegal unit of measure (pt inserted).
<to be read again>
\kern
.->.\kern
-\periodhang \kern \periodhang
l.18 \voffset=-.
3125in
?
! You can't use `\prevdepth' in horizontal mode.
\nointerlineskip ->\prevdepth
-1000\p@
\topglue ->\nointerlineskip
\vglue -\topskip \vglue
l.34 \topglue

?
! Missing number, treated as zero.
<to be read again>
\afterassignment
\vglue ->\afterassignment
\vgl@ \skip@ =
\topglue ->\nointerlineskip \vglue
-\topskip \vglue
l.34 \topglue

?
! Illegal unit of measure (pt inserted).
<to be read again>
\afterassignment
\vglue ->\afterassignment
\vgl@ \skip@ =
\topglue ->\nointerlineskip \vglue
-\topskip \vglue
l.34 \topglue

?
! Missing number, treated as zero.
<to be read again>
\vfill
l.35 \vfill

?
! Illegal unit of measure (pt inserted).
<to be read again>
\vfill
l.35 \vfill

?

Underfull \vbox (badness 10000) has occurred while \output is active
\vbox(3.0+0.0)x0.0
.\special{papersize=2.\kern -\periodhang \kern \periodhang 75in,\kern -\commaha
ng \ETC.}

[1]
Overfull \vbox (9.0pt too high) has occurred while \output is active
\vbox(3.0+2.78847)x144.54
.\glue(\topskip) 3.32141
.\hbox(6.67859+0.13998)x144.54, glue set 32.092fil
..\hbox(0.0+0.0)x20.0
..\tenrm 1
..\tenrm 2
..\tenrm 5
..\tenrm i
..etc.
.\rule(0.0+0.0)x*
.\penalty 10000
.\glue -10.0
.etc.

[2]
Overfull \vbox (7.0pt too high) has occurred while \output is active
\vbox(3.0+0.12642)x144.54
.\glue(\topskip) 5.02805
.\hbox(4.97195+0.12642)x144.54, glue set 66.96664fill
..\hbox(0.0+0.0)x20.0
..\glue 0.0 plus 1.0fill
..\lsc m
..\lsc a
..\lsc n
..etc.

[3]
Overfull \vbox (7.0pt too high) has occurred while \output is active
\vbox(3.0+0.13998)x144.54
.\glue(\topskip) 4.29204
.\hbox(5.70796+0.13998)x144.54, glue set 65.26036fill
..\hbox(0.0+0.0)x20.0
..\glue 0.0 plus 1.0fill
..\pad A
..\glue 2.0 plus 1.19879 minus 0.48045
..\pad G
..etc.

[4]
Overfull \vbox (7.0pt too high) has occurred while \output is active
\vbox(3.0+2.13994)x144.54
.\glue(\topskip) 3.92001
.\hbox(6.07999+2.13994)x144.54, glue set 76.96466fill
..\hbox(0.0+0.0)x20.0
..\glue 0.0 plus 1.0fill
..\it &
..\glue 2.0 plus 1.2 minus 0.47998
..\it I
..etc.

[5]
! Illegal unit of measure (pt inserted).
<to be read again>
\kern

--
William Adams
http://members.aol.com/willadams
Sphinx of black quartz, judge my vow.


William F. Adams

unread,
Jul 25, 1999, 3:00:00 AM7/25/99
to
David said:
>You seem to be processing a page/box sizing command with
>hanging punctuation active, which is probably Not Such A Good Idea.
>
>(Are you *sure* everything is identical with what ran on your NeXT?)

Oh. Well, the hangingpunctuation.tex file is identical, but the file I was
dropping it into was totally new. I'd never used the hangingpunctuation.tex
file in a document with pagesize specials before.

Thank you David, now I know not to do that.

BTW - why is it one shouldn't do that?

William

vepxistqaosani

unread,
Jul 25, 1999, 3:00:00 AM7/25/99
to William F. Adams
Because the period is \catcode'd to \active in the file you excerpted.
You cannot then use a period in a (from your log file) \vsize=3.125in,
because TeX attempts to process hanging punctuation code in the middle
of a <dimen> assignment.

What you can do is put something like
\def\threeAndAnEighth{3.125in}
before you start changing \catcode's and then
\vsize\threeAndAnEighth
will work.

However, do note that that's a really ugly hack. I would say that
whenever one finds oneself hacking away in so ugly a fashion, one should
rethink one's macros and come up with something better.

Good luck!

Fred

David Wilson

unread,
Jul 26, 1999, 3:00:00 AM7/26/99
to
William F. Adams wrote in message
<19990725155011...@ng-ch1.aol.com>...

>I tried using the hanging punctuation code from the TeXBook and it
failed with
>a bizarre series of error messages---any idea why?
>
<snip>

>! Illegal unit of measure (pt inserted).
><to be read again>
> \kern
>.->.\kern
> -\periodhang \kern \periodhang
>l.13 \vsize=3.
> 125in
You seem to be processing a page/box sizing command with
hanging punctuation active, which is probably Not Such A Good Idea.

(Are you *sure* everything is identical with what ran on your NeXT?)

David Wilson


Tobias Kunstmann

unread,
Jul 26, 1999, 3:00:00 AM7/26/99
to
vepxistqaosani wrote:

> Because the period is \catcode'd to \active in the file you excerpted.
> You cannot then use a period in a (from your log file) \vsize=3.125in,
> because TeX attempts to process hanging punctuation code in the middle
> of a <dimen> assignment.
>
> What you can do is put something like
> \def\threeAndAnEighth{3.125in}
> before you start changing \catcode's and then
> \vsize\threeAndAnEighth
> will work.
>
> However, do note that that's a really ugly hack. I would say that
> whenever one finds oneself hacking away in so ugly a fashion, one should
> rethink one's macros and come up with something better.
>
> Good luck!
>
> Fred
>

Look at the line

\def\lqq{``} \def\rqq{''} \def\pnt{.} .

You just say something like

\vsize=3\pnt125in ,

i.e., replace the period by the control sequence \pnt whenever it is not to be
typeset. The same applies to
`` (use \lqq) and '' (use \rqq).

Tobias


Frank STENGEL

unread,
Jul 26, 1999, 3:00:00 AM7/26/99
to
William F. Adams <will...@aol.com> wrote:

[snip]


> \def\lquote{\ifhmode\kern\quotehang\vadjust{}\else\leavevmode\fe\kern-\quo

^^^
That should be \fi shouldn't it ? :-)

I tried it, it works fine with LaTeX, that is as long as you keep the
hanging punctuation local (i.e. inside a group, or better, inside a
specific environment) and don't play around too much with box dimension.

your problem is somehow described in the TeXbook (Appendix D, p395) in
the statement:
``The macros \pnt, \lq, and \rq should be used in constants; for
example, a dimension of 6.5in must be written `6\pnt5in' when hanging
punctuation is in effect, and `\catcode\lq,=12' makes commas inactive
again.''

So what broke your code was your \vsize=3.125in with the period active,
that is while hanging punctuation is active, which TeX interpreted as
\vsize=3.\kern-\periodhang\kern\periodhang125in with a non active period
this time. TeX then chokes on the \kern.

By the way, the example in the TeXbook (Appendix D, p394) starts with a
hanging punctuation. I could not get the first one in the example
provided, that is the `` before What, to stick out. How can I do it?

Frank STENGEL (fste...@nordnet.fr)

Peter Wilson

unread,
Jul 26, 1999, 3:00:00 AM7/26/99
to William F. Adams
William F. Adams wrote:
>
> I tried using the hanging punctuation code from the TeXBook and it failed with
> a bizarre series of error messages---any idea why?
>
<snip>

Take a look at the hanging package. It has a LaTeX version of the
hanging code, and the documentation notes that within a hanging
punctuation group you have to use a command for occasions when
punctuation characters are used but not as punctuation (e.g., as in a
\setlength{\mylen}{2.5pt} command where the full stop/period is part of
a length value).

Peter W.
peter.r...@boeing.com

William F. Adams

unread,
Jul 28, 1999, 3:00:00 AM7/28/99
to
Just wanted to say thank you to everyone who chimed in on this---am now on to
my next problem (Tex capacity exceeded) and trying to get the other half of
this, hanging hyphenation.

Frank---I'm not sure about the leading quote thing--will experiment and report
back.

Peter Wilson

unread,
Jul 28, 1999, 3:00:00 AM7/28/99
to William F. Adams
William F. Adams wrote:
>
> Just wanted to say thank you to everyone who chimed in on this---am now on to
> my next problem (Tex capacity exceeded) and trying to get the other half of
> this, hanging hyphenation.
>

As Knuth says, you need a zero width hyphen to do this. I tried all
sorts of ways of fooling TeX into thinking that the CM hyphens were zero
width, but to no avail. However, Stefan Ulrich
(ulr...@cis.uni-muenchen.de) pointed out to me that the EC fonts have a
hyphen with a smaller width at position 127, and that you can get
semi-hanging hyphens in LaTeX via:
\usepackage[T1]{fontenc}
\hyphenchar\font=127

Peter W.
peter.r...@boeing.com

Jonathan Fine

unread,
Aug 3, 1999, 3:00:00 AM8/3/99
to
vepxistqaosani <fb...@sprynet.com> writes
[snip]

>What you can do is put something like
> \def\threeAndAnEighth{3.125in}
>before you start changing \catcode's and then
> \vsize\threeAndAnEighth
>will work.
>
>However, do note that that's a really ugly hack. I would say that
>whenever one finds oneself hacking away in so ugly a fashion, one should
>rethink one's macros and come up with something better.

I agree. This is one of the reasons why I came up with Active TeX.

By chance, this month's posting to my web site contains an Active TeX
implementation of hanging punctuation. Enjoy. (If you're going to
change \catcode's, why not go the whole way, and make everything
active!)
http://www.active-tex.demon.co.uk

Jonathan Fine, Cambridge, UK
http://www.active-tex.demon.co.uk/fine.html

0 new messages