| View previous topic :: View next topic |
| Author |
Message |
meyerm Veteran


Joined: 27 Jun 2002 Posts: 1311 Location: Munich / Germany
|
Posted: Fri Mar 30, 2012 8:16 am Post subject: including files in LaTeX depending on environment |
|
|
Hi,
how can I include files in LaTeX depending on the used environment to build the document? I'd like to include a different file when the document is being built with pdflatex than when it is built with latex. The background: I am writing on a document with other people and while most of use use pdflatex, some prefer the tex->dvi->ps->pdf way of compiling. pdflatex can create nicer PDFs including some PDF-features that PS simply does not offer (links f.ex.). So, how can I now include nice looking PDF- and PNG-graphics when the document is compiled with pdflatex and fall back to exported EPS when the traditional approach is used? Most of my graphics are created with inkscape and the pdf_tex or in the future then the eps_tex export feature.
Thank you
M |
|
| Back to top |
|
 |
juniper l33t


Joined: 22 Oct 2004 Posts: 756 Location: EU
|
Posted: Fri Mar 30, 2012 11:05 am Post subject: Re: including files in LaTeX depending on environment |
|
|
| meyerm wrote: | Hi,
how can I include files in LaTeX depending on the used environment to build the document? I'd like to include a different file when the document is being built with pdflatex than when it is built with latex. The background: I am writing on a document with other people and while most of use use pdflatex, some prefer the tex->dvi->ps->pdf way of compiling. pdflatex can create nicer PDFs including some PDF-features that PS simply does not offer (links f.ex.). So, how can I now include nice looking PDF- and PNG-graphics when the document is compiled with pdflatex and fall back to exported EPS when the traditional approach is used? Most of my graphics are created with inkscape and the pdf_tex or in the future then the eps_tex export feature.
Thank you
M |
if you use includegraphics and don't put a file extension on the included picture, doesn't latex automatically look for a eps file while pdflatex automatically looks for a pdf file? only works if the only two options are eps and pdf. |
|
| Back to top |
|
 |
disi Veteran


Joined: 28 Nov 2003 Posts: 1351 Location: Out There ...
|
Posted: Fri Mar 30, 2012 12:47 pm Post subject: |
|
|
Maybe \newcommand?
\newcommand{\mygraphic}[1]{{\includegraphic{#1.eps}}}
or
\newcommand{\mygraphic}[1]{{\includegraphic{#1.png}}}
or
\newcommand{\mygraphic}[1]{{\includegraphic{#1.pdf}}}
in the document use:
\mygraphic{peng}
Put that in a style file and all you need to do is to change the .sty file at the top of the document to load different graphics?
p.s. not tested  _________________ Gentoo on Uptime Project - Larry is a cow |
|
| Back to top |
|
 |
meyerm Veteran


Joined: 27 Jun 2002 Posts: 1311 Location: Munich / Germany
|
Posted: Sat Mar 31, 2012 5:58 pm Post subject: Re: including files in LaTeX depending on environment |
|
|
Thank you for your suggestions!
| juniper wrote: | | if you use includegraphics and don't put a file extension on the included picture, doesn't latex automatically look for a eps file while pdflatex automatically looks for a pdf file? only works if the only two options are eps and pdf. |
You already mentioned the problem with that . Other files won't work. Otherwise it would be a good idea to do it like you said. |
|
| Back to top |
|
 |
meyerm Veteran


Joined: 27 Jun 2002 Posts: 1311 Location: Munich / Germany
|
Posted: Sat Mar 31, 2012 6:01 pm Post subject: |
|
|
Thank you, too.
| disi wrote: | | Put that in a style file and all you need to do is to change the .sty file at the top of the document to load different graphics? |
While this could work, I cannot ask the people to always change the included style (or any other command in the file) whenever they want to build the file they checked out of the repository. I even thought about misusing a Makefile for that by setting a symlink, but that will surely lead to a lot of problems. At least when people build the document without the Makefile. |
|
| Back to top |
|
 |
|