cheraaqee / presenting_concepts

Becomming skilled at presenting concepts and mastering its tools. (The repo is initiated as the infrastructure for the course on the same topic at the Univeristy of Guilan.)
3 stars 1 forks source link

XeTeX lr command font issue #2

Open aarmn opened 1 year ago

aarmn commented 1 year ago

Hello there,

Some days ago I noticed, XeTeX, with xepersian, have some serious issues with handling space separated English text blocks. After asking prof, I used \lr command, but it seems like \lr command font is diff from main text font, and I found no field (yet) which set it

Without \lr command: Hello World would be rendered as World Hello

If anyone noticed it before, I would be happy to hear about their experience on case

If not, I would submit my answer here in some time, If I found any

cheraaqee commented 1 year ago

A little check: I use $ xelatex blabla.tex, not $ xetex blabla.tex. I don't know even if this is relevant, I don't know about XeTeX; just wanted to try my shot.

cheraaqee commented 1 year ago

By the way, (always) share the source of a MWE (minimal working example) that generates your un-desired output.

aarmn commented 1 year ago

A little check: I use $ xelatex blabla.tex, not $ xetex blabla.tex. I don't know even if this is relevant, I don't know about XeTeX; just wanted to try my shot.

As far as I checked, they seem synonymous. my command is also xelatex; but look at first line of xelatex --version

XeTeX 3.141592653-2.6-0.999993 (Web2C 2021/nixos.org)
kpathsea version 6.3.3
Copyright 2021 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 71.1; using 71.1
Compiled with zlib version 1.2.13; using 1.2.13
Compiled with FreeType2 version 2.12.1; using 2.12.1
Compiled with Graphite2 version 1.3.14; using 1.3.14
Compiled with HarfBuzz version 5.2.0; using 5.2.0
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with pplib version v2.05 less toxic i hope
Compiled with fontconfig version 2.14.0; using 2.14.0

As we can see here, in xelatex command output its calling itself as xetex, so I assume its more of a naming (or backward compatibility) problem

It would be great if I knew your xelatex --version output as well

aarmn commented 1 year ago

By the way, (always) share the source of a MWE (minimal working example) that generates your un-desired output.

I did a deeper research, and found this page. following is the relevant part of answer

xetex xetex is a different executable file from tex and pdftex. It includes extensions to the original program to allow Unicode input and right-to-left typesetting, among other features. By default it has the Plain TeX format preloaded and produces PDF output.

xelatex The command xelatex calls the xetex engine but with the LaTeX format preloaded instead of Plain TeX and produces PDF output.

cheraaqee commented 1 year ago

XeTeX 3.141592653-2.6-0.999994 (TeX Live 2022)
kpathsea version 6.3.4
Copyright 2022 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 70.1; using 70.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.11.1; using 2.11.1
Compiled with Graphite2 version 1.3.14; using 1.3.14
Compiled with HarfBuzz version 3.4.0; using 3.4.0
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with pplib version v2.05 less toxic i hope
Compiled with fontconfig version 2.13.0; using 2.13.1```
aarmn commented 1 year ago
kpathsea version 6.3.4
Copyright 2022 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 70.1; using 70.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.11.1; using 2.11.1
Compiled with Graphite2 version 1.3.14; using 1.3.14
Compiled with HarfBuzz version 3.4.0; using 3.4.0
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with pplib version v2.05 less toxic i hope
Compiled with fontconfig version 2.13.0; using 2.13.1```

I guess first line is omitted

cheraaqee commented 1 year ago
kpathsea version 6.3.4
Copyright 2022 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 70.1; using 70.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.11.1; using 2.11.1
Compiled with Graphite2 version 1.3.14; using 1.3.14
Compiled with HarfBuzz version 3.4.0; using 3.4.0
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with pplib version v2.05 less toxic i hope
Compiled with fontconfig version 2.13.0; using 2.13.1```

I guess first line is omitted

Updated

cheraaqee commented 1 year ago

I gave it a try. I could compile some different fonts, but I'm not sure how to do that in XeLaTeX (or even LaTeX) for any arbitrary font. Can you share the source you're compiling and the output you get from it?

aarmn commented 1 year ago

This is a sample xelatex MWE doc

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{hyperref}
\usepackage{xepersian}
\settextfont[Scale=1.2]{Vazirmatn}
\usepackage{quoting,xparse}

\NewDocumentCommand{\bywhom}{m}{% the Bourbaki trick
  {\nobreak\hfill\penalty50\hskip1em\null\nobreak
   \hfill\mbox{\normalfont(#1)}%
   \parfillskip=0pt \finalhyphendemerits=0 \par}%
}

\NewDocumentEnvironment{pquotation}{m}
  {\begin{quoting}[
     indentfirst=false,
     leftmargin=\parindent,
     rightmargin=\parindent]\itshape}
  {\bywhom{#1}\end{quoting}}

\begin{document}
\title{آزمایش ترکیب متن فارسی و انگلیسی در XeLaTeX}
\author{علیرضا محمّدنژاد}
\maketitle
\section{تست}
\paragraph{}
متن فارسی بی اشکال نمایش داده می‌شود

\lr{English text is visible as well, but the font differ when written in lr block}

And would be reversed words order when not

متن فارسی در کنار English Text

English Text در کنار متن فارسی

متن فارسی در کنار \lr{English Text} در دستور ال‌آر

\end{document}

sample on transparent png texmaker ss

cheraaqee commented 1 year ago

The default font name is Computer Modern. (since you asked.)

aarmn commented 1 year ago

The default font name is Computer Modern. (since you asked.)

Thank you! It would be a great contribution for keeping English font consistant thought out; Not ideal, but it would be good enough for my usecase.

I would test and if it worked, I would close the issue, reopening only if a better solution become available.