auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Output to directory patch


From: Ikumi Keita
Subject: Re: Output to directory patch
Date: Thu, 04 Feb 2021 19:35:02 +0900

Hi Al,

>>>>> Al Haji-Ali <abdo.haji.ali@gmail.com> writes:
> I don't use preview-latex so I am not familiar with the source but I
> will look into it. In the meantime, if anyone has any suggestions
> where I should look it would be much appreciated.

The rule which preview-latex determines the location of relavant files
is rather complicated and I don't understand comprehensively. I think it
isn't centralized and I can only summarize the result here:
1. If preamble cache isn't enabled, pdf is generated in the build
   directory, and intermediate pdf2dsc cannot find it.
,----
| Output written on build/abc.pdf (2 pages, 40679 bytes).
| Transcript written on build/abc.log.
| 
| TeX Output exited as expected with code 1 at Thu Feb  4 18:01:40
| Running `Preview-PDF2DSC' with ``pdf2dsc abc.pdf 
abc.prv/tmpc4aAyA/preview.dsc''
| [...]
| Last OS error: No such file or directory
| Current file position is 1814
| GPL Ghostscript 9.52: Unrecoverable error, exit code 1
| 
| Preview-PDF2DSC exited abnormally with code 1 at Thu Feb  4 18:01:40
| PDF2DSC sentinel: Opening input file: No such file or directory, 
/home/keita/test-tex/abc.prv/tmpc4aAyA/preview.dsc
`----

2. If preamble cache is enabled, pdf is generated in the master
   directory. Then pdf2dsc succeeds, but subsequent gs cannot find
   pdf file.
,----
| GS>systemdict /.addcontrolpath known {/PermitFileReading (build/abc.pdf) 
.addcontrolpath
| /PermitFileReading (abc.prv/tmp3DeZkH/preview.dsc) .addcontrolpath} if 
{<</PermitFileReading[(build/abc.pdf)(abc.prv/tmp3DeZkH/preview.dsc)]>> 
setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped 
pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if 
def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne 
or{.preview-BP gsave 1 1 0.878431 setrgbcolor clippath fill grestore 
}{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 
roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse 
exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  
(abc.prv/tmp3DeZkH/preview.dsc)(r)file /.preview-ST 1 index def dup 0 
setfileposition 458()/SubFileDecode filter cvx exec .preview-ST dup dup 458 
setfileposition 53()/SubFileDecode filter cvx<<>>preview-do
| Error: /typecheck in --setfileposition--
| Operand stack:
|    (abc.pdf)   (r)   (r)   (r)   458
| [...]
`----

>> (2) Latex signals error when \include tries to include files in
>> subdirectories like \include{subdir/subfile}, saying
>> ./main.tex:6: I can't write on file `subdir/subfile.aux'.
>> Apparently latex wants to create .aux file for each individual
>> subfile under "build/subdir", which doesn't exist.
>> 
>> In addition, I'm worrying whether packages which write or read external
>> files via shell escape work well or not. It seems that tikzexternal
>> works fine, but it isn't clear for other packages.
>> 

> Regarding both of these points. The point of this patch is to expose
> the functionality to output to a sub-directory that is in many tools
> including TeX engines. This is supported by other tools like latexmk
> for example. IMO, errors in packages that don't work with this
> functionality is a bug in those packages. Nevertheless, this does
> advocate for making the TeX-output-dir a buffer-local variable so that
> tex files that use incompatible packages can revert to standard
> behaviour.

That seems reasonable idea.

> With that being said, I tried a simple example with a subdir input and
> it works fine for me.

Well, didn't you examine \input rather than \include? As far as I can
see, \include causes to generate aux file while \input does not. Please
try example like these:
---- main.tex --------------------------------------------------------
\documentclass{article}
\begin{document}
main

%\input{subdir/subfile}
\include{subdir/subfile}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-output-dir: "build"
%%% End:
----------------------------------------------------------------------
---- subdir/subfile.tex ----------------------------------------------
dummy

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../main"
%%% TeX-output-dir: "build"
%%% End:
----------------------------------------------------------------------
Type C-c C-c in the buffer of main.tex.

Regards,
Ikumi Keita



reply via email to

[Prev in Thread] Current Thread [Next in Thread]