0

I'm trying to get LaTeX to print several non-Latin scripts, e.g. Arabic, Farsi, and possibly some others. I'm using PDFLaTeX in TeXstudio.

I've tried using this solution: https://tex.stackexchange.com/a/368201/289942 but nothing happens or rather, it just doesn't work as it's described there.

My main language is English.

MWE:

\documentclass[a4paper, 12pt, oneside]{article}
\usepackage[a4paper, portrait, margin=0.9in,headheight=14.5pt]{geometry}

\usepackage[utf8]{inputenc} \usepackage[arabic,farsi,english]{babel}

\begin{document} Giaurs - From Persian \FR{فروشگاه‎}(gâvor) \end{document}

The error tells me: Unicode character ‎ (U+200E) not set up for use with LaTeX. Giaurs - From Persian \FR{فروشگاه‎} that U+200E is the R to L invisible character, but when I try defining it there's no change.

Is there an option to just pass through non-Latin characters as is? Any solution as to why this isn't working are appreciated.

  • It is much easier to set up non latin scripts with luatex than pdftex, is pdftex really a requirement? Pdftex can not "pass through" anything as it is 8 bit input and 8 bit fonts so can not handle standard Araic fonts at all and requires special mapping to be set up – David Carlisle Aug 22 '23 at 13:16
  • @DavidCarlisle No, Pdftex (is that the same as PDFLaTeX?) isn't a requirement. How difficult will it be to port all the other stuff in my document to Luatex though? And how would I go about this, including the language stuff? – ReaderGuy42 Aug 22 '23 at 13:33
  • It's supposed to "just work" but \documentclass{article} \usepackage[arabic]{babel} \begin{document} \end{document} gives a UTF-8 error inside the arabic setup files which was ... unexpected, let me try the newer babel interface.... – David Carlisle Aug 22 '23 at 13:57

1 Answers1

1

I can't read the script so apologies if this is completely messed up, but with lualatex, something like

enter image description here

\documentclass[a4paper, 12pt, oneside]{article}

\usepackage[bidi=basic]{babel}

\babelprovide[main, import]{english} \babelprovide[onchar = ids fonts]{arabic} \babelfont[arabic]{rm}[Renderer = HarfBuzz, Scale = MatchLowercase]{Amiri}

\begin{document} Giaurs - From Persian فروشگاه‎ (gâvor) \end{document}

David Carlisle
  • 757,742
  • Is there a } missing after Amirixpdf? If it's not there, it just get File ended while scanning use of \\bbl@bblfont. If I add a } I get many errors, the first being: Package fontspec Error: The font "Amirixpdf" cannot be found. \begin{document}

    I'm using TexStudio and switched the Default Compiler to txs:///lualatex. Was that correct?

    – ReaderGuy42 Aug 22 '23 at 14:27
  • Great, thanks! But I'm still getting the error about the font not being found. Did I change the compiler the right way? Thanks!! – ReaderGuy42 Aug 22 '23 at 14:31
  • @ReaderGuy42 it should be {Amiri} (or any other Arabic font you have installed) – David Carlisle Aug 22 '23 at 14:32
  • Fantastic, now it works! Thanks a bunch :) – ReaderGuy42 Aug 22 '23 at 14:33
  • It works as intended now, but it's telling me that \babelprovide is an unrecognized command. Is that bad? – ReaderGuy42 Aug 22 '23 at 14:39
  • @ReaderGuy42 it can't work and give that error. You would have to have a very old babel for \babelprovide to be undefined, are you sure it says that (don't believe texstudio's summary of errors which is worse than useless, what does the log say) – David Carlisle Aug 22 '23 at 14:49
  • It's not throwing an error, but Texstudio can highlight a command, and if you hover over it it tells you that it's unrecognized. It still compiles though, which I always find confusing. – ReaderGuy42 Aug 22 '23 at 18:16
  • @ReaderGuy42 that just means your editor can't help with that command for command completion and syntax colouring etc, it has no effect on latex – David Carlisle Aug 22 '23 at 18:38
  • ah, good to know, thank you! – ReaderGuy42 Aug 23 '23 at 13:12