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. Oct 3, 2017 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, 2017 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. Oct 3, 2017 at 6:11

1 Answer 1


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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .