Latex character error while splitting chapters

4,493

Obviously the new files you are trying to input are not latin1 encoded. Probably you/your editor chose utf8 as encoding for them. Either reencode the file to latin1 or tell LaTeX that the files use another encoding by loading the utf8-definitions and adding \inputencoding{utf8} at the start of the file:

\documentclass[12pt]{article}
\usepackage[utf8,latin1]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}

\inputencoding{utf8}
\input{....} %utf8 encoded file 

\inputencoding{latin1} %back to latin1 

\end{document}
Share:
4,493

Related videos on Youtube

Tommy39
Author by

Tommy39

Updated on August 08, 2020

Comments

  • Tommy39
    Tommy39 over 3 years

    I'm writing a LaTeX document and everything works fine, but as I try to split the document chapters in different .tex files, I receive several errors related to the characters in the document (and with the encoding, I suppose). In the document I use a lot of accented letters with direct insertion, such as ì or è. I used

    \usepackage[latin1]{inputenc} 
    

    to let this work and it do work as long as the chapter are all together in the main file. But as I try to copy the first chapter in a separate file and use \input or \include in the main file, I get a series of errors related to the characters. Why does that happens?

    • arkascha
      arkascha over 11 years
      What gives you the error: some latex processor ? which one ? or you editing environment / syntax checker ? And please don't refer to errors without actually specifying them here.
    • Marco Daniel
      Marco Daniel over 11 years
      You can use \include only at the top level. Any nesting of \include isn't allowed.
    • Tommy39
      Tommy39 over 11 years
      no I receive errors when I compile the .tex file, errors such as "Missing $ inserted" when it founds an "ì", or "Package inputenc Error: Keyboard character used is undefined in inputencoding 'latin1'" when it founds "È", ecc... The problem is that I do not get these errors if I just directly write the chapter content instead of using \input
  • Tommy39
    Tommy39 over 11 years
    whoa, it worked just perfect! it seems like it was actually the problem! thanks a lot dude :D