I want to generate a new file with the LaTex command \openout in LyX to write 
the number of compilation into that separate file (see example below). This 
works perfectly but the file is written into the temp-folder of LyX and 
therefore deleted after closing the LyX session.

How can I make LyX to write/read my (new) file in the same folder where the 
main .lyx document is stored? All other temporary files generated by Lyx (or 
LaTex) shall remain in the temp-folder.

To give a full path in the LaTex code is not allowed in LaTex. LaTex blocks 
writing a file in any free path.

Thank you!

Manfred

\newcounter{compilationNumber}
\newwrite\writecompilationNumber
\newread\readcompilationNumber
\openin\readcompilationNumber=CompilationVersion.vrs
            % This file shall be in the same folder where the lyx-File is stored
            %
\ifeof\readcompilationNumber
  % Bisher kein File vorhanden
  \setcounter{compilationNumber}{1}%
\else
  \read\readcompilationNumber to \temp
  \setcounter{compilationNumber}{\temp}%
  \stepcounter{compilationNumber}%
\fi
\closein\readcompilationNumber
\immediate\openout\writecompilationNumber=CompilationVersion.vrs
            %         % This file shall be stored in the same folder where the 
lyx-File is stored
            %
\immediate\write\writecompilationNumber{\arabic{compilationNumber}}
\immediate\closeout\writecompilationNumber


This is \LaTeX{} compilation number \thecompilationNumber.



Reply via email to