3

I have a Word document that I want to translate into LaTeX, so it is a matter of copy & paste along with LaTeX code. But when I do that some of the characters come out wrong. For example this is the text passage that I copied:

"Este livro foi escrito para servir de texto de Análise Funcional nos estágios finais do Mestrado ou no início do Doutorado. De fato, versões preliminares dele já foram utilizadas no ciclo básico de Análise no programa de Doutorado do IMPA."

And this is the output output

And here is my preamble:

\documentclass[pdftex,11pt,openleft]{book}

\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}

\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx,xcolor}

\usepackage{hyperref}
\hypersetup{colorlinks}
\usepackage{fancyhdr}
\pagestyle{fancy}

What could have possibly have gone wrong?

Note: I don't know Portuguese at all.

1
  • 2
    you need \usepackage[utf8]{inputenc} Jun 26, 2016 at 17:07

2 Answers 2

5

This is a matter of encoding, so adding

\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}

will solve it.

For more information see the fontenc vs inputenc.

Output

Code

\documentclass[pdftex,11pt,openleft]{book}
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}


\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx,xcolor}

\usepackage{hyperref}
\hypersetup{colorlinks}
\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}
    Este livro foi escrito para servir de texto de Análise Funcional nos estágios finais do Mestrado ou no início do Doutorado. De fato, versões preliminares dele já foram utilizadas no ciclo básico de Análise no programa de Doutorado do IMPA
\end{document}
0
3

Another option is to use xelatex to typeset your LaTex document. It uses UTF-8 by default.

You would need to load \usepackage{fontspec} for using any fonts.

3
  • thanks, but by loading this package i don't have to specify the font that i want later ?
    – mostafax80
    Jun 26, 2016 at 20:15
  • 1
    no, you don't have to. XeLaTex has also the benefit of enabling the use of all system-fonts.
    – Runar
    Jun 26, 2016 at 20:26
  • 1
    @mostafax80 Runar is right. fontspec auto loads Latin Modern which supports more characters than the original Computer Modern that LaTeX uses. Jun 26, 2016 at 20:29

You must log in to answer this question.

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