Page Layout ⇒ package availability to input files
-
- Posts: 3
- Joined: Fri Jan 06, 2012 3:07 am
package availability to input files
I have inherited some files and am very new to Latex so have been reading up quickly. Some of the files have the preamble then the main document is made up of lots of input files with each section in a new file. I like the idea of this but my understanding is the \usepackage command has to be in the preamble, and then it is available to the entire document. However that interferes with some of the input files and causes them not to work properly. Is there any way I can restrict the use of a particular package to only one of the input files?
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
package availability to input files
In general, that's not simply possible. Perhaps explain your specific problem, tell us the error messages and the code you are using.bartybear44 wrote:However that interferes with some of the input files and causes them not to work properly. Is there any way I can restrict the use of a particular package to only one of the input files?
Stefan
LaTeX.org admin
-
- Posts: 3
- Joined: Fri Jan 06, 2012 3:07 am
Re: package availability to input files
Thank you Stefan.
The original document is a set of solutions to exercises and past exam papers. It works fine and the main body of the file is a series of input files that are all input as sections. I wanted to update it with the most current exam papers from 2011. So I took the preamble off them and the begin and end document statements and resaved them, then input them as new sections using the same syntax as the other sections. When I tried to compile it the new material gave lots of error messages and I realised that the original file did not include the amsmath package so it didn't recognise \bmatrix and other commands in the new exams. So I included the amsmath package in the preamble to the original document and compiled it again - then I got error messages from the original input files - it would no longer recognise some of the commands that were defined in the preamble.
As I write this it occurs to me that perhaps the order in the preamble is important - is that so? The original preamble had all the packages at the beginning then any specifically defined commands for this document etc. so I put the amsmath package at the beginning with all the other packages, perhaps it would be better later. I am sorry I cannot be more specific at the moment as I am not at work and don't have access to the files from home, or to try this idea. Thank you.
The original document is a set of solutions to exercises and past exam papers. It works fine and the main body of the file is a series of input files that are all input as sections. I wanted to update it with the most current exam papers from 2011. So I took the preamble off them and the begin and end document statements and resaved them, then input them as new sections using the same syntax as the other sections. When I tried to compile it the new material gave lots of error messages and I realised that the original file did not include the amsmath package so it didn't recognise \bmatrix and other commands in the new exams. So I included the amsmath package in the preamble to the original document and compiled it again - then I got error messages from the original input files - it would no longer recognise some of the commands that were defined in the preamble.
As I write this it occurs to me that perhaps the order in the preamble is important - is that so? The original preamble had all the packages at the beginning then any specifically defined commands for this document etc. so I put the amsmath package at the beginning with all the other packages, perhaps it would be better later. I am sorry I cannot be more specific at the moment as I am not at work and don't have access to the files from home, or to try this idea. Thank you.