8

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

\texttt{/usr/share/myspell/dicts/hyph_pl_PL.dic}

..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.

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

1 Answer 1

17

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.

1
  • I had never heard of \path. Thanks.
    – jub0bs
    Commented Apr 20, 2014 at 20:10

You must log in to answer this question.

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