Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am looking to produce directional variants of the en-dash. A "left en-dash" should have half of ordinary inter-word spacing on its right and allow line-breaks only on its left; a "right en-dash" should have half of ordinary inter-word spacing on its left and allow line-breaks only on its right. This is intended to aid the visual parsing of parenthetical phrases: "Here - as in his other works - the composer alludes to Italian folk dances."

What is the best way to define such commands? Let's name them \ldash and \rdash.

share|improve this question

1 Answer

up vote 6 down vote accepted

You can use

\newcommand{\ldash}{--\nobreak\,\nobreak\ignorespaces}
\newcommand{\rdash}{\unskip\nobreak\,\nobreak--}

\nobreak inserts a large \penalty, discouraging (not avoiding) a line or page break at that location. A small space on the sides are offered by \,, while \unskip and \ignorespaces removes the whitespace naturally inserted between words.

share|improve this answer
Usage for your solution would be some words \ldash parenthetical expression \rdash{} some words. Is there an easy way to modify the \rdash macro so that I can omit {} after it? – Lover of Structure Oct 26 '12 at 4:38
1  
@user14996: xspace can be used: \usepackage{xspace}\newcommand{\rdash}{\unskip\nobreak\,\nobreak--\xspace} – Werner Oct 26 '12 at 4:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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