I am using a number of items in text that are divided with a slash. For example dates in different calendars or names of locations, such as 585/1190~CE (the first number is the year in Islamic lunar calendar, the second is according to the Common Era calendar), or Mosul/al-Mawsil (the first is a common English spelling, the second is the transliteration of the original name).

The problem I am running into is that Latex cannot split such items when they are at the end of a line---and such item ends up sticking through the margins. Adding spaces around the slash helps, but it looks ugly and this is not how it is supposed to be in academic writing. I wonder if there is a workaround to solve this issue. Namely, I do not want to use spaces around "/", but I would like Latex to break an item after a slash when necessary.


You can allow a break after a slash using the stock command \slash:

585\slash 1190~CE
Mosul\slash al-Mawsil

I'd avoid complicated redefinitions that could make the substitution automatic when typing simply a /.

Another approach would be to define a command:

\newcommand{\alt}[2]{#1\slash #2}

and then input


Technical note. The kernel definition of \slash is

% latex.ltx, line 467:
\def\slash{/\penalty\exhyphenpenalty} % a `/' that acts like a `-'

This makes a break at a slash as desirable as a break after an explicit hyphen. But this also disallows hyphenation after the slash. You can improve this with the trick used by TUGboat:


Whether you want to do this depends on what follows the slash in your document. If long word are expected, then this redefinition should be considered.


here is what is used in tugboat to allow a break after a slash:

\def\slash{/\penalty\z@\hskip\z@skip }

(of course, you need \makeatletter ... \makeatother if this is used outside of a .sty or .cls file.) just replace / by \slash in the input, e.g. 585\slash 1190~CE.

as @egreg points out, there is a definition of \slash in the latex kernel. (the tugboat definition predates latex; i didn't actually check for that before answering.) however, the tugboat definition is more "forgiving" -- it will permit automatic hyphenation in words that follow the slash (useful in tugboat's narrow columns).

  • 1
    The LaTeX definition of \slash is /\penalty\exhyphenpenalty. Probably TUGboat uses a different one because of narrow columns.
    – egreg
    Jul 1 '13 at 14:41

For (nearly) all of your hyphenation problems, you may use the shorthand notations of the ngerman option to the babel package. This question goes more into the technical details of how to activate it without setting everything else to German.

Basically it provides a few commands to specify exactly what kind of line breaks you want. Unfortunately the most comprehensive website describing its features I know is only in German.

Here is a small example using your phrases:



\hspace{0pt}585/""1190~CE % "" allows a line break without adding a hyphen

\hspace{0pt}Mosul/""al"~Mawsil % and "~ adds a hyphen that may not be broken


Example output of the year and al-Mawsil's names.

I know that you did not ask for "~, but that's another very useful command, the other ones being "- for additional line breaks and "= for breakable hyphens which still allow breaks at other places.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.