Take the 2-minute tour ×
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.

Consider the following definition:

\documentclass[a6paper]{article}
\usepackage[showframe]{geometry}
\usepackage{microtype}

\def\Dash{\unskip\thinspace\textemdash\thinspace\ignorespaces\allowbreak}

\begin{document}
Lorem ipsum doler sit amet. Here is some text that I don't know what
I'm typing but it's okay \Dash all I need is enough text for the line
break and then I can put in my custom dash at it \Dash because
\emph{I'm so clever}.  (This worked out surprisingly well.)
\end{document}

How can I define \Dash to properly protrude into the margin, as the hyphen character does?

output

share|improve this question

1 Answer 1

up vote 9 down vote accepted

The definition of \thinspace is

% latex.ltx, line 1315:
\def\thinspace{\kern .16667em }

so it's a kern; since it's not followed by glue it's not a feasible line break point.

You probably want \hspace{.16667em} instead of it; then \allowbreak is not needed. On the other hand, \ignorespaces does nothing at all where you place it, because its only action is to trigger expansion of \allowbreak. Spaces are ignored after \Dash anyway.

\documentclass[a6paper]{article}
\usepackage[showframe]{geometry}
\usepackage{microtype}

\newcommand\Dash{\unskip\thinspace\textemdash\hspace{.16667em}}

\begin{document}
Lorem ipsum doler sit amet. Here is some text that I don't know what
I'm typing but it's okay \Dash all I need is enough text for the line
break and then I can put in my custom dash at it \Dash because
\emph{I'm so clever}.  (This worked out surprisingly well.)
\end{document}

enter image description here

share|improve this answer

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.