LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-27-2005, 07:02 AM   #1
mat_uk111
Member
 
Registered: Oct 2004
Posts: 128

Rep: Reputation: 15
LaTeX and Xfig


I have a diagram which I drew in Xfig which I included latex maths in, I want to include it in my latex doc, I am not too sure how to go about it. I read the manual and it says that xfig should produce a .pstex and a .pstex_t file but all I get is an eps and a text doc with file extension _t.

Following the manual I put \input{psfig} and that throws up errors, what am I doing wrong, do I need to download anything more?

Regards

Mat
 
Old 01-27-2005, 08:37 AM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,394

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
I haven't done this for a bit (but this is a good review for me because I've got another extensive documentation session coming up soon :-) ) but here's what I've done to incorporate an EPS file into a LaTeX document:
Code:
\usepackage{dvips}[graphics,color]
\usepackage{boxedminipage}

.
.
.

\begin{figure}
\begin{boxedminipage}{\textwidth}
\begin{center}
\includegraphics{xyz_overview.ps}
\end{center}
\caption{\label{fig:xyz_overview}Overview of the XYZ Process.}
\end{boxedminipage}
\end{figure}
I'm not sure if this will work for your Xfig drawings -- I use gviz for most of my diagrams -- but it ought to get you started.

Hope this helps a bit...
 
Old 01-27-2005, 09:26 AM   #3
mat_uk111
Member
 
Registered: Oct 2004
Posts: 128

Original Poster
Rep: Reputation: 15
The only reason why I use Xfig is that you can add latex commands in the text and LaTeX will format them in LaTeX fonts, so I could add some equations to a drawing and I just do the appropriate LaTeX and hey presto out pops the equations, all nicely typeset.

Mat
 
Old 01-27-2005, 08:56 PM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,394

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
Yep. Sounds like what I'd use LaTeX for. I imagine that the EPS file you get out of that tool will be usable in the markup snippet I showed (or one like it). I'll make no judgements about Xfig versus graphviz (sorry I abbreviated it last time). I've only dabbled a little bit with Xfig and that was some time ago; it was probably pre-v1.0. I find that graphviz works well enough for my needs (documenting processes) and the files that define the figure are easy to stash in an RCS library for version control along with the documents.

Hope you get this working. Post back here if it doesn't and I'll see if I spot anything.
 
Old 01-27-2005, 10:34 PM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,394

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
Heh...

My example won't work as I stuttered with the shift key. Those "usepackage" statements ought to read:
Code:
\usepackage[dvips]{graphics,color}
\usepackage[boxedminipage]
(Braces aren't the same as brackets and vice versa. :-) )

Anyway, I created a silly Xfig file and exported it as "Combined PS/LaTeX" giving me "two-boxes.ps" and "two-boxes.ps_t". You can get this figure into your LaTeX document two ways:

1.) Use your editor's "include text/file" command to pull the "_t" file directly into your document. This will work fine if you only have a figure or two but gets real ugly, real fast if you have lot's of figures or you change one of them appreciably (perhaps any change will screw things up, dunno).

2.) Rename the "_t" file to have a ".tex" suffix. In my case, I'd issue:
Code:
mv two-boxes.ps_t two-boxes.ps_t.tex
Now you can use the TeX/LaTeX "\include{}" statement to pull the file into your document:
Code:
\include{two-boxes.ps_t}
Note that you do not specify the ".tex" suffix! If you do, LaTeX's error message will show you your error quite nicely.
Code:
No file two-boxes.ps_t.tex.tex.
If you look at the "_t" file generated by Xfig, you'll notice that it contains an "\includegraphics{}" statement that drags in the PostScript file with your drawing.

Careful, though. One thing I discovered is that if you are working on a large document and you break it up into a master file and separate the major sections or chapters as "include" files, you won't be able to use the "\include{}" statements in the chapter files you are including into the master. LaTeX won't let you nest "\includes{}"; a file brought in using "\include{}" can contain an "\includegraphics{}" but not another "\include{}" (Someone really ought to fix that. It be easier to drag in boilerplate text.)

Try this out and post your results. Good luck...
 
Old 01-28-2005, 01:55 AM   #6
mat_uk111
Member
 
Registered: Oct 2004
Posts: 128

Original Poster
Rep: Reputation: 15
I went and did as the manual asked me and I got to the point where it couldn't find the diagram that I wanted to insert, so I am told that Linux doesn't look at the file extensions, is this also the case for LaTeX though?

I will have a little look at graphviz, can you add equations to your picture like Xfig claims?

Mat
 
Old 01-30-2005, 10:21 PM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,394

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
As good as I think graphviz is, it will come up short, I suspect, for what you want to do. It's strength is in drawing graphs (No, not X-Y plots but graphs. There's a difference.) It does not allow you to add equations in the output. Actually, that's not strictly true. There is a way to include graphics files that can be used to represent nodes on your graph. I suppose there's no reason why that included graphics file couldn't contain equations but it would be extremely clunky to do it that way. Especially when TeX's equations are just so beautifully typeset.

I'm not quite sure I understood what trouble you encountered with the file extensions. It is true that Linux does not make any distinction about how to handle a file based on it file extension; it uses what are called "magic numbers" to decide what to do with a particular file. (BTW, there's a good article in this month's Linux Magazine -- print edition only AFAICT -- regarding magic numbers in case you want to read about it.) That said, there are applications that assume certain file extensions for certain type of files. For LaTeX, included files are assumed to have a ".tex" at the end of the file name. In fact, it also assumes that you know this and will not specify it in the name of the file. Of course, it's not consistent as an "\includegraphics{}" does expect the file extension to be specified. (At least that's my experience with PS and EPS files that I've pulled into LaTeX documents.)

Can you post the "\include{}" statement you're trying to use and the error message that you are seeing? And, just out of curiousity, what manual are you referring to?
 
Old 01-30-2005, 10:49 PM   #8
ehawk
Senior Member
 
Registered: Jul 2003
Posts: 1,257

Rep: Reputation: 48
Lyx

Lyx is a graphical front end for LaTeX. If you do a few minutes of reading the instructions and looking at the pulldown menus, inserting eps files (or other formats) is not a problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LaTeX forum / Where to ask LaTeX questions? max_sipos Linux - Software 2 12-21-2011 12:01 PM
Xfig Lixz Linux - Software 1 07-29-2005 08:09 PM
LaTeX commands: texi2pdf, latex, dvipdf kaon Linux - Software 7 01-23-2005 03:32 PM
Installing xfig une Linux - Software 2 07-11-2004 02:54 AM
Xfig and MDK9.2 kvtournh Mandriva 0 11-20-2003 03:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration