Spanish Characters in LaTeX: ñ, Accents, and Special Letters
Date Published

Spanish Characters in LaTeX
Write Spanish documents in LaTeX with proper accents and special characters.
Input Encoding
First, enable proper encoding:
\usepackage[utf8]{inputenc} — for pdfLaTeX
Or use XeLaTeX/LuaLaTeX which handle UTF-8 natively.
The Spanish babel Package
\usepackage[spanish]{babel}
This provides: - Correct hyphenation - Spanish quotation marks - Translated captions ("Capítulo", "Figura", etc.)
Special Characters
The ñ Character
ñ — type directly (with UTF-8)
\~n — explicit command
\~N — uppercase Ñ
Acute Accents (áéíóú)
\'a — á \'e — é \'i — í (or \'{\i} for dotless i) \'o — ó \'u — ú
Or type directly with UTF-8: á é í ó ú
Diaeresis (ü)
\"u — ü
Used in: cigüeña, pingüino, vergüenza
Uppercase Accents
\'A — Á \'E — É \'I — Í \'O — Ó \'U — Ú
Inverted Punctuation
Inverted Question Mark
Type the backtick then question mark — ¿
\textquestiondown — explicit command
Inverted Exclamation
Type the backtick then exclamation — ¡
\textexclamdown — explicit command
Usage
¿Cómo estás?
¡Hola!
Spanish Quotation Marks
With babel spanish:
<<texto>> — renders as «texto»
Or use:
\guillemotleft texto\guillemotright
Example Document
\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[spanish]{babel}
\begin{document}
\section{Introducción}
El español es una lengua romance. La letra ñ es única del español.
¿Cuántos años tienes?
¡Qué bonito día!
\end{document}
Common Spanish Words
- año (year) - niño (child) - España (Spain) - pequeño (small) - mañana (tomorrow/morning) - señor (mister) - cañón (canyon)
Babel Spanish Options
\usepackage[spanish,es-noquoting]{babel}
\usepackage[spanish,es-tabla]{babel} — "Tabla" instead of "Cuadro"
\usepackage[spanish,es-noindentfirst]{babel} — no first paragraph indent
Date Format
With babel spanish, dates format as:
\today → 25 de diciembre de 2025
Chapter and Section Names
Automatically translated: - Chapter → Capítulo - Figure → Figura - Table → Tabla/Cuadro - Contents → Índice general - References → Referencias
XeLaTeX/LuaLaTeX Approach
For full Unicode support:
\documentclass{article} \usepackage{fontspec} \usepackage[spanish]{babel} \setmainfont{Latin Modern Roman}
No inputenc needed—type characters directly.
Tips
1. Use UTF-8 encoding for source files 2. Include babel for proper hyphenation 3. Type accents directly when possible 4. Test quotation marks render correctly
Write Spanish Documents with Octree
Octree supports international text:
- Full UTF-8 support - Spanish language templates - Preview accents correctly - Export perfect PDFs
Try it at https://useoctree.com