How to reformat a paragraph?

S

Stephen Speicher

I have used the Vim editor and now want to learn Microsoft Word.
In Word, how do I get the following fragmented text to look like
the formatted text which follows? In Vim I just "set tw=65" and
"11gq" and the 11 fragmented lines are formatted into 65 character
long lines.

The metric
establishes the inner product of vectors at
every point, while
the connection defines the parallel transport. Curvature and
torsion are properties of the connection,
and more than one
connection can exist in the same space. In teleparallel
gravitational theory
the torsion, which is the antisymmetric part
of the connection,
is not identically zero as in standard theory.


The metric establishes the inner product of vectors at every
point, while the connection defines the parallel transport.
Curvature and torsion are properties of the connection, and more
than one connection can exist in the same space. In teleparallel
gravitational theory the torsion, which is the antisymmetric part
of the connection, is not identically zero as in standard theory.

--
Stephen
(e-mail address removed)

Ignorance is just a placeholder for knowledge.

Printed using 100% recycled electrons.
-----------------------------------------------------------
 
J

Jay Freedman

Hi, Stephen,

First, please understand that Word doesn't consider "lines" to be
anything user-controllable, nor is there any concept of "characters
per line". This is because Word works mainly with proportional fonts,
and whatever fits between the margins -- on the basis of the actual
characters, their intrinsic widths and spacing, and the advice of the
printer driver -- is what you get.

Instead, the most important unit of text is the paragraph, defined as
a run of characters ending in a paragraph mark (visible as a ¶ symbol
if you display nonprinting characters).

What you should do in Word is remove all the extraneous paragraph
marks -- the ones that are holding your line-ends -- and leave only
the ones that are really at the ends of paragraphs. For that, you can
use the Replace dialog as explained at
http://www.mvps.org/word/FAQs/Formatting/CleanWebText.htm.

If it's important to limit the line lengths to 65 characters, then you
must format the text in a nonproportional font such as Courier New,
and set the margins and/or paragraph indents so that the lines wrap at
the proper place. Conveniently, 12-point Courier New is exactly 10
characters per inch, so a 6.5-inch text column will hold 65
characters.
 
S

Stephen Speicher

[...]

That was very helpful, Jay. I followed the procedure for "paste
special"
and "autoformat" and indeed the fragmented text was formatted
correctly. However, when I do the same with the fragmented text
prefaced by one or more ">" characters, Word seems to get confused
and does not format the lines correctly. What must I do so that Word
will format the fragmented lines when they are prefaced with the usual
email and newsgroup standard ">" characters?

Also, in Word when I try to reply to an email message I cannot seem
to get Word to put in the standard ">" characters. Is there some
setting
for this that I am missing?

Thanks.
 
G

Graham Mayor

Much the easiest way to deal with e-mail messages is to use the Stripmail
tool linked from the download page of my web site
http://www.gmayor.com/downloads.htm. This strips the unwanted stuff at a
keystroke, which can then be pasted into a Word document.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

Stephen said:
[...]

That was very helpful, Jay. I followed the procedure for "paste
special"
and "autoformat" and indeed the fragmented text was formatted
correctly. However, when I do the same with the fragmented text
prefaced by one or more ">" characters, Word seems to get confused
and does not format the lines correctly. What must I do so that Word
will format the fragmented lines when they are prefaced with the usual
email and newsgroup standard ">" characters?

Also, in Word when I try to reply to an email message I cannot seem
to get Word to put in the standard ">" characters. Is there some
setting
for this that I am missing?

Thanks.
 
S

Stephen Speicher

Graham Mayor said:
Much the easiest way to deal with e-mail messages is to use the Stripmail
tool linked from the download page of my web site
http://www.gmayor.com/downloads.htm. This strips the unwanted stuff at a
keystroke, which can then be pasted into a Word document.

Thanks, but either you misunderstood or I was not clear. I do not want
to
strip away the ">" characters which are part of the email. I want word
to
reformat fragmented lines which have ">" characters preceeding them.
So, for instance, I want
This is an example
of a problem I have with text in Word.

To look like
This is an example of a problem I have with text in Word.

The technique which I got from the website -- using "paste special"
and
"autoformat" -- which the previous poster suggested, worked just fine.
However, when the fragmented text is prefaced by ">" characters, that
technique in Word gets all confused (perhaps taking the ">" characters
for bullets).
 
T

TF

Stephen

You can make vertical selections in Word. Place the cursor immediately in
front of the first chevron (>). Hold down the Alt Key and then use the mouse
to Shift/Drag the selection down though all the chevrons until the are all
selected. Press Delete. Then run the macro to remove all the end of line
paragraph marks.

--
Terry Farrell - Word MVP
http://www.mvps.org/word/



Graham Mayor said:
Much the easiest way to deal with e-mail messages is to use the Stripmail
tool linked from the download page of my web site
http://www.gmayor.com/downloads.htm. This strips the unwanted stuff at a
keystroke, which can then be pasted into a Word document.

Thanks, but either you misunderstood or I was not clear. I do not want
to
strip away the ">" characters which are part of the email. I want word
to
reformat fragmented lines which have ">" characters preceeding them.
So, for instance, I want
This is an example
of a problem I have with text in Word.

To look like
This is an example of a problem I have with text in Word.

The technique which I got from the website -- using "paste special"
and
"autoformat" -- which the previous poster suggested, worked just fine.
However, when the fragmented text is prefaced by ">" characters, that
technique in Word gets all confused (perhaps taking the ">" characters
for bullets).
 
S

Stephen Speicher

TF said:
Stephen

You can make vertical selections in Word. Place the cursor immediately in
front of the first chevron (>). Hold down the Alt Key and then use the mouse
to Shift/Drag the selection down though all the chevrons until the are all
selected. Press Delete. Then run the macro to remove all the end of line
paragraph marks.

Thanks Terry, but again, I do _not_ want to remove the chevrons --
I want them to remain as integral to the text. Permit me to give
another example. Given this text between the lines of asterisks:

**********************************************
This is a
simple example of
a problem which I have that
I would like to easily
solve
in Word.
**********************************************

In the easiest way I want Word to take the preceeding text
and give this as a result:

**********************************************
This is a simple example of a problem which I have that I
would like to easily solve in Word.
**********************************************

Can you tell me the easiest way to use Word to transform
those first lines which are fragmented, into the nicely formatted
result above? Please realize that this is just the simplest example
and that the actual text I will be using can have multiple chevrons
just as occurs in usual email and newsgroup postings.

Thanks.
 
G

Graham Mayor

There is no automatic way to do that.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
G

Graham Mayor

I may have been hasty in my reply. Stripmail that I previously suggested,
will go a long way to achieving what you want. It will convert your example
lines to a single paragraph.
This is a simple example of a problem which I have that I would like to
easily solve in Word.

Paste > strip > paragraph > indent


--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
T

TF

Stephen

Sorry, I slightly misunderstood. There really is no way to do that.

Terry


TF said:
Stephen

You can make vertical selections in Word. Place the cursor immediately in
front of the first chevron (>). Hold down the Alt Key and then use the mouse
to Shift/Drag the selection down though all the chevrons until the are all
selected. Press Delete. Then run the macro to remove all the end of line
paragraph marks.

Thanks Terry, but again, I do _not_ want to remove the chevrons --
I want them to remain as integral to the text. Permit me to give
another example. Given this text between the lines of asterisks:

**********************************************
This is a
simple example of
a problem which I have that
I would like to easily
solve
in Word.
**********************************************

In the easiest way I want Word to take the preceeding text
and give this as a result:

**********************************************
This is a simple example of a problem which I have that I
would like to easily solve in Word.
**********************************************

Can you tell me the easiest way to use Word to transform
those first lines which are fragmented, into the nicely formatted
result above? Please realize that this is just the simplest example
and that the actual text I will be using can have multiple chevrons
just as occurs in usual email and newsgroup postings.

Thanks.
 
L

Larry

Here's a macro that will leave an arrow (or up to three arrows) at the
beginning of each paragraph, though not at the beginning of each line.
(This macro has an additional job which is to restore paragraph
divisions in those occasional e-mails in which they're lacking, by
inserting double paragraph break where at present there is one. if you
don't want this, you can delete everything between the dotted lines.)


Sub EMailLeaveArrowsCleanup()
' by Larry. This macro works with the function following the macro.

Application.ScreenUpdating = False

'-----------------------
' beginning of code to insert double para breaks at apparent paragraph
breaks.

' looks for sentence end followed by line break, add line break
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\!\?])^l"
.Replacement.Text = "\1^l^l"
.MatchWildcards = True
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

' looks sentence end followed by any size space followed by line break
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\!\?]) {1,}^l"
.Replacement.Text = "\1^l^l"
.MatchWildcards = True
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

' looks for line break immediately following sentence end followed by
quote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\!\?])("")^l"
.Replacement.Text = "\1\2^l^l"
.MatchWildcards = True
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

' looks sentence end with quote followed by any size space followed by
line break
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\!\?])("") {1,}^l"
.Replacement.Text = "\1\2^l^l"
.MatchWildcards = True
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
' end of section for inserting double paragraph breaks.
'----------------------------------
' Main code begins here.

'deletes arrows that appear between two line breaks so line breaks will
be at margin
Call DoFindReplace("^l>^l", "^l^l", False)
'deletes arrows followed by space that appear between two line breaks
Call DoFindReplace("^l> ^l", "^l^l", False)
'deletes arrow followed by space followed by arrow between two line
breaks
Call DoFindReplace("^l> >^l", "^l^l", False)
' changes double line breaks to double paras
Call DoFindReplace("^l^l", " ^p^p", False)
' replaces line breaks with space
Call DoFindReplace("^l", " ", False)
' change arrows to crosses
Call DoFindReplace(">", "+", False)
' remove spaces after crosses
Call DoFindReplace("+ ", "+", False)
' remove spaces before crosses
Call DoFindReplace(" +", "+", False)
' reduce multiple crosses to three
Call DoFindReplace("+{4,}", "+++", False)
' change three crosses at left margin to three arrows
Call DoFindReplace("^13+++", "^p>>> ", False)
' change two crosses at left margin to two arrows
Call DoFindReplace("^13++", "^p>> ", False)
' change one cross at left margin to arrow
Call DoFindReplace("^13+", "^p> ", False)
' change remaining crosses to space
Call DoFindReplace("+{1,}", " ", True)

Selection.Find.MatchWildcards = False

' change single hyphens surrounded by space to double nonbreaking
hyphens
Call DoFindReplace(" - ", "^~-", False)

End Sub


Function DoFindReplace(findText As String, ReplaceText As String, _
bMatchWildCards As Boolean)

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWildcards = bMatchWildCards
.Text = findText
.Replacement.Text = ReplaceText
.Forward = True
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
'Free up some memory
ActiveDocument.UndoClear
End With

End Function
 
L

Larry

You will need to add comments (the apostophe mark) at the beginnings of
those commented lines that ran over to a second line in the message.

Also, I had to make some changes in the macro before sending it to you,
and it may not run perfectly in all situations. If you have any
problems, write back to the group and I'll try to help you.

Larry
 
S

Stephen Speicher

Graham said:
I may have been hasty in my reply. Stripmail that I previously
suggested, will go a long way to achieving what you want. It will
convert your example lines to a single paragraph.


Paste > strip > paragraph > indent

Graham, I realize that you are trying to be helpful -- and, I
appreciate
that fact -- but you too seem to be missing the point. As I mentioned
in my post there can be multiple levels of ">" prefacing each line, so
after I use "strip" I cannot return the text to the proper level of
">"
using indent, which only puts in a single indent on each line.

Just look right up above for an example, where the "This is a ..." is
prefaced by two levels of ">" while the preceding text has only one
level. This is a standard format for most email and newsgroup
messages, and I am really amazed that such an otherwise powerful
editor such as Word is unable to handle something so basic.

--
Stephen
(e-mail address removed)

Ignorance is just a placeholder for knowledge.

Printed using 100% recycled electrons.
-----------------------------------------------------------
 
S

Stephen Speicher

Larry said:
Here's a macro that will leave an arrow (or up to three arrows) at
the beginning of each paragraph, though not at the beginning of
each line.

Thanks Larry, but I really need to have the editor maintain whatever
level of ">" the text has, _on each line_. That is, afterall, the
usual
format for email and newsgroup messages.

--
Stephen
(e-mail address removed)

Ignorance is just a placeholder for knowledge.

Printed using 100% recycled electrons.
-----------------------------------------------------------
 
G

Graham Mayor

I am not missing the point. As I indicated earlier, there is no way to do
this automatically. It is not the simple exercise that you imagine. When you
insert an e-mail message, you are inserting plain text and the chevrons are
text characters like any other. Word has no way of knowing which of those
you want to keep and which you want to discard merely to change the line
length to some arbitrary figure that you feel would look attractive, a
problem that would become further exaccerbated if you chose to use
proportional fonts, whereby you could not even provide a fixed line length..

Word does have an autoformat option for e-mail, but I doubt that it will
give you anything like the control you want. Most people would simply want
all the excess formatting stripped to produce a standard readable document
and it is this that the suggested application does simply and well.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top