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've written a LaTeX class for my colleagues and me. Everything works fine on Linux and Mac OS X but not on Windows 7/8. The problem is the character-encoding on Windows 7/8 (using MikTeX). I use the following packages in this class:

% german spelling

% set input encoding

On Windows you have to change utf8 to to ansinew to print special German letters like ä ö ü ß. It won't work with utf8. I don't want to create two different classes, so is there a possibility to use the same class file under Unix and Windows?

share|improve this question
Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. –  Jubobs May 23 '13 at 9:46
You can also use utf8 on windows. Your colleague only need to save their files in this encoding. All modern editors can do this. But it is simply a bad idea to put the encoding setting in a class file. The correct inputenc option depends on the document and so should also be set by the user in their document. –  Ulrike Fischer May 23 '13 at 10:00
I usually use the same inputenc you use in your example. To display Umlauts properly I use \usepackage[T1]{fontenc} this is necessary because the LaTeX standard font isn't able to display them correctly (someone please correct me if I'm wrong here) –  Rico May 23 '13 at 10:06
Use cross-platform (win,unix and mac) Unicode:yes LaTeX Editors/IDEs and recommend the same to colleagues. See Martin Schröder's for pdflatex engine fontenc vs inputenc answer –  texenthusiast May 23 '13 at 10:15
add comment

1 Answer

The input encoding depends on the editor that is used to write the TeX file:

  • A good editor is not limited to one encoding, the user can configure the encoding among many different encodings.

  • Even if the system encoding is used, this is not stable either, different systems use different encodings. Also the default encoding of the system can be changed.

A class file does not know, where it will be used, which editors with which encodings the users might use, the specification of the input encoding does not belong to the class file. It can only offer some help:

  • Documentation that describes, what the user can do to specify the input encoding.
  • The class could provide a class option (inputencoding=...) that passes the value of the option to package inputenc. A default value might be set that the most users might use. (Key value options can be supported by some packages, kvoptions, for example).

If the user is troubled to find the right encoding, then package selinput can help, the example from its documentation:

Umlauts: ÄÖÜäöüß

Then the package analyzes the specifications of \SelectInputMappings to find a matching encoding automatically. However, this cannot be done in a class file, because it must be written with the same editor as the text after \begin{document}. Otherwise selinput would only find a matching encoding that was used by the class writer.

share|improve this answer
add comment

Your Answer


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.