GeneralReferring to miscellaneous chunks of LaTeX code

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
NB2010
Posts: 4
Joined: Fri May 14, 2010 5:35 pm

Referring to miscellaneous chunks of LaTeX code

Post by NB2010 »

Hi,
I hope this request makes sense, essentially im building a large document with a lot of flow charts, im using the tikzpicture environment for the flowcharts but it upsets the main document (and me!) including all the tikz code, id like to keep that in a seperate document and just call the chunks of code.

I know i can use \input{} command and keep the tikz code for each flowchart in a seperate .tex file but id like to have them all in the one tikzflowcharts.tex document and call them from main.tex document.

Thanks for any help

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Referring to miscellaneous chunks of LaTeX code

Post by localghost »

I'm not sure if it will help, but you can try the xr package.


Best regards
Thorsten
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Referring to miscellaneous chunks of LaTeX code

Post by frabjous »

Why not have your separate document consist of a bunch of defined commands, e.g.:

Code: Select all

\newcommand{\myfirstchart}{%

% code for the first chart goes here

%
}

\newcommand{\anotherchart}{%

% code for another chart goes here

%
}
Then you'd only have to use \input once to load the entire set of commands (at the beginning or something). Then you'd just use the defined commands \myfirstchart or \anotherchart in the appropriate places in your document.

Another thing to consider would be to use an editor that does code folding.
NB2010
Posts: 4
Joined: Fri May 14, 2010 5:35 pm

Re: Referring to miscellaneous chunks of LaTeX code

Post by NB2010 »

Thanks for the replies, I have implemented the simple suggestion of using \newcommand for each flowchart, by fabjous and it has helped tidy up my project a lot.

Many thanks
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Referring to miscellaneous chunks of LaTeX code

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic accordingly as clearly written in the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.
Post Reply