I am constantly writing up my homework in Latex and they always have the same framework. Is there anyway I can create a script in Linux that creates a file with the framework then opens it in TexStudio?

For example let's say I am in /home/school/ directory and want to create a file named HW3.tex in the same directory with the framework then open it in TexStudio. Is there anyway of doing this?

  • 1
    I’m not clear what the problem is. Create a template file containing the framework, and then just copy it as needed. – Scott Oct 3 '17 at 0:38
  • I would like to do this efficiently. Like if I type newtex filename.tex it will create a filename.tex file in my current directory with a framework that is already predefined in another .tex file. – David Oct 3 '17 at 0:40
  • If a man can hammer a needle in 20 seconds, how much time does it take for 20 men to hammer the same needle? Solve the problem first, think about optimizing the solution afterwards. – Satō Katsura Oct 3 '17 at 6:11

Create a template file containing the framework, and then write a shell script called newtex that says

cp /path/name/to/your/template "$1"

and, if you want, add

tex "$1"

(or whatever command you use to edit a file).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.