On Mon, Nov 20, 2023 at 10:34:48AM -0500, Alexander Dunlap wrote:
> Yes that is right, sorry for not reading carefully. :-)

Alas, the former fix breaks with path specifications.

The path searching mechanism of pdflatex (when -output-directory is used)
is willing to consider current directory for path like "../../a/b/file"
but is unwilling to consider current directory when only "file" is provided.
Weird.

Alexander, would you mind testing for me 2nd version of the patch?
You need to unwind the last patch ("-R" for patch or just delete the
simple change manually) and then apply the current one.

3 scenarios to be tested:
1. a5toa4 local_file.pdf
2. a5toa4 some_relative_path/file.pdf
3. a5toa4 /absolute_path/file.odf

Works here with TL 2020, but I worry what other changes on searching
mechanisms of -output-directory awaits in the future TLs.
Pavel
--- pfarrei.tlu 2023-11-21 11:43:19.611137725 +0100
+++ pfarrei.tlu 2023-11-21 11:46:53.993277671 +0100
@@ -100,11 +100,15 @@
       -- build the temporary tex file
       local tmpdir = os.tmpdir("pfarrei.XXXXXX" )
       local tmpfile = string.match( arg[i], '.*/(.*)$') or arg[i]
+      -- pdflatex's -output-directory search for source pdf works with path 
specification but fails
+      -- when simple file name in the current working directory is provided, 
we need to provide '../' then
+      local local_source=''
+      if tmpfile == arg[i] then local_source = '../' end
       local basename = string.match( tmpfile,'(.*)%.[^.]*$') or tmpfile
       tmpfile = tmpdir..'/'..basename..'.tex'
       local file = assert( io.open( tmpfile, 'w' ) )
       if booklet then assert( 
file:write("\\PassOptionsToPackage{booklet}{pfarrei}\n") ) end
-      assert( file:write("\\def\\OriginalFile{",arg[i],"}\n") )
+      assert( file:write("\\def\\OriginalFile{"..local_source,arg[i],"}\n") )
       assert( file:write("\\input{a5toa4.tex}\n") )
       assert( file:flush() )
       file:close()
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to