0

I try to use a .txt data in many different folders, so I thought It is enough to put it in the parent folder and all my Latex data can access to it and can also increment the numbers in the .txt data which is in the parent folder. Unfortunately there is an error, which forbid me to change the .txt data in the parent folder. I don't know how to solve this problem.

I would be happy, If someone of you have a solution for my problem.

\newwrite\NoFile
\newread\NoFile
\newcounter{NoRe}
\openin\NoFile=/Users/.../Desktop/.../.../PF/NoFile.txt%
\read\NoFile to \fileline
\setcounter{NoRe}{\fileline}
\closein\NoFile
\stepcounter{NoRe}
\immediate\openout\NoFile=/Users/.../.../.../.../PF/NoFile.txt
\immediate\write\NoFile{\theNoRe}
\immediate\closeout\NoFile
4
  • By default latex can only write to directories below the current directory for security reasons. You can (in texlive, i do not know about miktex) disable this security if you wish, and you trust your documents (ie don't run documents from random internet sites if you have lowered the security...) – David Carlisle Jan 21 at 23:43
  • assuming (from your paths) you have bash shell and a linux texlive , you can probably use a commandline of open_out=any pdflatex myfile – David Carlisle Jan 21 at 23:46
  • Thank you for your answer, I think it is easier if I create subfolder and save the .txt data there. After that my the automator will take the .txt data and send it to the other folders. – IH Pro Jan 22 at 0:23
  • writing to subfolders is allowed by default. – David Carlisle Jan 22 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.