kvafa / bidi

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

Problem with `currfile` while using `xepersian` #27

Open neo-apz opened 1 year ago

neo-apz commented 1 year ago

Brief outline of the issue

I'm experiencing an issue where using the xepersian/bidi package breaks the functionality of the currfile package.

I have a main tex file and several subdirectories where I store my other files, and I have some helper macros that facilitate inclusion of these files in the subdirectories, and those rely on \currfilebase and \currfilename. But for some reason I'm always getting the main file's name even inside the other files. This only happens when the xeperian package is imported and without it everything works fine.

The issue seems to be related to the bidi package redefining some of the underlying commands (like InputIfFileExists) and breaking the hooks (see the discussion under the thread on tex.stackexchange).

Check/indicate

Minimal example showing the issue

I created a small example that shows the behavior I'm experiencing: main file content [main.tex]:

\documentclass[10pt]{book}
\usepackage[parent]{currfile}

\usepackage{xepersian}
\settextfont{Vazirmatn}
\setdigitfont{Vazirmatn}

\begin{document}

\begin{latin}

    This is from the main file:

    currfilepath: \currfilepath

    currfilename: \currfilename

    CurrentFile: \CurrentFile

    CurrentFilePath: \CurrentFilePath

    \input{dir/inside_dir}

\end{latin}

\end{document}

Then create a dir directory in the above directory and inside it create this inside_dir.tex file:

This is from the inside\_dir file:

currfilebase: \currfilebase

currfilepath: \currfilepath

currfilename: \currfilename

CurrentFile: \CurrentFile

CurrentFilePath: \CurrentFilePath

And then compile in the main dir using xelatex to see the output below:

xelatex main

Expected behavior

If I don't have the xepersian package, the output looks like below, which is the correct behavior:

Log and PDF files

Screenshots are provided above.

neo-apz commented 1 year ago

@kvafa, any chance you can look into this? your help is much appreciated.