Hello,

I use to make Xfig figures with Special flagged text quite often.
I mostly write english documets, but sometimes I need to make a
figure that includes non-english text -- namely the Czech.  A
block scheme is such an example (see the attachments).

I used a trick with TeX macros for typesetting accented
characters for a long time, but creating the figures in such a
way requires so much effort -- you need to rerun LaTeX several
times while editting the figure to get the final result. So I
decided to localize Xfig and put the figure (with non-latin1
characters) right into the LyX document in regular way. But there
were some problems that arised during this process. I finaly
found the solution so I'm gonna to describe what I did. Hope this
helps any one.

It's clear that you don't need to use TeX macros for accented
characters any more or do another fiddling around. You just
switch the keyboard layout and write the text directly into the
figure.

NOTE: I've tried this for Czech (iso8859-2) text only, so I hope
      it should work also for other alphabets. 

1) Localize Xfig

   Common instructions for Xfig localization can be found at

     http://member.nifty.ne.jp/tsato/xfig/latin/latin-e.html
   
   For example if you have transfig-3.2.3d-7 you need to nuthin'
   at all. You just make a symlink in your FIG2DEV_LIBDIR
   directory (usually in /usr/share/fig2dev/)
   
     czech.ps -> cs_CZ.ps
   
   If there's no cs_CZ.ps file in that directory get the file
   czech.ps from the above site and put it into your
   FIG2DEV_LIBDIR directory.

   Set the locale to appropriate language
   
     export LANG=czech
     
   and run Xfig. You would be able to enter non-latin1 characters
   right from the keyboard.

2) Change the LyX template

   Add the -j option to the fig2dev command in the
   /usr/share/lyx/scripts/fig2pstex.py script so it will look
   like this 
   
     os.execvp("fig2dev", ["fig2dev", "-j", "-Lpstex"] +
     parameters + [filename, basename + ".eps"])

     os.execvp("fig2dev", ["fig2dev", "-j", "-Lpstex_t"] +
     parameters + [filename, basename + ".pstex_t"])

   Insert the figure to the LyX document via standard template:
   Insert > External Material... > Xfig and enjoy the result!


ADDITIONAL NOTES (and suggestions for the developpers):

In fact there's no need to change the LyX tempalte. You can
export the figure manually by Combined PS/LaTeX (both parts) and
include the *.pstex_t part into the LyX document via Insert >
Include File. Needless to say that inserting the *.fig file via
Insert > External Material > Xfig is much more comfortable since
Transfig creates both parts automatically.

So the secret that the non-latin1 characters appear right in the
typeset document lies in the missing -j option in fig2dev command
which provides the conversion from FIG format to another
languages. The -j option is always set when the figure is
exported manually from Xfig, so that's the reason why it works
with inclusion of *.pstex_t.

In fact I haven't found what the option -j does. There's no
description in fig2dev man page. But it's clear that it really
works with -j so I suggest to add this option to the future
releases of LyX, namely in fig2pstex script. Moreover it doesn't
affect the behaviour of the template at all.

Regards,

   KAMIL ;-{

Attachment: xfig-czech.pdf
Description: Adobe PDF document

Reply via email to