考虑以下定义:
\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}
我怎样才能定义\Dash
正确地突出到边缘,就像连字符一样?
答案1
的定义\thinspace
是
% latex.ltx, line 1315:
\def\thinspace{\kern .16667em }
因此它是一个字距;由于它后面没有粘连,所以它不是一个可行的换行点。
您可能想要用\hspace{.16667em}
代替它;那么\allowbreak
就不需要了。另一方面,\ignorespaces
在您放置它的地方什么也不做,因为它唯一的操作是触发 的扩展\allowbreak
。 无论如何,后面的空格都会被忽略\Dash
。
\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}