3

A simple LyX document consisting of one long file path, is wrapped inside the LyX GUI to the next line; but when exported to PDF it 'continues' after the right margin end.

I'd expect it to be automatically wrapped on the slashes. How can I define some rule to do this?

This is the file path:

/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm
1
  • Hi and welcome to TeX.SX. In its current form, your question might not receive many answers. Please take a look at the How to Ask-page and try to improve your question according to the guidance found there. This may require you to show some effort on your part in terms of attempting a solution. If you have questions about what to do or if you don't quite understand what this means, please ask for clarification using the add comment function. Oct 23, 2014 at 11:48

1 Answer 1

3

You could load the url package -- I suggest you set the options spaces, obeyspaces, and hyphens when loading the package -- and use that package's \path macro to typeset the long path name.

enter image description here

\documentclass{article}
\usepackage[hyphens,obeyspaces,spaces]{url}
\begin{document}
\noindent
\path{/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm/aaaa/bbbb/cccc/dddd/eeee/ffff/gggg/hhhh/iiii/jjjj/kkkk/llll/mmmm}
\end{document}
5
  • It's working. Sorry I can't upvote. However, something still bother me. I'm new to LyX and LaTex, and I can't comprehend how is it possible that by default 'strange words' that can't be hyphenated just disappear after the right margin. Shouldn't it be vice-verse? By default it should wrap (even on some arbitrary point, if it doesn't know the 'logical' place).
    – Zvika
    Oct 23, 2014 at 12:58
  • @Zvika - For TeX to create line breaks, it needs "rules" that determine where line breaks are permissible. An obvious candidate for a break point is an interword space. Hyphenation points, determined by whatever language-specific hyphenation rules may in force, are also permissible breakpoints (although associated with a penalty, so that TeX will try whenever possible to break lines at interword spaces). If TeX encounters a long "word" for which it cannot find hyphenation points, all it can do is to let the "word" protrude into the margin.
    – Mico
    Oct 23, 2014 at 13:04
  • Thanks for the detailed explanation. I'd still have to get used to it, though...
    – Zvika
    Oct 23, 2014 at 13:10
  • @Zvika -- Don't worry, you'll get used to it soon.
    – Mico
    Oct 23, 2014 at 13:12
  • 1
    Adding information for future LyX users who might encounter this: A. If PDF Properties has Use Heperref Support it would clash with the paramters of url package. Disable it from LyX menu, and enable it from LaTeX Preamble, after loading Url. B. If the path has _s, they should be inside an ERT
    – Zvika
    Oct 23, 2014 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .