[Tex/LaTex] What encoding and line-feeds should I use in the TeX files to ensure portability

editorsinput-encodingstools

In many of the editors and tools I use, I'm given the option to choose an "encoding" as well as a choice among "new lines". For example, in BBEdit, I am given the following for encoding

enter image description here

and this

enter image description here

for new lines.

Are there settings for these that are more likely to ensure portability across platforms and tools? Are there corresponding settings or options in LaTeX code that need to match the choices made here?

Best Answer

For the file format, you can probably ignore the Classic Mac (CR) option as these days, Mac use the Unix (LF) line ending. The picky one will be windows on this one as although some editors will support Unix line ending, be default, users will probably have issues with such files. So for that reason I would use the Windows (CRLF) option as Unix/Linux/OS X will also be able to handle these files without any problems. (I am a unix user with very few dealings with windows so my preconceptions may be wrong regarding this OS and maybe things have changed in this regard.)

This I think will be an issue only for viewing the source or editing. Compilation should not be a problem whichever option you choose.

Regarding the file encoding, I think UTF-8 is pretty standard these days and probably the recommended option. Make sure you either use the correct inputenc when using latex/pdflatex or use XeLaTeX or LuaLaTeX which assume that the input file is encoded in UTF-8.