0

I use Hebrew in Overleaf and for some reason the text always looks really bold compared to English text, which is very annoying. Is there any way this could be fixed?

Code and pic attached. Thanks in advance!

Comparison

\documentclass[a4paper, 10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[english,hebrew]{babel}
\begin{document}
הנה קצת טקסט בעברית 
\L{and here's some text in English}
\end{document}
tcb93
  • 167
  • 2
    You are relying here on babel's default fonts for overleaf's latex distribution. Load and try other fonts and find the one that you like. – tush Oct 31 '22 at 18:10
  • @tush how do you load other fonts and set them as your default? – tcb93 Oct 31 '22 at 18:12
  • Try \babelfont{rm}[Language=Hebrew]{Font name} where font name is one of those listed here. – tush Oct 31 '22 at 18:17
  • @tush I got this error: "l.21 \babelfont {rm}[Language=Hebrew]{Arial} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined." – tcb93 Oct 31 '22 at 18:24
  • I'm not sure that using overleaf is a good idea. It seems to have its own idea about LaTeX things. – Peter Wilson Oct 31 '22 at 20:06
  • @tcb93 You should compile with xelatex not pdflatex. – tush Oct 31 '22 at 22:06

2 Answers2

1

I don't know what fonts are installed in Overleaf, but with

\documentclass[a4paper, 10pt]{article}

\usepackage[utf8x]{inputenc} \usepackage[english,hebrew]{babel} \renewcommand{\rmdefault}{nachlieli} \begin{document}

הנה קצת טקסט בעברית \L{and here's some text in English}

\end{document}

I get

enter image description here

Instead of nachlieli, try david, frank, aharoni, drugulin, yad, ellinia, miriam. Choices are quite restricted except if you switch to xetex or luatex, which are supported by babel. See, for example:

An external link is https://latex3.github.io/babel/guides/locale-hebrew.html

Javier Bezos
  • 10,003
0

Try polyglossia instead.

a

% !TeX TS-program = xelatex

\documentclass[a4paper, 10pt]{article} %%\usepackage[utf8x]{inputenc} % not needed

\usepackage{polyglossia}

\setdefaultlanguage{english} \newfontfamily\englishfont[Ligatures=NoCommon]{Linux Libertine O} \setotherlanguage{hebrew} \newfontfamily\hebrewfont[Script=Hebrew]{Arial}

\begin{document} הנה קצת טקסט בעברית

\L{and here's some text in English} 

\end{document}

Simon Dispa
  • 39,141