# Define new hyphenation

I want to define hyphenation for a word I have somewhat created.

I have a word that I have hyphenated like

``````com\-.puppy\-crawl\-.tools\-.check\-style\-.api
``````

The thing is that every time I want to use that word I have to write everything, including the `\-`. Is there a way for me to define hyphenation for a word and be able to use it through out the document?

-
Do you write it as `\url{...}`? – Herbert Feb 27 '11 at 15:51
I have it like `\texttt{...}` – Tiago Veloso Feb 27 '11 at 15:53
Use `\url` then there is a possible linebreak at the dot by default. – Herbert Feb 27 '11 at 15:57
It is a bit curious to hyphenate a program path ... because nobody knows if the hyphen is part of the path or not. – Herbert Feb 27 '11 at 16:19
@Tiago: `\nolinkurl{...}` – Herbert Feb 27 '11 at 16:27

It makes more sense to use `\url{..}` for Java package names. If you use `hyperref` and do not want it as a link, then use `nolinkurl{...}`. Urls can have a line break at the dot by default.
well, `\hyphenation{...}` won't work since there are non-letters in the string. probably the most direct approach is to just define a shorthand command that includes all the discretionary hyphens: `\newcommand\compuppy{com\-.puppy\-crawl\-.tools\-.check\-style\-.apl}` you might want to finish it off with `\xspace` to avoid having to remember to finish it off with a backslash before a space.
the xspace thing didn't work. `\newcommand\compuppy{\texttt{com\-.puppy\-crawl\-.tools\-.check\-style\-.api}\x‌​space} ` Am I using it right? – Tiago Veloso Feb 27 '11 at 16:20
@Tiago You need `\usepackage{xspace}`, otherwise it is used correctly. – Christian Lindig Feb 27 '11 at 16:23