0

I'm trying to write a word in italic in Xelatex using overleaf. But \textit doesn't work for persian words unless I upload a font. When I do so I can only upload .ttf files and by uploading the italic font all the text is written in italic.

What should I do?

\settextfont[Scale=1.0]{XB Yas.ttf}
\begin{document}
\textit{سلام}
\end{document}
  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – dexteritas Jan 10 at 9:29
2

You need to tell fontspec where to find the italic font:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{XB Yas.ttf}[
       BoldFont       = XB YasBd.ttf ,
       ItalicFont     = XB YasIt.ttf ,
       BoldItalicFont = XB YasBdIt.ttf]

\begin{document}
Hello! \textit{سلام}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.