0

I realized that I use the same preamble across several files. These are mostly articles formatted in precisely the same --- headers, footers, margins, font, etc. Even the title page is formatted the same way --- contents change but the page structure remains the same.

My approach so far has been to copy paste from an earlier file. This works, but is not elegant.

Is there a better way? Some kind of a template file? So, I ask TeX to use the same template and everything is taken care of including the title page and TOC. Of course, I understand, I will need to provide title page details like author name, etc.

FWIW, I mostly use auctex on emacs. But have to use vim and co. occasionally.

  • You can just write the preamble in mypreamble.tex, say, and include it with \input{mypreamble} in the preambles of these files. – user121799 Oct 3 '18 at 4:36
  • @marmot Thanks. How do I pass on variables like author names? Also, how do I set-up the title page and TOC? These two things come after the preamble – deshmukh Oct 3 '18 at 4:46
  • I do not understand the question. Just define the author and other stuff in the respective file. – user121799 Oct 3 '18 at 4:49
1

You could write your preamble mypreamble.tex and save it (but without writind \documentclass[...]{...} as usual), then on your main file you write \documentclass[...]{...} and immediatly after you define \title{My title}, \author{Me},... and then you input your preamble with \input{myoreamble.tex}. I hope this helps

| improve this answer | |

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.