Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

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

1 Answer 1

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.

share|improve this answer
    
I had never heard of \path. Thanks. –  Jubobs Apr 20 at 20:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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