Search code examples
latex

trying to write the following line to my tex file


I am writing my thesis and I am trying to write the following line into my tex file as follows:

\textit{LD\_LIBRARY_PATH=~/naoqi/naoqi-sdk-1.12.3-linux64/lib:\$LD\_LIBRARY\_PATH NAO\_IP=10.7.45.53 roslaunch nao\_driver nao\_driver.launch}

When I compile I get the following 3 errors:

! Missing $ inserted.

! Extra }, or forgotten $.

! Missing $ inserted.

The $ sign I think is creating the problem. Can somebody please show me how I can write the above mentioned line into my tex file? Thanks.


Solution

  • Sometimes errors may be a little bit misleading. In your case the real problem is that, same as $, the underscore is a reserved character in Latex and to use it you have to use a backslash before it. For more info look at page 5 of this Latex Introduction. So the correct line would be:

    \textit{LD\_LIBRARY\_PATH=~/naoqi/naoqi-sdk-1.12.3-linux64/lib:\$LD\_LIBRARY\_PATH NAO\_IP=10.7.45.53 roslaunch nao\_driver nao\_driver.launch}