External figures from other folders
Hi there, for images I use: \startplacefigure [title=desciption, reference=fig:demo, number=no] \externalfigure[example][width=13cm] \stopplacefigure But how to reference to the image, if it is in another folger. Say my context mainfile is in ...\projekt and the images are in \projekt\images, then how to reference correctly directly to the images in the subfolder "images"? Thanks Huseyin
On 2013–02–04 "H. Özoguz" wrote:
But how to reference to the image, if it is in another folger. Say my context mainfile is in ...\projekt and the images are in \projekt\images, then how to reference correctly directly to the images in the subfolder "images"?
\setupexternalfigures [directory=images] Marco
On Mon, Feb 4, 2013 at 2:03 PM, Marco Patzer
\setupexternalfigures [directory=images]
The images can also be elsewhere than in a subdirectory: \setupexternalfigures[directory=../graphics] You can also tell ConTeXt to look into multiple directories: \setupexternalfigures[directory={images,drawings}] The above can of course be combined as needed, one of my recent ConTeXt files has \setupexternalfigures[directory={../Classic,../Celtic}] One more trick: ConTeXt will first look for a pic in current directory, then proceed to check out the others defined by \setupexternalfigures. When I worked with a master file and its translations where some figures had translated text and others didn't, I dumped the translated pics in the same directory with my translated tex file, while all the untouched graphics could be found at the root. So when I compiled e.g. the Swedish tex file, it would first look for graphics in its own directory 'swedish', and only if a graphic could not be found, it followed the paths set by \setupexternalfigures. That is, ConTeXt doesn't get confused by having several graphics with the same name in the same tree because it stops looking after the first hit. I figured this out almost by accident and it turned out to be one of the smartest workflow choices I've made during my 10 years of ConTeXting. I could swear I've seen the info on a wiki page, but can't find that now... Anyway, this is always useful to check out, it contains a few more nifty trick: http://wiki.contextgarden.net/Command/setupexternalfigures Mari
Hi, Le 4/02/2013 15:39, Mari Voipio a écrit :
One more trick: ConTeXt will first look for a pic in current directory, then proceed to check out the others defined by \setupexternalfigures. When I worked with a master file and its translations where some figures had translated text and others didn't, I dumped the translated pics in the same directory with my translated tex file, while all the untouched graphics could be found at the root. So when I compiled e.g. the Swedish tex file, it would first look for graphics in its own directory 'swedish', and only if a graphic could not be found, it followed the paths set by \setupexternalfigures.
You were compiling the Swedish tex file from the Swedish directory or from the master directory (where the master file was)? In other words: the compilation of the Swedish text was called from?? the master file? or the Swedish tex file itself? Alain
On Mon, Feb 4, 2013 at 5:30 PM, Alain Delmotte
When I worked with a master file and its translations where some figures had translated text and others didn't, I dumped the translated pics in the same directory with my translated tex file, while all the untouched graphics could be found at the root. So when I compiled e.g. the Swedish tex file, it would first look for graphics in its own directory 'swedish', and only if a graphic could not be found, it followed the paths set by \setupexternalfigures.
You were compiling the Swedish tex file from the Swedish directory or from the master directory (where the master file was)? In other words: the compilation of the Swedish text was called from?? the master file? or the Swedish tex file itself?
Background: at that point of time I couldn't figure out about project structures. And I drew my flow charts in CorelDraw, hadn't taught myself that, either. :-) NB. This is a bit simplified example of how things went, the real thing contains more directories and subdirectories, but those are not important to explain my idea. What I had is a directory structure like this PR-23 PR-23/swedish PR-23/portuguese PR-23/spanish PR-23/german It all started with a single-language project, language subdirectories got added over time when translations turned out to be of essence. [PR-23 is the name of the product for which the document is written.] To illustrate the system with graphics, let's say that the main directory PR-23 contained a flowchart called flow_troubles.pdf and a wiring picture wrg-366.pdf. Wiring drawings are never translated, so every manual version uses the same graphic. On the other hand, the flow chart needs to be translated for every language version. I did that by copying the English original (Corel Draw graphic) into the language folder, then translating, saving and exporting as pdf in that (sub)directory. The result is that both e.g. the subdirectory swedish and the main directory PR-23 would contain a graphic called flow_troubles.pdf, but the one in the subfolder would be in Swedish. Then, if I needed a Swedish manual, I needed to go into subfolder Swedish and compile the main .tex file there. At the beginning of that file I had the command \setupexternalfigures[directory=../]. When the compilation came to wrg-366.pdf, the graphic could not be found in the same directory, so ConTeXt went one step up as instructed and picked up the wiring drawing there. Later when compilation would get as far to flow_troubles.pdf, ConTeXt would look in the working directory 'swedish', find it there and pick up that one and *stop looking for that graphic*. Ergo, because the Swedish one could be found first, the existence of the English version in the search path is not a problem. This way I didn't need to change the names of my graphics nor my code. It was also handy when translations arrived in batches; I translated the graphics one by one and could always compile a proper looking document, first with all graphics in English, then some in the target language, finally fully translated - and still, if a new version of the wiring drawing turned up, I only had to update the master directory and then remember to compile the translations to get the changes in. One more thing to remember is that I really do product manuals and they are always in fluctuation - there's no final version of the manual until the production of that particular model has ceased. Thus years have taught me to avoid duplicate information to utmost, because the more places to update because of a minor change, the more likely it is to forget at least one of them. Been there, done that... [When I switched to ConTeXt, each manual version was a separate MS Word document. To update a wiring drawing, I had to open each version, import the drawing to replace the old one, then save and close. And hope for the best, switching figures in Word wasn't always that straight forward, ConTeXt is definitely more predictable.] Mari
Thanks for the detailed explanation, Mari. Regards, Alain Le 4/02/2013 17:07, Mari Voipio a écrit :
On Mon, Feb 4, 2013 at 5:30 PM, Alain Delmotte
wrote: When I worked with a master file and its translations where some figures had translated text and others didn't, I dumped the translated pics in the same directory with my translated tex file, while all the untouched graphics could be found at the root. So when I compiled e.g. the Swedish tex file, it would first look for graphics in its own directory 'swedish', and only if a graphic could not be found, it followed the paths set by \setupexternalfigures.
You were compiling the Swedish tex file from the Swedish directory or from the master directory (where the master file was)? In other words: the compilation of the Swedish text was called from?? the master file? or the Swedish tex file itself?
Background: at that point of time I couldn't figure out about project structures. And I drew my flow charts in CorelDraw, hadn't taught myself that, either. :-)
NB. This is a bit simplified example of how things went, the real thing contains more directories and subdirectories, but those are not important to explain my idea.
What I had is a directory structure like this
PR-23 PR-23/swedish PR-23/portuguese PR-23/spanish PR-23/german
It all started with a single-language project, language subdirectories got added over time when translations turned out to be of essence. [PR-23 is the name of the product for which the document is written.]
To illustrate the system with graphics, let's say that the main directory PR-23 contained a flowchart called flow_troubles.pdf and a wiring picture wrg-366.pdf. Wiring drawings are never translated, so every manual version uses the same graphic. On the other hand, the flow chart needs to be translated for every language version. I did that by copying the English original (Corel Draw graphic) into the language folder, then translating, saving and exporting as pdf in that (sub)directory. The result is that both e.g. the subdirectory swedish and the main directory PR-23 would contain a graphic called flow_troubles.pdf, but the one in the subfolder would be in Swedish.
Then, if I needed a Swedish manual, I needed to go into subfolder Swedish and compile the main .tex file there. At the beginning of that file I had the command \setupexternalfigures[directory=../]. When the compilation came to wrg-366.pdf, the graphic could not be found in the same directory, so ConTeXt went one step up as instructed and picked up the wiring drawing there. Later when compilation would get as far to flow_troubles.pdf, ConTeXt would look in the working directory 'swedish', find it there and pick up that one and *stop looking for that graphic*. Ergo, because the Swedish one could be found first, the existence of the English version in the search path is not a problem.
This way I didn't need to change the names of my graphics nor my code. It was also handy when translations arrived in batches; I translated the graphics one by one and could always compile a proper looking document, first with all graphics in English, then some in the target language, finally fully translated - and still, if a new version of the wiring drawing turned up, I only had to update the master directory and then remember to compile the translations to get the changes in.
One more thing to remember is that I really do product manuals and they are always in fluctuation - there's no final version of the manual until the production of that particular model has ceased. Thus years have taught me to avoid duplicate information to utmost, because the more places to update because of a minor change, the more likely it is to forget at least one of them. Been there, done that... [When I switched to ConTeXt, each manual version was a separate MS Word document. To update a wiring drawing, I had to open each version, import the drawing to replace the old one, then save and close. And hope for the best, switching figures in Word wasn't always that straight forward, ConTeXt is definitely more predictable.]
Mari ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 2/4/2013 5:07 PM, Mari Voipio wrote:
This way I didn't need to change the names of my graphics nor my code. It was also handy when translations arrived in batches; I translated the graphics one by one and could always compile a proper looking document, first with all graphics in English, then some in the target language, finally fully translated - and still, if a new version of the wiring drawing turned up, I only had to update the master directory and then remember to compile the translations to get the changes in.
Here's another one handy for manuals: In the preamble or environment: \defineexternalfigure[sizeone][width=5cm] \defineexternalfigure[sizetwo][height=4cm] (these can also inherit: \definexternalfigure[a][b][frame=on]) In the document source: \externalfigure[cow][sizeone] \externalfigure[cow][sizetwo][frame=on] A way to get consistent scaling (probably one of the oldest features .. in mkii it's part of \useexternalfigure but in mkiv this has been split into two commands with a cleaner inheritance model). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
"H. Özoguz"
-
Alain Delmotte
-
Hans Hagen
-
Marco Patzer
-
Mari Voipio