Like classes in java (if that means anything to anyone)? Can you have a document which handles all the graphing, another which handles the figures where you can call parts when you need them in your main document.

The reason I ask is that one of the things that trips me up about latex is I get totally lost trying to find bits of the document. I am trying to find a way to do it. Texmaker has some ways of figuring out where you are by letting you click on a section but it has other disadvantages and I would be interested if there are more possibilities that I have not tapped into yet.


The boxhandler package has a figure and table deferral option that I sometimes use to do what you desire. Basically, you tell the document to hold back on printing the figures, then you input all the figures from a separate file (but they are not printed). Then, as you wish to print one, you use the \nextFigure command. It also has separate provisions for doing this for tables too. You have to change your figure and table definitions to the format used by boxhandler, which uses a command (\bxfigure{}{}) rather than an environment format.

Here's an example. First, my figure file myfigs.tex

\bxfigure[ht]{Caption to fig 1}{\fbox{DATA FOR FIG 1}}

\bxfigure[ht]{Caption to fig 2}{\fbox{DATA FOR FIG 2}}

\bxfigure[ht]{Caption to fig 3}{\fbox{DATA FOR FIG 3}}

And here is the source file that employs them:


This is the first part of my text

Then the next section

And the last section of text


enter image description here

  • I don't follow what is going on here. Can you please elaborate on what you mean by the data and how the directories would be structured? – Magpie Mar 12 '13 at 11:00
  • @Magpie I'm not sure about directories, but the technique described allows all the LaTeX code for the figures & tables to be defined in a separate file, which is then \input to the preamble. With boxhandler's \hold... feature, the figures (and tables) are not printed out, but rather put into LaTeX boxes, to be later recalled (in sequence) by commands like \nextFigure and \nextTable. The result is that the text of the source document is not cluttered up with a bunch of figure and tabular definitions, which can get in the way of editing legibility. – Steven B. Segletes Mar 12 '13 at 11:07

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.