# Allow line break, but without inserting a dash

I have a sentence that contains a number of long dataset names. I would like to allow LaTeX to break these names at certain positions that I would like to specify somehow just like I can use \- to allow a word break with hyphenation. But: I would like LaTeX not to insert a dash (which could be mistaken as belonging to the dataset name). How can I do this?

(Something similar is realized in the url package so I guess I could just read that code :) I would not like to use the url package here to be able to make a syntactical (and typographic) difference between urls and datset names.)

-
This may also be of interest: Replace hyphenation character by a backwards arrow – Werner Aug 20 '11 at 16:43

You could insert \allowbreak whereever a break without hyphen shall be allowed, such as

long\allowbreak word
-
 Is there a way to allow line breaks only at the specified positions? Otherwise LaTeX will often prefer to still add hyphens and break at other positions. (This happens When using e.g. hyphenat for automatic hyphenation.) – fuenfundachtzig Aug 23 '11 at 17:36 You can use \usepackage[none]{hyphenat} together with \allowbreak. – Stefan Kottwitz♦ Aug 23 '11 at 17:44

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}
-
 Very nice, because it's automatic and does not add hyphens. But what if I have e.g. longtextthatdoesnothavecharactersurlbreaksatatanypositionbutneedstobebroken -- I'd need to indicate how (where) to break this, but the \Code enviroment will print any commands in verbatim mode... – fuenfundachtzig Aug 21 '11 at 12:40 see edited answer – Herbert Aug 21 '11 at 13:31 OK, that's certainly one solution. Although I had hoped for something more along the lines of \allowbreak or \-... Because like this it's still not possible to specify where exactly LaTeX should break the line. – fuenfundachtzig Aug 23 '11 at 12:31

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-phen|a|tion)
\- 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.

-
 Seems to be babel specific, yes. – fuenfundachtzig Aug 21 '11 at 12:23 Thanks @fuenfundachtzig I edited my post … – Tobi Aug 22 '11 at 8:43 @Tobi: not only babel specific, also language specific – Herbert Aug 22 '11 at 8:51 @Herbert: Oh you’re right. I added this to my post. – Tobi Aug 22 '11 at 9:08

@fuenfundachzig: Since you're familiar with the url package, you may want to try the following: Include the instructions \usepackage{url} and \urlstyle={same} in the preamble (instructing the url package to use the main text font for URLs), and then enclose the words that you'd like to be allow broken up inside \url{...} commands. In my experience, this works very well most of the time, but it's not 100% foolproof (narrensicher?), naturally.

-