I'm beginning with Latex and I want to add some JavaCode in it. My source code is in "D:\Eclipse_Projects\Algorithimique\src\s09" but I think the underscore is making trouble. I use the following code :

\usepackage[utf8    ]{inputenc}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{listings} % Required for insertion of code



Can anyone help? Thank

  • 2
    The underscore in the file name is not a problem, but in the caption text. Use e.g. caption=Methode\_FindBug04. – Schweinebacke Apr 26 '17 at 8:14
  • I tried to do so, but now I have the following error :Missing $ inserted – Warok Apr 26 '17 at 8:23
  • Have you removed the auxiliary file? If not, remove all auxiliary files and try again. – Schweinebacke Apr 26 '17 at 8:30
  • Still the same error... I am doing something wrong? – Warok Apr 26 '17 at 8:46
  • Sorry, cannot reproduce it using \lstinputlisting[caption=Methode\_FindBug04]{./Eclipse_Projects/FindBugs.java} with a very simple FindBug.java (only one line with test in it). I do not have D: so I just used a subdirectory of my working directory. – Schweinebacke Apr 26 '17 at 9:01

Your Answer

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

Browse other questions tagged or ask your own question.