Texmaker and TeXstudioTroubles with accents in LaTeX

Information and discussion about Texmaker, an integrated LaTeX environment for several platforms, and the related TeXstudio
Post Reply
Wheatley
Posts: 1
Joined: Tue Dec 30, 2014 2:45 pm

Troubles with accents in LaTeX

Post by Wheatley »

Hi, I am using Texmaker 4.4 and Texlive under Ubuntu 14.10 with Unity and I am dealing with some problems with accents (I am Spanish, I need accents).

1. It took me a couple hours but I think accents are now compiling. I was getting some errors when trying to compile and in the final PDF file strange characters were appearing instead of á, é, í and so on.

2. Now my problem is that I am writing on Texmaker and suddenly it starts to write ´a, ´e, ´i... instead of á, é, í...

I googled it and I found some solutions that seem to be useless for me. I have already installed ibus-qt4, I have configured UTF-8 as my encoding and I have these packaged in my LaTeX document (which is compiling right now):

Code: Select all

\usepackage{lmodern}
%\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[spanish, activeacute]{babel}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{float}
Any solution for problem 2? Thanks a lot!
Last edited by Stefan Kottwitz on Tue Dec 30, 2014 3:42 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Ball000
Posts: 2
Joined: Mon Mar 02, 2015 12:37 pm

Re: Troubles with accents in LaTeX

Post by Ball000 »

Hello, this is my first post on this board, I thought I may drop a line about your problem.

It's related to encodings and the way engines deal with it. Some of them, like XeLaTeX and luaLaTeX (IIRC) don't require you to explicitly say \usepackage[utf8x]{inputenc} (as they wouldn't use 7 bits encodings anyway), but other engines do require it. You didn't mention your engine though.
And if your whole system isn't utf8 (look at the output of the command "locale" in the terminal), you may even have to say \usepackage{ucs}

And you commented out the \usepackage[T1]{fontenc} line: are you sure about it? Your problem could also come from there. I too need to deal with accents (French) and I have this line on my files, IIRC it ensures that the diacritics in fonts are used (mandatory even for hyphening accentuated words in French).
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Troubles with accents in LaTeX

Post by Stefan Kottwitz »

Hi Ball000,

welcome to the forum!

Great that you answer a still open question. It can also help anybody who arrives here via google.

So, also some additions by me. :-)

Yes, XeLaTeX and LuaLaTeX use UTF-8 by default. With pdfLaTeX and inputenc, I would prefer utf8 over utf8x, the latter is different but not simply extended. utf8x is a useful alternative for Asian languages. I read it in the inputenc manual, 1.2 UTF-8 encoding support. Ubuntu should use UTF-8, so utf8 should be a safe choice.

Also support to activate \usepackage[T1]{fontenc} for having the accented glyphs.

Stefan
LaTeX.org admin
Post Reply