LaTeX Library

All examples

Languages

Multilingual Document

English and Arabic content in one document with explicit language switching.

Engine
XeLaTeX
Level
Intermediate
Explore the source
Multilingual Document compiled PDF preview
Compiled PDF preview

Use this example

  1. Create a project and copy the source below into main.tex.
  2. Select XeLaTeX as the LaTeX engine.
  3. Compile, review the PDF, and adapt the content.
Open My projects

LaTeX source

main.tex
\documentclass[11pt]{article}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\title{Multilingual Notes}
\author{LatexDesk Example}
\begin{document}
\maketitle
\section{English}
Unicode engines make it practical to combine languages and writing directions.
\section{Arabic}
\begin{Arabic}
يمكن كتابة النص العربي داخل مستند لغته الأساسية هي الإنجليزية.
\end{Arabic}
\section{Inline switching}
The phrase \textarabic{أهلاً وسهلاً} appears inside an English paragraph.
\section{Guidance}
Use XeLaTeX, select fonts that contain every required character, and review line breaking.
\end{document}