This is the probit.txt file

I use the verbatim package to insert some text file. In particular using the command, \verbatiminput{probit.txt}. But there are some characters in the text file that cause the error :

Package inputenc Error: Keyboard character used is undefined (inputenc) in inputencoding `utf8'

I detect that the problem is caused by these symbols in the txt file:

‘ ’

How can I bypass these errors and use the \verbatiminput{probit.txt} command to insert verbatim environment.

(Because I have so many text files, I don't want to remove the symbol from each of them or use the \begin{verbatim} \end{verbatim} because it would be very time consuming to copy-paste all the text files. )



\section{First section}

Your text goes here.


More text.

  • 1
    I can't reproduce the issue. Can you please add an excerpt of the probit.txt file so that it produces an error on your system? Also, what TeX distribution and operating system are you using? – egreg Nov 18 '18 at 20:37
  • I guess your file probit.txt is not encoded with utf8. – Kurt Nov 18 '18 at 20:55
  • @egreg : I uploaded the file. I use Texworks in Wins 10. – DB225681 Nov 19 '18 at 7:18
  • @Kurt : It may be true. But I don't know how to fix it. – DB225681 Nov 19 '18 at 7:18
  • Which editor do you use to create your tex files? You can use for example notepad++ to change the coding ... – Kurt Nov 19 '18 at 9:58

Your shown file probit.txt is encoded in ansi, not utf8. Therefore you get the error message, because your tex file wants utf8 encoding based on \usepackage[utf8]{inputenx}.

After opening your linked file with notepad++ you can see your encoding marked with the red circle:

enter image description here

Change the encoding of file probit.txt to utf8 and you get rid of the errors.

  • Thank you for such thorough explanation. Works like a charm! – DB225681 Nov 21 '18 at 21: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.