I'd like to insert some simple linux path inline with the text in my LaTeX document by using basic elements like:


..but it failed and this error below appears:

! Missing $ inserted.
<inserted text>
l.221 ...{/usr/share/myspell/dicts/hyph_pl_PL.dic}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Extra }, or forgotten $.

I'm not sure why it appears, but for sure am not try to use math environment in this case, so what the compiler tried to explain to me.

Is there some simple workaround of this trivial problem? Some examples would be the perfect answer.

Details: using TeX Live 2013 with Texmaker 4.1.1 on Ubuntu 14.04.

  • 1
    You just need to escape the underscores i.e. \_ rather than _. So, yes, there is a simple workaround! – cfr Apr 20 '14 at 19:20
  • 3
    Or you can use \detokenize: \texttt{\detokenize{/usr/share/myspell/dicts/hyph_pl_PL.dic}}. – jub0bs Apr 20 '14 at 19:38
  • Yeah, that's it! @Jubobs comes with great solution! Simple, but not have to change the original path. – Egel Apr 20 '14 at 19:46

There is a command \path{/usr/share/myspell/dicts/hyph_pl_PL.dic} you can use to write paths like that.

That command is defined in the package url so you have to use \usepackage{url} in the preamble of the document.

  • I had never heard of \path. Thanks. – jub0bs Apr 20 '14 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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