🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #2122

penalty inside a macro, problems with punctuation

#2122
From: Richard Beigel
Date: Wed, 12 Aug 1992 19:53
27 lines
1556 bytes
I would like to discourange line breaks inside a certain macro.
Somewhat naively I put negative penalties at the beginning and end of
the macro.  This does a good job of discouraging line breaks inside
the macro, but it has an unpleasant side-effect.  If the macro is
followed immediately by a period or comma, the new line starts with a
period or comma.

Question 1: is there a way to make the negative penalty effective
iff the next character is white space?

Here is the macro I used:
\newcommand{\machine}[1]{\penalty-500{\rm machine~[#1]}\penalty-500}

Things like "...\machine{control,input,stack}." often result in
"...machine [control, input, stack]
."

Question 2: is there a completely different may to do this?  Something
like \mbox{}, but which merely discourages line breaks, rather than
forbidding them?

-- 
Richard Beigel			telephone:  (203)432-1268
Dept. of Computer Science	email:  beigel-richard@cs.yale.edu
P.O. Box 2158, Yale Station	campus mail:  A. K. Watson Hall
New Haven, CT  06520-2158		      51 Prospect Street
Technical Details
Message-ID: <1992Aug12.195354.13725@cs.yale.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!cs.yale.edu!beigel-richard

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!cs.yale.edu!beigel-richard
From: beigel-richard@CS.YALE.EDU (Richard Beigel)
Subject: penalty inside a macro, problems with punctuation
Message-ID: <1992Aug12.195354.13725@cs.yale.edu>
Sender: news@cs.yale.edu (Usenet News)
Nntp-Posting-Host: beech.theory.cs.yale.edu
Organization: Yale University Computer Science Dept, New Haven CT  06520-2158
Date: Wed, 12 Aug 1992 19:53:54 GMT
Lines: 27