1

I am setting e.g. directory names in a typewriter font. These names can become long. With the hyphenat package, I enabled hyphenation. Now, what is missing, is that the hyphenation character is replaced e.g. by a backwards oriented arrow. Thus, what I want to do is something like

\usepackage[htt]{hyphenat}
\newcommand{\origttfamily}{}%
\let\origttfamily=\ttfamily%
\renewcommand{\ttfamily}{\origttfamily \hyphenchar\font=\ensuremath{\hookleftarrow}}
\begin{document}
\texttt{/etc/really/long{\fshyp}directory{\fshyp}name/}
\end{document}

however, \ensuremath{\hookleftarrow} does not work in this case - it is not a single character.

Can somebody point me towards a solution? Thanks a lot!

Chris R.
  • 13
  • 2
  • 2
    http://tex.stackexchange.com/ – orlp Jan 20 '11 at 16:39
  • oops - you mean I should better post the question at tex.stackexchange.com? – Chris R. Jan 20 '11 at 16:45
  • For future readers coming across this, the question was moved to [symbols - Replace hyphenation character by a backwards arrow - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/questions/9358/replace-hyphenation-character-by-a-backwards-arrow/9361#9361) (but somehow the old question is still visible here) – user202729 Jul 02 '22 at 15:22

1 Answers1

0

You cannot set the \hyphenchar to a character from a different font, but you can redefine \BreakableSlash:

\documentclass{minimal}
\usepackage[htt]{hyphenat}
\newsavebox\leftarrowbox
\sbox\leftarrowbox{$\leftarrow$}
\makeatletter
\renewcommand*{\BreakableSlash}{%
  \leavevmode
  \prw@zbreak
  /%
  \discretionary{\usebox\leftarrowbox}{}{}%
  \prw@zbreak
}
\makeatother
\begin{document}
\parbox{20mm}{%
  \texttt{/etc\fshyp really\fshyp long\fshyp directory\fshyp name/}%
}
\end{document}
Philipp
  • 48,066
  • 12
  • 84
  • 109