how do i underline all book and journal titles in a long bibliogra

G

Guest

Hi. I'm using Word 2000. I have a bibliography in the third column of a
three-column table that is 90 pages long. How do I underline all book and
journal titles in the bibliography without doing each one by hand? I've tried
using my limited knowledge of wildcards, to no avail.

In general, a book entry looks like this:

Gammell, R. H. Ives. 1986. The Boston Painters, 1900–1930. Orleans, Mass.

I want to underline The Boston Painters, 1900–1930. (including the final
period)

In general, a journal entry looks like this:

Frankfurter, Alfred M. 1931. "Thirty-Five Portraits from American
Collections." Art News Annual 29 (May 16): 3–4.

I want to underline Art News Annual.

Any help much appreciated.
 
T

Tony Jollans

So, in English, how would you state what has to be underlined?

Your entries seem to start with a Author Name (which may include periods)
followed by a period.
Followed by a space and a year and a period and a space.

... then ...

In your first example, the rest of the line / paragraph / cell is the title,
but
In your second example it seems (to me) to be an arbitrary part of the
following text.
 
G

Guest

Thanks for responding. Book entries go like this (I want to underline the
book title):

Last name, First name. Year. Book Title Which May or May Not Contain Numbers
But Does Not Contain Quote Marks. City and Sometimes State or Country.

Journal entries go like this (I want to underline the journal title):


Last name, First name. Year. "Article Title." Journal Title number (month):
number–number.

How can I do this using wildcards? Or is there an easier method?

Much appreciated.
 
T

Tony Jollans

First off, this cannot be done with Find and Replace via the UI.

It *might* be possible with some VBA wrapped around an F&R,

It isn't easy to recognise City names which may or may not be present and
which may, I suppose, also happen to be in a title. To do this at all there
has to be something identifiable which ends the title - a full stop will do
but I guess titles could contain them. What about the penultimate full stop
in the line? How are 'lines' terminated by the way?

Similarly with Journals - you need something which categorically marks the
end of the title.Will a Journal Title ever contain a number?

Finally, is there any surefire way to differentiate between a book and a
journal?

The critical questions (from the above) that I see at the moment are
identifying the end of the book title - and the end of the 'line' (if each
is in a table cell by itself that is fine).
 
G

Guest

Book Titles always end with a period. But then there are also periods
elsewhere in each entry. The titles themselves don't contain periods other
than the final one.

Journal Titles will not contain numbers, so the subsequent space and volume
number could mark the end of the journal title.

I don't think there's a way to differentiate journal from book titles. Some
book titles, by the way, end in dates, e.g., The History of Psychiatry,
1832–1932.

Each full book or journal entry with all its publication data takes up one
cell in the table.

This underlining doesn't have to be a totally perfect method. I'm going to
read and edit the whole bibliography after I do the underlining, so I can
catch anything that went wrong. I'm just hoping not to have to do too much
fixing of things that went wrong.

I've never worked with VBA, but if you can give me some simple (?)
instructions I can probably manage it.

Many thanks!
 
T

Tony Jollans

Try this - I doubt it's perfect but it should be a start.

I used the Selection so I could see what I was doing - it would be better
using a non-Selection Range but if you only want it for one document it's
probably not worth the effort to change it.

Sub Macro8()

Selection.HomeKey Unit:=wdStory

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchFuzzy = False
.MatchWildcards = True
End With

While Selection.Find.Execute(FindText:="<*. [0-9]{4}. ")
' Should have Author and Year
Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=1
If Selection.Text = """" Then
' This is a Journal - skip quoted string
Selection.Collapse wdCollapseEnd
Selection.MoveUntil cset:="""", Count:=wdForward
' Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=2
Selection.Collapse wdCollapseEnd
' Should now be at start of Journal Title
Selection.MoveEndUntil cset:="0123456789", Count:=wdForward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Else
' This is a Book
' Gonna have to go with penultimate period
Selection.MoveEndUntil cset:=Chr(7), Count:=wdForward
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
End If
Selection.Font.Underline = wdUnderlineSingle
Selection.Collapse wdCollapseEnd
Wend

End Sub

See http://www.gmayor.com/installing_macro.htm for help to use the code if
you don't know what you are doing.
 
G

Guest

Well, thank you very much for taking the time to put that together. I don't
have the slightest idea what it means, but I will follow that link and see
what I can do. THen I'll let you know.
--
The Monk


Tony Jollans said:
Try this - I doubt it's perfect but it should be a start.

I used the Selection so I could see what I was doing - it would be better
using a non-Selection Range but if you only want it for one document it's
probably not worth the effort to change it.

Sub Macro8()

Selection.HomeKey Unit:=wdStory

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchFuzzy = False
.MatchWildcards = True
End With

While Selection.Find.Execute(FindText:="<*. [0-9]{4}. ")
' Should have Author and Year
Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=1
If Selection.Text = """" Then
' This is a Journal - skip quoted string
Selection.Collapse wdCollapseEnd
Selection.MoveUntil cset:="""", Count:=wdForward
' Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=2
Selection.Collapse wdCollapseEnd
' Should now be at start of Journal Title
Selection.MoveEndUntil cset:="0123456789", Count:=wdForward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Else
' This is a Book
' Gonna have to go with penultimate period
Selection.MoveEndUntil cset:=Chr(7), Count:=wdForward
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
End If
Selection.Font.Underline = wdUnderlineSingle
Selection.Collapse wdCollapseEnd
Wend

End Sub

See http://www.gmayor.com/installing_macro.htm for help to use the code if
you don't know what you are doing.
 
G

Guest

OK, I've tried your code and when I try to run it I get "Compile Error: Sub
or Function not defined." Any ideas?

Many thanks.
--
The Monk


Tony Jollans said:
Try this - I doubt it's perfect but it should be a start.

I used the Selection so I could see what I was doing - it would be better
using a non-Selection Range but if you only want it for one document it's
probably not worth the effort to change it.

Sub Macro8()

Selection.HomeKey Unit:=wdStory

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchFuzzy = False
.MatchWildcards = True
End With

While Selection.Find.Execute(FindText:="<*. [0-9]{4}. ")
' Should have Author and Year
Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=1
If Selection.Text = """" Then
' This is a Journal - skip quoted string
Selection.Collapse wdCollapseEnd
Selection.MoveUntil cset:="""", Count:=wdForward
' Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=2
Selection.Collapse wdCollapseEnd
' Should now be at start of Journal Title
Selection.MoveEndUntil cset:="0123456789", Count:=wdForward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Else
' This is a Book
' Gonna have to go with penultimate period
Selection.MoveEndUntil cset:=Chr(7), Count:=wdForward
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
End If
Selection.Font.Underline = wdUnderlineSingle
Selection.Collapse wdCollapseEnd
Wend

End Sub

See http://www.gmayor.com/installing_macro.htm for help to use the code if
you don't know what you are doing.
 
T

Tony Jollans

Hmm....

What line (or word) is highlighted?

I am on Word 2003 and have some odd things enabled so generated code on my
machine may well not work on your Word 2000.

Any of the lines which start .Match and which give you trouble can be
deleted. Most likely these ones ....

.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchFuzzy = False

Delete them all if you like - and post back if you still have problems.

--
Enjoy,
Tony


Abbey of Farfa said:
OK, I've tried your code and when I try to run it I get "Compile Error: Sub
or Function not defined." Any ideas?

Many thanks.
--
The Monk


Tony Jollans said:
Try this - I doubt it's perfect but it should be a start.

I used the Selection so I could see what I was doing - it would be better
using a non-Selection Range but if you only want it for one document it's
probably not worth the effort to change it.

Sub Macro8()

Selection.HomeKey Unit:=wdStory

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchFuzzy = False
.MatchWildcards = True
End With

While Selection.Find.Execute(FindText:="<*. [0-9]{4}. ")
' Should have Author and Year
Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=1
If Selection.Text = """" Then
' This is a Journal - skip quoted string
Selection.Collapse wdCollapseEnd
Selection.MoveUntil cset:="""", Count:=wdForward
' Selection.Collapse wdCollapseEnd
Selection.MoveEnd Unit:=wdCharacter, Count:=2
Selection.Collapse wdCollapseEnd
' Should now be at start of Journal Title
Selection.MoveEndUntil cset:="0123456789", Count:=wdForward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Else
' This is a Book
' Gonna have to go with penultimate period
Selection.MoveEndUntil cset:=Chr(7), Count:=wdForward
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Selection.MoveEndUntil cset:=".", Count:=wdBackward
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
End If
Selection.Font.Underline = wdUnderlineSingle
Selection.Collapse wdCollapseEnd
Wend

End Sub

See http://www.gmayor.com/installing_macro.htm for help to use the code if
you don't know what you are doing.

--
Enjoy,
Tony


Book Titles always end with a period. But then there are also periods
elsewhere in each entry. The titles themselves don't contain periods other
than the final one.

Journal Titles will not contain numbers, so the subsequent space and volume
number could mark the end of the journal title.

I don't think there's a way to differentiate journal from book titles. Some
book titles, by the way, end in dates, e.g., The History of Psychiatry,
1832-1932.

Each full book or journal entry with all its publication data takes up one
cell in the table.

This underlining doesn't have to be a totally perfect method. I'm going to
read and edit the whole bibliography after I do the underlining, so I can
catch anything that went wrong. I'm just hoping not to have to do too much
fixing of things that went wrong.

I've never worked with VBA, but if you can give me some simple (?)
instructions I can probably manage it.

Many thanks!
--
The Monk


:

First off, this cannot be done with Find and Replace via the UI.

It *might* be possible with some VBA wrapped around an F&R,

It isn't easy to recognise City names which may or may not be
present
and
which may, I suppose, also happen to be in a title. To do this at
all
there
has to be something identifiable which ends the title - a full stop
will
do
but I guess titles could contain them. What about the penultimate
full
stop
in the line? How are 'lines' terminated by the way?

Similarly with Journals - you need something which categorically
marks
the
end of the title.Will a Journal Title ever contain a number?

Finally, is there any surefire way to differentiate between a book and a
journal?

The critical questions (from the above) that I see at the moment are
identifying the end of the book title - and the end of the 'line'
(if
each
is in a table cell by itself that is fine).

--
Enjoy,
Tony


Thanks for responding. Book entries go like this (I want to
underline
the
book title):

Last name, First name. Year. Book Title Which May or May Not Contain
Numbers
But Does Not Contain Quote Marks. City and Sometimes State or Country.

Journal entries go like this (I want to underline the journal title):


Last name, First name. Year. "Article Title." Journal Title number
(month):
number-number.

How can I do this using wildcards? Or is there an easier method?

Much appreciated.

--
The Monk


:

So, in English, how would you state what has to be underlined?

Your entries seem to start with a Author Name (which may include
periods)
followed by a period.
Followed by a space and a year and a period and a space.

... then ...

In your first example, the rest of the line / paragraph / cell
is
the
title,
but
In your second example it seems (to me) to be an arbitrary part
of
the
following text.

--
Enjoy,
Tony


message
Hi. I'm using Word 2000. I have a bibliography in the third
column
of
a
three-column table that is 90 pages long. How do I underline
all
book
and
journal titles in the bibliography without doing each one by hand?
I've
tried
using my limited knowledge of wildcards, to no avail.

In general, a book entry looks like this:

Gammell, R. H. Ives. 1986. The Boston Painters, 1900-1930. Orleans,
Mass.

I want to underline The Boston Painters, 1900-1930. (including the
final
period)

In general, a journal entry looks like this:

Frankfurter, Alfred M. 1931. "Thirty-Five Portraits from American
Collections." Art News Annual 29 (May 16): 3-4.

I want to underline Art News Annual.

Any help much appreciated.
 
Top