persiantex / bidi

Bidirectional typesetting in plain TeX and LaTeX, using XeTeX
https://ctan.org/pkg/bidi
7 stars 0 forks source link

bidi needs to be adapted to the next latex version #18

Open u-fischer opened 4 years ago

u-fischer commented 4 years ago

We just released a new development version of the next LaTeX version, In this dev release we implemented a new hook system and extended the existing set of hooks.

Details can be found in the announcement: https://www.latex-project.org/news/2020/07/22/latex-dev-2020-10-1b/

This changes break with bidi as biditools patches \document in an incompatible way.

\documentclass{article}
\usepackage{bidi}
\begin{document}
\end{document}

gives when compiled with xelatex-dev and the format

  LaTeX2e <2020-10-01> pre-release-7 
! Extra \endgroup.
\document ->\endgroup 
                      \let \bidi@AtEndPreamble \@firstofone \bidi@endpreambl...
l.12 \begin{document}

Please adapt bidi so that is doesn't fail when the final release in October hits the streets.

The new hooks should allow bidi to add the needed code without patching \document. If you need help with the implementation or have questions please open an issue at the latex2e github.

Some suggestion about an implementation that allows the package to work with older and newer formats can be found here: https://listserv.uni-heidelberg.de/cgi-bin/wa?A2=LATEX-L;22740d74.2007&S=

Ulrike Fischer, LaTeX team

u-fischer commented 3 years ago

Any news on this issue? The LaTeX release is planed for begin of october, that is in a week, but bidi still errors with it.

seloumi commented 3 years ago

@u-fischer I have update latex and bidi breaks, Vafa does not respond. biditools need to be updated. Here a working example

\documentclass{article}
\let\olddocument\document
\usepackage[rldocument]{bidi}
\let\document\olddocument

\makeatletter
\@ifl@t@r\fmtversion{2020/10/01}{%
 \AddToHook{begindocument/before}{%
 \let\bidi@AtEndPreamble\@firstofone
  \bidi@endpreamblehook
  \protected\def\bidi@AtEndPreamble{\@notprerr\@gobble}%
  \bidi@undef\bidi@endpreamblehook}
   \AddToHook{begindocument/end}{%
  \let\bidi@AfterEndPreamble\@firstofone
  \bidi@afterendpreamblehook
  \protected\def\bidi@AfterEndPreamble{\@notprerr\@gobble}%
  \bidi@undef\bidi@afterendpreamblehook
  \ignorespaces}
  \bidi@patchcmd\enddocument
  {\fi
   \UseHook{enddocument/afteraux}%
  }
  {\let\bidi@AfterEndDocumentCheckLabelsRerun\@firstofone
   \bidi@afterenddocumentchecklabelsrerunhook
   \fi
   \UseHook{enddocument/afteraux}%
   }
   {}
   {}
 }{%
\bidi@preto\document{%
  \endgroup
  \let\bidi@AtEndPreamble\@firstofone
  \bidi@endpreamblehook
  \protected\def\bidi@AtEndPreamble{\@notprerr\@gobble}%
  \bidi@undef\bidi@endpreamblehook
  \begingroup}
\bidi@appto\document{%
  \let\bidi@AfterEndPreamble\@firstofone
  \bidi@afterendpreamblehook
  \protected\def\bidi@AfterEndPreamble{\@notprerr\@gobble}%
  \bidi@undef\bidi@afterendpreamblehook
  \ignorespaces}  
}
\makeatother

\begin{document}

text from right to left

\end{document}
u-fischer commented 3 years ago

@seloumi we added a fix to the firstaid package, so bidi shouldn't error (this doesn't mean that everything works, we can not check every patch it does).

Your document with the patches compiles without error for me:

\documentclass{article}
\usepackage[rldocument]{bidi}
\begin{document}

text from right to left

\end{document}
seloumi commented 3 years ago

@u-fischer Thanks, awaiting for upload changes to ctan.

u-fischer commented 3 years ago

it should be already there. I have it both in miktex and texlive.

majid-vaghari commented 3 years ago

I created a Gist so you can copy and paste in your project and import instead of importing XePersian: XePersian Fix Hope it helps.

MagisterGollan commented 3 years ago

I am using bidi indirectly via polyglossia to put a tiny amount of Hebrew in a Renaissance Latin text, and I am getting a warning which seems to break all the hyphenation of Polytonic Greek in the document. The Hebrew actually typesets fine, but I have to comment it out to get the Greek hyphenation to work... It sees likely to be related to this issue.

(/usr/local/texlive/2020/texmf-dist/tex/xelatex/bidi/bidi.sty


Package biditools Warning: Patching `\enddocument' failed on input line 916.

simurgh9 commented 2 years ago

I am using polyglossia to use Urdu as the other language and I get the same warning,

Warning Package biditools Warning: Patching '\enddocument' failed on input line 916.

vafa-khalighi commented 2 years ago

I sincerely apologize for being very slow and get to this issue quite late. I have uploaded version 36.4 of the bidi package to CTAN which fixes this issue. You can see the Release Announcement. Please test the new version against this issue; if it indeed fixes the issue, then please close this issue and if it does not, then please let me know what needs to be done so that I can fix it.

Please also note that I had to move the GitHub repository to a new place. The new repository can be found here. If you have reported any issues in the old repository, there is no need to re-report it in the new one but for the new issues, please kindly use the new repository.

There is also a Discussions section on the new repository which you can use to ask questions that need my attention. The announcements for future versions of the bidi package also will appear in Discussions under Announcements.

Finally, if you ever need to contact me directly, you can find my email address in the PDF documentation on the second title page.

simurgh9 commented 2 years ago

I ran tlmgr info bidi | grep -i "version" and got cat-version: 36.6. I still get these,

 /usr/local/texlive/2021/texmf-dist/tex/latex/polyglossia/polyglossia.sty
      Warning LaTeX hooks Warning: Generic hook 'file/after/tracklang.sty' is deprecated.
 /usr/local/texlive/2021/texmf-dist/tex/latex/polyglossia/polyglossia.sty
      Warning LaTeX hooks Warning: Generic hook 'package/after/bidi' is deprecated.
 /usr/local/texlive/2021/texmf-dist/tex/latex/polyglossia/polyglossia.sty
      Warning LaTeX hooks Warning: Generic hook 'package/after/luabidi' is deprecated.

The end document warning however is gone. I am not very well-versed in latex packages. I assume the warnings should be reported somewhere with polyglossia? Or, is this still an issue related to your package?

vafa-khalighi commented 2 years ago

These are specific to polyglossia and should be mentioned to its maintainers.