TeX - LaTeX Asked on October 4, 2021
I would like to use the IranNastaliq font with xelatex, the document below throws an error when I try to compile it.
documentclass{article}
usepackage{xepersian}
defpersianfontNastaliq{IranNastaliq}
makeatletter
newenvironment{Nastaliq}{N@stliq}{}
makeatother
begin{document}
begin{Nastaliq}
این طرحنما میآزماید نگاره و اندازه و شکل را
end{Nastaliq}
end{document}
! Package fontspec Error: The font "IranNastaliq" cannot be found.
For immediate help type H <return>.
...
l.6
?
Package fontspec Warning: Font "IranNastaliq" does not contain requested
(fontspec) Script "Persian".
Package fontspec Info: Could not resolve font "IranNastaliq/BI" (it probably
(fontspec) doesn't exist).
Package fontspec Info: Could not resolve font "IranNastaliq/B" (it probably
(fontspec) doesn't exist).
Package fontspec Info: Could not resolve font "IranNastaliq/I" (it probably
(fontspec) doesn't exist).
! Package fontspec Error: The font "IranNastaliq" cannot be found.
You don't need to define an environment.
Use the code below:
documentclass{article}
usepackage{xepersian}
settextfont{Yas}
defpersianfontnas[Scale=4]{IranNastaliq}
begin{document}
begin{nas}
این طرحنما میآزماید نگاره و اندازه و شکل را
end{nas}
end{document}
Output:
Of course, you must first make sure your font is installed.
If you are a Windows 10
user, right-click on the font and select
Install for all users
. If you install it only for your own user account, Windows will put a copy in a hidden directory that XeTeX does not search (and you will need to remove it in the Fonts control panel if you ever want to install it for all users).
On Mac, you would want to install it to the System Font Book. On Linux, there are several places to put it, including /usr/local/share/fonts/
to install it for everyone, and ~/.fonts/
to install it just for yourself.
If you only want to use the font for TeX, and not have it available in your other apps, you can instead put it in a subdirectory of your local TeX tree. Which directory that is will vary, but you can normally find it with
kpsewhich --var-value=TEXMFLOCAL
On the Windows version of TeX Live, for example, this will typically be C:texlivetexmf-local
. On MikTeX, you might need to create a local TeX tree in the MikTeX console. The conventional place to put the file would be under C:texlivetexmf-localfontsopentypeIranNastaliq
, where you probably need to create the sub=folders yourself, but that’s just to make it easier for you to find and delete them later. Dropping the files anywhere in the tree is all the same to XeTeX.
If you’re on a shared computer and don’t have permission to change the TeX installation, you can use the TEXMFHOME
directory instead of TEXMFLOCAL
. The command to find that is
kpsewhich --var-value=TEXMFHOME
If you only need the font for one project, or if you want to make sure you archive one particular version of the font with your project, you can save a copy in your project directory, and XeTeX should find it.
Wherever you put the font, you then might want to update the TeX font caches. (This step is optional.) To do so, run as an administrator either a powershell or a command prompt (hit Win-X on Windows) and run fc-cache.exe -f -s -v
. If you also use LuaLaTeX, you might additionally want to run luaotflaod-tool -f -u -p -v
.
Good luck!
Answered by SH.Madadpour on October 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP