I'm having problems inputting a TikZ picture in a document that is encoded with UTF-8. The TikZ picture was generated with matlab2tikz
.
When I try to open the foo.tikz
file with my editor (Texmaker), it says:
The file cannot be read correctly with the default enconding (UTF-8).
Use the following codification: ISO-8859-1
My preamble is the following:
\documentclass[a4paper,12pt]{article}
\usepackage[catalan]{babel}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
blà blà blà
blà blà blà
\begin{figure}[ht!]
\centering
\newlength\figureheight
\newlength\figurewidth
\setlength\figureheight{6cm}
\setlength\figurewidth{6cm}
\input{foo.tikz}
\end{figure}
\end{document}
When I input the foo.tikz
file in my document, an error happens because some of the characters included are undefined in input-encoding 'utf8'.
The problem is that I have to use UTF-8 encoding because I'm not writing in English and I have to use a lot of accents and other characters.
What can I do in order to input this picture in my document? I thought about using multiple encodings in the document, but I don't know if this can be done. Or converting the TikZ file to utf8 encoding, but I don't know how I could do this, if possible.
Best Answer
You can tell LaTeX to use another input encoding locally:
In this case it should work without problem, but I wouldn't recommend it in all cases: If auxiliary files are involved (glossaries, index, etc) mixing encodings can get confusing.