basically, we have a bunch of tex files describing various math models.
most of the time a model is an extension of an already existing one for which there is already a tex file with description. so, the equations describing a new model are equation from the old one + some extra stuff.
instead of just copying/pasting tex code, is there a way of creating a link (reference) to an equation in other tex file?
thanks
General ⇒ Is there a way of linking equations to a different tex file?
-
- Posts: 3
- Joined: Thu Oct 21, 2010 5:54 am
Re: Is there a way of linking equations to a different tex f
The simplest solution is that you define the recurring fragments as commands:
\newcommand{\codeA}{Here comes my code}.
The second option is that you define the different fragments in a dedicated files and include them with \input{codeA}.
There are also possibilities to do this with if-else statements, but it is rarely worth the effort.
\newcommand{\codeA}{Here comes my code}.
The second option is that you define the different fragments in a dedicated files and include them with \input{codeA}.
There are also possibilities to do this with if-else statements, but it is rarely worth the effort.
-
- Posts: 3
- Joined: Thu Oct 21, 2010 5:54 am
Re: Is there a way of linking equations to a different tex f
thanks!
i'm not sure though how to use a newcommand in file model2.tex that was defined in model1.tex?
i'm not sure though how to use a newcommand in file model2.tex that was defined in model1.tex?
Is there a way of linking equations to a different tex file?
You see check out the xr package and see if it has the capabilities you need.
-
- Posts: 3
- Joined: Thu Oct 21, 2010 5:54 am
Re: Is there a way of linking equations to a different tex f
thanks.
looks like xr package only allows referencing from external files.
I think method using \input{..} would do the trick.
looks like xr package only allows referencing from external files.
I think method using \input{..} would do the trick.
Re: Is there a way of linking equations to a different tex f
You don't need to do anything special for cross references or newcommands defined in another file if you're using \input. With \input, it's more or less as if you had copied the contents of the inputted file into that spot of the other file. Labels and commands defined in the master file (or in an earlier inputted file) should just work. If if it's not for you, post an example of the kind of thing giving you trouble.