12.04.2015 Views

Using Imported Graphics in LaTeX and pdfLaTeX - Mirror

Using Imported Graphics in LaTeX and pdfLaTeX - Mirror

Using Imported Graphics in LaTeX and pdfLaTeX - Mirror

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

setenv TEXINPUTS :/dir1:/dir2<br />

causes /dir1 <strong>and</strong> /dir2 to be searched after the default directories, while<br />

setenv TEXINPUTS /dir1::/dir2<br />

causes /dir1 to be searched before the default directories <strong>and</strong> /dir2 to be searched<br />

after the default directories.<br />

Putt<strong>in</strong>g // after a directory causes all of its subdirectories to be searched. For<br />

example,<br />

setenv TEXINPUTS /dir1//:/dir2:<br />

causes all the subdirectories (<strong>and</strong> sub-subdirectories) of /dir1 to be searched. Be<br />

careful <strong>in</strong> us<strong>in</strong>g // as it may slow down the search<strong>in</strong>g if the directory conta<strong>in</strong>s many<br />

files.<br />

These examples also work for sh shells, although the syntax should be changed to<br />

TEXINPUTS="/dir1:/dir2:"; export TEXINPUTS<br />

When L A TEX f<strong>in</strong>ds files on the TEX path, it does not <strong>in</strong>clude the entire filename <strong>in</strong><br />

the dvi file. As a result, old versions of dvips or xdvi which do not search the TEX<br />

path cannot f<strong>in</strong>d the file (see Section 14.4 on Page 44).<br />

13.2 Temporarily Chang<strong>in</strong>g the TEX Search Path<br />

This section describes how a Unix shell script can temporarily change the TEX Search<br />

Path <strong>in</strong> order to f<strong>in</strong>d project-specific graphics files. Users can then construct a separate<br />

shell script for each of their projects, with each script specify<strong>in</strong>g the directories<br />

that are unique to those projects.<br />

For example, suppose a user is writ<strong>in</strong>g a journal paper <strong>and</strong> wants to create a<br />

unix shell script latex paper that replaces the latex comm<strong>and</strong>. Create a file named<br />

latex paper on the Unix search path conta<strong>in</strong><strong>in</strong>g<br />

#!/b<strong>in</strong>/sh<br />

TEXINPUTS= ~/PAPER/SUB1/:~/PAPER/SUB2/:$TEXINPUTS latex $@<br />

Make the file executable with<br />

chmod u+x latex_paper<br />

Once this is done, typ<strong>in</strong>g<br />

latex_paper file.tex<br />

adds ~/PAPER/SUB1/:~/PAPER/SUB2/ to the beg<strong>in</strong>n<strong>in</strong>g of TEXINPUTS before latex<br />

file.tex is run, allow<strong>in</strong>g L A TEX to f<strong>in</strong>d any graphics stored <strong>in</strong> the ~/PAPER/SUB1/<br />

or ~/PAPER/SUB2/ subdirectories.<br />

A similar script called dvips paper would also need to be written <strong>in</strong> order for<br />

dvips to f<strong>in</strong>d the graphics dur<strong>in</strong>g dvi-to-ps conversion.<br />

13.3 <strong>Graphics</strong> Search Path<br />

By default, L A TEX looks for graphics files <strong>in</strong> any directory on the TEX search path.<br />

In addition to these directories, L A TEX also looks <strong>in</strong> any directories specified <strong>in</strong> the<br />

\graphicspath comm<strong>and</strong>. For example,<br />

\graphicspath{{dir1/}{dir2/}}<br />

tells L A TEX to also look for graphics files <strong>in</strong> dir1/ <strong>and</strong> dir2/. For Mac<strong>in</strong>tosh, this<br />

becomes<br />

\graphicspath{{dir1:}{dir2:}}<br />

40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!