Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
including files in LaTeX depending on environment
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
meyerm
Veteran
Veteran


Joined: 27 Jun 2002
Posts: 1311
Location: Munich / Germany

PostPosted: Fri Mar 30, 2012 8:16 am    Post subject: including files in LaTeX depending on environment Reply with quote

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
View user's profile Send private message
juniper
l33t
l33t


Joined: 22 Oct 2004
Posts: 756
Location: EU

PostPosted: Fri Mar 30, 2012 11:05 am    Post subject: Re: including files in LaTeX depending on environment Reply with quote

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
View user's profile Send private message
disi
Veteran
Veteran


Joined: 28 Nov 2003
Posts: 1351
Location: Out There ...

PostPosted: Fri Mar 30, 2012 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
meyerm
Veteran
Veteran


Joined: 27 Jun 2002
Posts: 1311
Location: Munich / Germany

PostPosted: Sat Mar 31, 2012 5:58 pm    Post subject: Re: including files in LaTeX depending on environment Reply with quote

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
View user's profile Send private message
meyerm
Veteran
Veteran


Joined: 27 Jun 2002
Posts: 1311
Location: Munich / Germany

PostPosted: Sat Mar 31, 2012 6:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum