Open GoogleCodeExporter opened 9 years ago
Hi Chris,
I also use Metapost graphics for my dissertation, and it would be a very handy
additional feature to include support. I believe that it may only be necessary
to change the Makefile for BUILD-STRATEGY := latex.
When I compile my Metapost source files, the output file gets a .mps extension.
Interestingly, these .mps files are useful because they can be called
(omitting the extension) whether the document is processed with LaTeX or
pdfLaTex.
From this TUGboat article on Metapost
(http://www.tug.org/TUGboat/Articles/tb30-2/tb95hoeppner.pdf):
"...the PostScript subset created by METAPOST can be interpreted by pdfTeX. So
METAPOST figures can be directly included with e. g. the standard graphics
package, while normal EPS images have to be converted first to be usable with
pdfLaTeX."
When running Makefile (2.2.0) on a document that contains calls to .mps files,
there is different behavior for pdfLaTeX and for regular LaTeX.
For BUILD-STRATEGY := pdflatex, things work great, and the pdf is built as it
should be with the included graphic. No problems!
For BUILD-STRATEGY := latex, the result is "no rule to make target foo...",
although there is a workaround: if one changes the name of the graphic file
from foo.mps to foo.eps, then the compilation will proceed as it should.
When using BUILD-STRATEGY := latex, I once tried to workaround by setting
includes.eps := foo.mps in Variables.ini, but still got the "no rule to make..."
I hope this info helps! Thanks again very much for sharing continuing to
develop your Makefile.
Sincerely,
Chas
Original comment by charles....@gmail.com
on 8 Aug 2011 at 10:38
If I understand correctly, there is nothing to be done for
BUILD_STRATEGY=pdflatex, right?
So, for strategy "latex", we have the following issue:
- The .mps files are built correctly,
- The makefile is properly inserting dependencies on "foo", but
- Doesn't know how to build foo.eps from foo.mps, so
- It fails, even though it should work.
Correct?
Can you try adding the following (use tabs, not spaces) to your Makefile.ini
and let me know how it works?
%.eps: %.mps
$(CP) '$<' '$@'
Original comment by shiblon
on 9 Aug 2011 at 4:38
Thanks for the follow-up! I now realize that I omitted the important fact that
in my last post, I was assuming that the .mps (Metapost postscript output)
files had already been created manually from the .mp (Metapost source) files
using the command 'mpost foo.mp'. That's how I generally do it, but I realize
now that the original poster might have wanted the makefile to ascertain that
foo.mp was a Metapost source, and then call 'mpost foo.mp' to create a .mps
file which would then be included in the LaTeX file.
For now, I'll continue assuming that the .mps files are already created when
make is invoked. So, for strategy = "pdflatex", if the file foo.mps already
exists, a statement such as \includegraphics{foo} works properly, and the
document is built with the graphic.
For strategy = "latex" I added the new rule from your last comment to my
Makefile.ini, but still received the message:
= my_latex.tex --> my_latex.d my_latex.dvi.1st.make (0-1) =
make: *** No rule to make target `foo', needed by `my_latex.d'. Stop.
Interestingly, if I first issued the command 'make foo.eps', then the correct
copy command was invoked, creating 'foo.eps', then I could issue a subsequent
make command and the document would be built correctly.
But, if I only issued 'make', without first issuing 'make foo.eps,' then I got
'no rule to make target.' It seems that make was not figuring out that a
statement such as \includegraphics{foo} could ultimately depend on a .mps
file... so maybe the correct dependencies are not made after all?
I've attached a file 'foo.mps' in case it might be helpful.
Thanks again!
Original comment by charles....@gmail.com
on 10 Aug 2011 at 5:29
Attachments:
Aha. I see what I did wrong. I forgot to tell you to add this at the top of
your Targets.ini file:
graphic_source_extensions += mps
Original comment by shiblon
on 10 Aug 2011 at 1:42
OK, that worked! Now, make with strategy "latex" can recognize an
already-existing Metapost postscript .mps file, copy that into a .eps file, and
then build the document properly with the .eps file.
Original comment by charles....@gmail.com
on 10 Aug 2011 at 5:20
All right. That's a good step forward. Let's keep track of that as working by
summarizing what we did here, then we can discuss what comes next.
===========================
What we did:
===========================
Add to Targets.ini the following lines:
graphic_source_extensions += mps
%.eps: %.mps
$(CP) '$<' '$@'
=================
What's next
=================
Next we need to make sure that both build strategies (latex and pdflatex) can
detect when a .mps file needs to be generated from a .mp file, and we need to
create a .mp -> .mps build rule that can do it.
The last step is the easiest (again with tabs, not spaces):
%.mps: %.mp
mpost $<
Of course, we'll do a lot more than that, since it's going to generate a lot of
output and we'll want to catch errors, etc. It will probably be set up in its
own definition, and will call mpost and then run sed on the output to catch
issues. That's pretty straightforward.
The not-so-straightforward stuff comes in detection. Since we're just doing
includegraphics on it, I *think* the need will be detected correctly, but I'm
not sure.
============================
What would help
============================
If someone could attach a minimal tarball containing a .tex source file and
some .mp files that it tries to include, I can work on getting this up and
running. Shouldn't take too long, but real logs made from real source are
invaluable to the process. I just don't particularly feel like learning
metapost to generate my own .mp files at the moment. :-)
Original comment by shiblon
on 10 Aug 2011 at 5:32
[deleted comment]
OK, here is a very simple, one-page latex document that includes two Metapost
graphics. So, initially, one would need to run mpost first on the two Metapost
source files, then compile the latex file -- that is, until the Makefile does
it all automatically :)
Thanks much!
Original comment by charles....@gmail.com
on 10 Aug 2011 at 7:26
Attachments:
[deleted comment]
Here is a minimal example where the problems occur:
\documentclass{scrreprt}
\usepackage{feynmp}
\DeclareGraphicsRule{*}{mps}{*}{}
\begin{document}
\begin{fmffile}{feyntest}
\begin{fmfgraph*}(100,60)
\fmfleft{a}
\fmfright{b}
\fmf{fermion,label={test}}{a,b}
\end{fmfgraph*}
\end{fmffile}
\end{document}
I use make; then need to call mpost feyntest.mp to create the graphics file.
Then I run make again which works but further invocations fail because the
Makefile tries to make a pdf file from the created graphics:
make: *** No rule to make target `feyntest.1.pdf', needed by `test.pdf'. Stop.
To circument this as a temporary bugfix I removed the get-graphics call:
- $(call get-graphics,$*) >> $*.d; \
Original comment by tobias.n...@gmail.com
on 16 Aug 2011 at 8:51
Hey, tobias - sorry for disappearing for a while. Unfortunately, your minimal
example is a little too minimal for little old me :). What is feynmp, and
where can I get feyntest.mp to fiddle with it?
Original comment by shiblon
on 6 Sep 2011 at 8:17
tobias - never mind. I see that you're generating feyntest.mp from within the
.tex. I'm still not sure about the feynmp package, though
Original comment by shiblon
on 6 Sep 2011 at 8:18
This is the feynmf package:
http://www.ctan.org/tex-archive/macros/latex/contrib/feynmf or if you have a
debian basted distro use the package feynmf.
Original comment by tobias.n...@gmail.com
on 6 Sep 2011 at 9:01
Thanks, tobias.
Meanwhile, I think I have initial, basic support for mp files included via
\includegraphics. Please see attached.
Original comment by shiblon
on 6 Sep 2011 at 9:16
Attachments:
Original issue reported on code.google.com by
tobias.n...@gmail.com
on 26 Jul 2011 at 7:44