Allow line break, but without inserting a dash
You could insert \allowbreak
whereever a break without hyphen shall be allowed, such as
long\allowbreak word
In addition to Stefan’s answer:
You can also write long""word
, but this is a babel
-shortcut (as most of the following). As Herbert pointed out these shortcuts are language specific. The list is taken form a german home page and are in the german section of babels
manual.
-
hyphen sign, no others in this word (hy-phenation
> hy-|phenation)
"=
hypen sign that allows other breaks (h"=yphenation
> h-|y|phen|a|tion)
"~
hyphen sign without line break (hy"~phenation
> hy-phenation)
\-
possible hyphenation with sign (h\-yphenation
> h|y|phen|a|tion)
""
possible hyphenation without sign ((super"~)""hyphenation
> (super-)*hy|pen|a|tion)
"|
break ligature and allow hyphenation
[( code
> output); the pipe indicates possible line break with hyphen sign; asterisk indicates possible line break without sign.]
Source: This german homepage.
it is also possible to allow hyphenation on Characters
\documentclass{article}
\usepackage[hyphens]{url}
\textwidth=10cm% only for demo
\DeclareUrlCommand\Code{\urlstyle{rm}}
\expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks
\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k
\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v
\do\w\do\x\do\y\do\z
\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K
\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V
\do\W\do\X\do\Y\do\Z}
\begin{document}
\noindent\rule{\textwidth}{1pt}
some very long text before the hyphenated code
\Code{someverylongtextbeforethehyphenatedcode}
some very long text before the hyphenated code
\Code{some-long-command-name-with-a-lot-of-dases}
\end{document}