From: Karl Voit <devnull@Karl-Voit.at>
To: emacs-devel@gnu.org
Subject: Re: Proper English Title Capitalization
Date: Mon, 25 May 2015 12:13:23 +0200 [thread overview]
Message-ID: <2015-05-25T12-05-49@devnull.Karl-Voit.at> (raw)
In-Reply-To: 87fv6lelmr.fsf@debian.uxu
Hi Emanuel,
* Emanuel Berg <embe8573@student.uu.se> wrote:
> Karl Voit <devnull@Karl-Voit.at> writes:
>
>> I was looking for a method to capitalize
>> headings/titles according to [1].
>> [1] http://dougscripts.com/itunes/scripts/ss.php?sp=titlecaps
> Good idea, I can never memorize those goofy rules.
"Those goofy rules" are much more complicated than I thought.
I did some research: What is proper English title capitalization?
+ http://english.stackexchange.com/questions/14/which-words-in-a-title-should-be-capitalized
- http://english.stackexchange.com/a/34
1. Always capitalize the first and the last word.
2. Capitalize all nouns, pronouns, adjectives, verbs, adverbs,
and subordinate conjunctions ("as", "because", "although",
"if", etc.).
3. Lowercase all articles, coordinate conjunctions ("and", "or",
"nor"), and prepositions regardless of length, when they are
other than the first or last word. (Note: NIVA prefers to
capitalize prepositions of five characters or more ("after",
"among", "between").)
4. Lowercase the "to" in an infinitive.
+ https://en.wikipedia.org/wiki/Capitalization#Titles
- summarizes different approaches
+ https://en.wikipedia.org/wiki/Letter_case#Case_styles
- compares different approaches
+ http://www.grammarbook.com/punctuation/capital.asp
- Rule 16a. Composition titles: which words should be capitalized
in titles of books, plays, films, songs, poems, essays,
chapters, etc.? This is a vexing matter, and policies vary. The
usual advice is to capitalize only the "important" words. But
this isn't really very helpful. Aren't all words in a title
important?
- The following rules for capitalizing composition titles are universal.
- Capitalize the title's first and last word.
- Capitalize verbs, including all forms of the verb to be (is, are, was, etc.).
- Capitalize all pronouns, including it, he, who, that, etc.
- Capitalize not.
- Do not capitalize a, an, or the unless it is first or last in
the title.
- Do not capitalize the word and, or, or nor unless it is first
or last in the title.
- Do not capitalize the word to, with or without an infinitive,
unless it is first or last in the title.
- Otherwise, styles, methods, and opinions vary. Small words such
as or, as, if, and but are capped by some, but lowercased by
others.
- The major bone of contention is prepositions. The Associated
Press Stylebook recommends capitalizing all prepositions of more
than three letters (e.g., With, About, Across). Others advise
lowercase until a preposition reaches five or more letters.
Still others say not to capitalize any preposition, even big
words like regarding or underneath.
- Hyphenated words in a title also present problems. There are no
set rules. Some writers, editors, and publishers choose not to
capitalize words following hyphens unless they are proper nouns
or proper adjectives (Ex-Marine but Ex-husband). Others
capitalize any word that would otherwise be capped in titles
(Prize-Winning, Up-to-Date).
+ http://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html
- As you have probably noticed "short" words, those with less than
five letters, are generally lowercase in titles, unless they are
the first or last words in a title.
- Generally, we do not capitalize:
- Articles: a, an, the
- Coordinating Conjunctions: and, but, or, for, nor, etc.
- Prepositions (fewer than five letters): on, at, to, from, by, etc.
- When in doubt and you do not have a reference guide in front of
you, here is one general rule to remember recommended by The
U.S. Government Printing Office Style Manual:
- "Capitalize all words in titles of publications and documents,
except a, an, the, at, by, for, in, of, on, to, up, and, as,
but, it, or, and nor."
+ http://www.chompchomp.com/terms/coordinatingconjunction.htm
- "And, but, for, nor, or, so, and yet—these are the seven
coordinating conjunctions."
+ https://www.ego4u.com/en/cram-up/grammar/prepositions
- on in at since for ago before to past to till until by next
beside under below over above across through into towards onto
from off "out of" about
- less than five letters:
- on in at for ago to past to till by next over into onto from off
Once again, "it depends" is the correct answer to the title
capitalization question as well.
> You don't have to know a lot of Elisp to do that.
> Here is a start. Only you'll have to insert the
> "stopwords" yourself.
>
> (setq do-not-capitalize '("ah" "oh" "eh"))
>
> (defun make-a-title (beg end)
> (interactive "r")
> (save-excursion
> (goto-char beg)
> (forward-word)
> (backward-word)
> (while (< (point) end)
> (if (member (thing-at-point 'word t) do-not-capitalize)
> (forward-word)
> (capitalize-word 1) )
> (forward-word)
> (backward-word) )))
I was wrong by using the term "stop words". However, I came up with
a list of words not to capitalize based on the resources above.
What's still missing in your make-a-title:
- Always capitalize first word
- Always capitalize last word
- List of do-not-capitalize words
My Elisp knowledge is sufficient to modify your code so that it
should get the job done:
,----
| (defun my-title-capitalization (beg end)
| (interactive "r")
| (save-excursion
| (let (
| (do-not-capitalize '("a" "ago" "an" "and" "as" "at" "but" "by" "for"
| "from" "in" "into" "it" "next" "nor" "of" "off"
| "on" "onto" "or" "over" "past" "so" "the" "till"
| "to" "up" "yet" ))
| )
| ;; go to begin of first word:
| (goto-char beg)
| (forward-word)
| (backward-word)
| ;; capitalize first word in any case:
| (capitalize-word 1)
| (while (< (point) end)
| ;; capitalize each word in between except it is list member:
| (if (member (thing-at-point 'word t) do-not-capitalize)
| (forward-word)
| (capitalize-word 1) )
| (forward-word)
| (backward-word) )
| ;; capitalize last word in any case:
| (backward-word)
| (capitalize-word 1)
| )
| ))
`----
I was surprised that this quite handy function is not part of Emacs
yet.
--
All in all, one of the most disturbing things today is the definitive
fact that the NSA, GCHQ, and many more government organizations are
massively terrorizing the freedom of us and the next generations.
http://Karl-Voit.at
next prev parent reply other threads:[~2015-05-25 10:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-24 11:10 Proper English Title Capitalization Karl Voit
2015-05-24 21:00 ` Emanuel Berg
2015-05-25 10:13 ` Karl Voit [this message]
2015-05-25 10:36 ` Rasmus
2015-05-25 10:47 ` Karl Voit
2015-05-25 12:22 ` Karl Voit
2015-05-25 16:18 ` Rasmus
2015-05-26 15:38 ` Barry Fishman
2015-06-11 20:10 ` Karl Voit
2015-06-03 15:05 ` Karl Voit
2015-05-25 16:59 ` Emanuel Berg
2015-06-17 13:48 ` Karl Voit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2015-05-25T12-05-49@devnull.Karl-Voit.at \
--to=devnull@karl-voit.at \
--cc=emacs-devel@gnu.org \
--cc=news1142@Karl-Voit.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.