Hi there, I'm pretty new to ConTeXt and stumbled upon a problem when trying to use Xfig: I'm trying to create figures with xfig and including them in my ConTeXt document. I would export them as PDF, but unfortunately I have TeX math inside the figure and I'd like to have native fonts. I used to use a combinded LaTeX/PDF export in the past with LaTeX. Is there any practical solution to this? Regards, Florian.
On 01/06/2011 01:21 PM, Florian Unglaub wrote:
Hi there,
I'm pretty new to ConTeXt and stumbled upon a problem when trying to use Xfig:
I'm trying to create figures with xfig and including them in my ConTeXt document. I would export them as PDF, but unfortunately I have TeX math inside the figure and I'd like to have native fonts. I used to use a combinded LaTeX/PDF export in the past with LaTeX.
Is there any practical solution to this?
It's been ages since I last used xfig, and I no longer know how to get math into a figure. Can you post an example input file?
Hello, Ultimately, you will probably be more satisfied using Metapost graphics "natively" within ConTeXt. With xfig, you can export to Metapost. This code can probably be directly used by ConTexT, or perhaps with minor modifications. As Taco wrote, if you post an example (file.fig), someone can help show how it can be used within ConTeXt. There is no wiki page concerning xfig under http://wiki.contextgarden.net/Graphics Maybe I can use this posting to create one... Alan On Friday 07 January 2011 08:11:14 Taco Hoekwater wrote:
On 01/06/2011 01:21 PM, Florian Unglaub wrote:
Hi there,
I'm pretty new to ConTeXt and stumbled upon a problem when trying to use Xfig:
I'm trying to create figures with xfig and including them in my ConTeXt document. I would export them as PDF, but unfortunately I have TeX math inside the figure and I'd like to have native fonts. I used to use a combinded LaTeX/PDF export in the past with LaTeX.
Is there any practical solution to this?
It's been ages since I last used xfig, and I no longer know how to get math into a figure. Can you post an example input file? ___________________________________________________________________________ ________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________ ________
On 01/07/2011 10:07 AM, Alan BRASLAU wrote:
Hello,
Ultimately, you will probably be more satisfied using Metapost graphics "natively" within ConTeXt. With xfig, you can export to Metapost. This code can probably be directly used by ConTexT, or perhaps with minor modifications.
I did a quick test, and the transfig mp code starts with this nice (!) block of verbatimtex: % +MP-ADDITIONAL-HEADER verbatimtex %&latex \documentclass{article} \begin{document} etex % -MP-ADDITIONAL-HEADER %SetFigFont macros for latex verbatimtex % \begingroup\makeatletter\ifx\SetFigFont\undefined% \gdef\SetFigFont#1#2#3#4#5{% \reset@font\fontsize{#1}{#2pt}% \fontfamily{#3}\fontseries{#4}\fontshape{#5}% \selectfont}% \fi\endgroup% \ifx\SetFigFontSize\undefined% \gdef\SetFigFontSize#1#2{% \fontsize{#1}{#2pt}% \selectfont}% \fi% etex It looks configurable-ish, but I do not feel like experimenting without a proper test case. Best wishes, Taco
On Fri, Jan 07, 2011 at 10:09:47AM +0100, Taco Hoekwater wrote:
I did a quick test, and the transfig mp code starts with this nice (!) block of verbatimtex:
% +MP-ADDITIONAL-HEADER verbatimtex %&latex \documentclass{article} \begin{document} etex % -MP-ADDITIONAL-HEADER
[...]
It looks configurable-ish, but I do not feel like experimenting without a proper test case.
I tried exporting to metapost inside xfig aswell yesterday, leading to
similar results as posted above.
I found out that XFig uses a small shell script called 'fig2dev' to do
all the exporting to other formats. This script supports an option '-o'
to use plain TeX.
I tried \input'ing the resulting .mp file into my ConTeXt-file:
\startuseMPgraphic{foo}
\input ../figures/bar.fig
\stopuseMPgraphic
\placefigure[here][fig:foo]{A small test}{
\useMPgraphic{foo}
}
This, however, doesn't work and shows the figure as 'undefined' in the
PDF.
My current solution now is to convert the XFig file to MetaPost with
fig2dev and use mptopdf.
Regards, Florian.
PS: Sorry for the duplicate message, Taco. I forgot to CC to the list.
--
Florian Unglaub
Florian, This is not exactly how to proceed. The metapost export needs to be stripped of its preamble before being used with ConTeXt. Can you send us a (simple) concrete example, i.e. .fig file. It may not be worth the effort to get fig2dev fixed to produce pure (LaTeX free) metapost. I had started learning Metapost playing with xfig exports, but quickly entirely dropped xfig and now work directly with metapost code. Alan On Friday 07 January 2011 16:39:45 Florian Unglaub wrote:
On Fri, Jan 07, 2011 at 10:09:47AM +0100, Taco Hoekwater wrote:
I did a quick test, and the transfig mp code starts with this nice (!) block of verbatimtex:
% +MP-ADDITIONAL-HEADER verbatimtex %&latex \documentclass{article} \begin{document} etex % -MP-ADDITIONAL-HEADER
[...]
It looks configurable-ish, but I do not feel like experimenting without a proper test case.
I tried exporting to metapost inside xfig aswell yesterday, leading to similar results as posted above.
I found out that XFig uses a small shell script called 'fig2dev' to do all the exporting to other formats. This script supports an option '-o' to use plain TeX.
I tried \input'ing the resulting .mp file into my ConTeXt-file:
\startuseMPgraphic{foo} \input ../figures/bar.fig \stopuseMPgraphic
\placefigure[here][fig:foo]{A small test}{ \useMPgraphic{foo} }
This, however, doesn't work and shows the figure as 'undefined' in the PDF.
My current solution now is to convert the XFig file to MetaPost with fig2dev and use mptopdf.
Regards, Florian.
PS: Sorry for the duplicate message, Taco. I forgot to CC to the list.
-- Alan Braslau CEA DSM-IRAMIS-SPEC CNRS URA 2464 Orme des Merisiers 91191 Gif-sur-Yvette cedex FRANCE tel: +33 1 69 08 73 15 fax: +33 1 69 08 87 86 mailto:alan.braslau@cea.fr .''`. : :' : `. `'` `-
participants (3)
-
Alan BRASLAU
-
Florian Unglaub
-
Taco Hoekwater