2

I am creating an article in which each section is a separate file, and I include them with \input. The following document compiles without error:

\documentclass{article}
\usepackage[spanish,activeacute]{babel}
\usepackage[ansinew]{inputenc}

\begin{document}
áéíóúñ
\end{document}

But, now I create a file test2.tex that contains the same line with accentuated letters:

áéíóúñ

And change the main document to input this file:

\begin{document}
áéíóúñ
\input{test2}
\end{document}

Now an error is given by latex:

! Missing $ inserted.
<inserted text> 
                $
l.1 áéíó
            úñ

In worst case I could of course include all in one file, but I prefer to have them separated. How can I separate the sections in files and still being able to use accents in those files?


Note that in my previous question (How can I quickly type a LaTeX accent in vim?) they suggested to use \usepackage[utf8]{inputenc}, however I found this not to work and now I use \usepackage[ansinew]{inputenc} as indicated in the congress' template.

3
  • 3
    you haven't really given enough clues but I would guess that your file is using a standard encoding such as UTF-8 not the legacy ansinew encoding which was never really a standard encoding anyway (it was an approximation based on the encoding capabilities of y&ytex of the non standard microsoft western European codepage) May 31, 2016 at 6:42
  • 3
    You need that all files are ansinew encoded.
    – egreg
    May 31, 2016 at 6:44
  • Ok, thanks! This is indeed the solution, I converted them to utf8 and changed the \usepackage[ansinew]{inputenc} to \usepackage[utf8]{inputenc}.
    – agold
    May 31, 2016 at 7:01

1 Answer 1

2

Your file is using a standard encoding such as UTF-8 not the legacy ansinew encoding which was never really a standard encoding anyway (it was an approximation based on the encoding capabilities of y&ytex of the non standard microsoft western European codepage).

Best solution would be to encode all files as UTF-8 and then use

\usepackage[utf8]{inputenc}

rather than [ansinew]

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .