I'm trying to use Babel for Arabic & Hebrew (both as secondary to English) in pdflatex. I had it working for just Arabic with
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[arabic,hebrew,english]{babel}
\usepackage{hyperref}
\usepackage{times}
\usepackage{latexsym}
\usepackage{booktabs}
\usepackage{url}
\begin{document}
\AR{أهلاً}
%\foreignlanguage{hebrew}{שלום}
\end{document}
But I can't figure out how to extend this for Hebrew. As soon as I try to add Hebrew (uncomment the line above), it gives me an encoding error on the Hebrew. If I switch to utf8x, it gives me an encoding error on the Arabic.
As suggested, I've tried switching to xelatex and polyglossia. This can display Arabic and Hebrew, however when I add in the style file I need with hyperref, it breaks. Here's that minimal working example:
\documentclass[11pt,a4paper]{article}
\usepackage[hyperref]{sty_file}
\usepackage{times}
\usepackage{latexsym}
\usepackage{booktabs}
\usepackage{url}
\usepackage{polyglossia}
\setdefaultlanguage{english}
%\setotherlanguage{arabic}
%\setotherlanguage{hebrew}
%\newfontfamily\arabicfont{Amiri}[Script=Arabic]
%\newfontfamily\hebrewfont{Noto Sans Hebrew}[Script=Hebrew]
\title{Hebrew Arabic Test}
\begin{document}
\maketitle
English
%\begin{Arabic}
%أهلاً
%\end{Arabic}
%\begin{hebrew}
%שלום
%\end{hebrew}
\end{document}
As soon as you uncomment the first commented lines, it breaks my styling. It would be a lot to paste the style file here, but it is included in this overleaf document.
Any ideas? I've tried everything else I found on this stack exchange with no luck. :/ Thanks!
\documentclass{...}
and ending with\end{document}
. The easier it is to copy and test your code, the more likely your question will be answered and can help others in a similar situation.pdflatex
, but in my view it's just not work the pain unless you really have to. If at all possible switch toxelatex
. You can even usebabel
now if your requirements are not too complex.