holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.51k stars 111 forks source link

Lualatex problems #658

Closed FMuro closed 1 year ago

FMuro commented 1 year ago

Since the update to texlive 2023 I'm unable to use lualatex. I get the following message:

`LaTeX2e <2022-11-01> patch level 1 ...3/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:4145: bad argument

1 to 'find' (string expected, got nil)

stack traceback: [C]: in function 'string.find' ...3/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:4145: in main chun k [C]: in function 'dofile' ...y/texlive/2023/texmf-dist/tex/luatex/lualibs/lualibs.lua:96: in local 'load module' ...ive/2023/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua:44: in main chunk [C]: in function 'dofile' ...y/texlive/2023/texmf-dist/tex/luatex/lualibs/lualibs.lua:96: in local 'load module' ...y/texlive/2023/texmf-dist/tex/luatex/lualibs/lualibs.lua:106: in main chunk [C]: in function 'require' ...023/texmf-dist/tex/luatex/luaotfload/luaotfload-init.lua:224: in upvalue 'i nit_main' ...023/texmf-dist/tex/luatex/luaotfload/luaotfload-init.lua:590: in function ' luaotfload-init.lua' ...ive/2023/texmf-dist/tex/luatex/luaotfload/luaotfload.lua:322: in field 'mai n' [\directlua]:1: in main chunk.

...ring \\def\string \\encodingdefault{OT1}')end } \let \f@encoding \encoding...`
holzschu commented 1 year ago

Hi, thank you for reporting this. I don't encounter this issue on my own install, so this is weird. I can see from your error message that lualatex is using the TeX install in ~/Library/texlive/2023.

Looking at the source code and the line that corresponds to the error (line 4145 in lualibs-basic-merged.lua), it seems that os.getenv("PATH") did not return a string as expected, which is weirder. Could you check echo $PATH? Even better, make this small file:

#! /bin/lua
print(os.getenv("PATH"))

and execute it with lua smallFille.lua.

FMuro commented 1 year ago

Thanks a lot for your quick answer! Both commands output an empty string (blank line). I’ve even removed a-shell and reinstalled since I had been upgrading some packages installed through tlmgr and was afraid this was the cause. Same results.

holzschu commented 1 year ago

Well, at least this empty string explains the behaviour of lualatex. That might be an issue for you in other places as well, since a-Shell and dash are looking for commands in the $PATH.

The problem will survive a remove-reinstall because a-Shell saves the environment variables and restores them, and iOS keeps that information after uninstalling. I see several fixes:

For the longer explanation: lualatex is trying to find out whether it is running under Windows or something else. To do that, it is checking whether the $PATH environment variables contains ";" (a specific Windows settings) or not. This line fails when $PATH is not set, because that should not happen.

FMuro commented 1 year ago

Thanks a lot! First proposed solution solved the problem. I’ll investigate the other ones if this shows up again.

I might have said that before but, as a fellow scientist I’d like to seize this opportunity to warmly thank you for your work in this app. I use it mostly for latex (also for some simple scripting and vim editing). This app makes getting an iPad worth for me, and it would make it worth even if this was the only existing iPad app (well, this and GoodNotes).

holzschu commented 1 year ago

Thanks a lot! I wrote the app first for myself (long ago, in 2018), then realized I could share it with others. So, yes, it's heavily geared towards our uses as fellow scientists. In recent additions, you can write text in Vim using the pencil, which allows me to be more focused during seminars and meetings (although the interaction with Vim requires having the floating keyboard to enter commands).