Sorry if this is a stupid question, I have tried several different solutions but none work. I have a custom class that I need to write a document in. This class automatically generate some pages with UTF8-encoding (needed for Swedish letters). When I try to compile with


I get too many errors to list here, the main point is that the document class "utf8" is missing. I can replace it with latin1, but this breaks the Swedish characters. I can use


which compiles, but breaks the Swedish characters in the front page. I'm out of ideas what to try here, and hope that someone has come across a similar problem before.

Thanks for any help,


  • In \documentclass[utf8,…]{rtthesis} the utf8 is an option, not a document class. As I don't know that document class, could you please check the error messagen? – Toscho Apr 16 '13 at 14:17
  • 1
    Are you sure your document is saved with UTF-8 encoding? This concerns input rather than output. What editor are you using? – egreg Apr 16 '13 at 15:35

Instead of latex, you can try xelatex, which uses the xetex engine which runs on utf8 tex-files. In this case, you should probably delete the utf8-option in your documentclass and you have no need for and should avoid inputenc and fontenc packages.

  • I am using xelatex as typesetting engine. The error I'm getting is: (/usr/local/texlive/2012/texmf-dist/tex/generic/oberdiek/se-ascii-print.def) ./main.tex:17: Package inputenc Error: Keyboard character used is undefined (inputenc) in inputencoding utf8'. See the inputenc package documentation for explanation. Type H <return> for immediate help. ...` And variations thereof. I can't delete the utf8 option, since the custom document class I'm using expects either utf8 or latin1 there. – Niclas Apr 16 '13 at 14:21
  • Try commenting out inputenc. There should be no need for it anyway, when using xelatex. – Toscho Apr 16 '13 at 14:23
  • For further oddities, I've found that the file compiles fine in TeXShop but not Texpad. Changing typesetting engine from xelatex in Texpad solves the problem, and everything compiles fine. I do not know error source yet. Inputenc is not included, only utf8 in the first documentclass header. – Niclas Apr 16 '13 at 14:27
  • I guess that the reason why it compiles in a different editor/IDE is because the other IDE calls xelatex with different options. As for inputenc, it is probably required and loaded by the class, which is why the utf8 option can be passed to the \documentclass command. This option-passing mechanism is common in custom classes, for example babel language options can be passed via the \documentclass command with the ulthese class. If the class is meant to be processed with xelatex, loading inputenc in the class is a design oversight. – Christian Gagné Apr 16 '13 at 19:59

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.