On 11/09/2010 04:54 AM, Daron Wilson wrote:
Walter,

I'm actually fairly new to Lyx, so I'm still finding my way a bit.  However, I 
came to LyX with a tad more LaTeX and XeTeX experience.  I've messed about a 
bit with XeTeX for Hebrew, Polytonic Greek, and Thai, and found that to be very 
helpful

I would recommend trying out LyX 2.0 Alpha 6.  I'm using it on OSX 10.6, and 
I've had no trouble so far, though I cannot speak for the Linux version.

The reason I've switched to LyX 2.0 is that it has XeTeX functionality built in.  In the document 
settings window there is a radio button for XeTeX, which makes LyX  default to XeTex as it's 
processing engine (the tool bar "eyeballs" and menu item "view PDF (XeTeX)" now 
work automatically as expected also). This has been working quite smoothly for me.

I'm not sure what your experience is with XeTeX/fontspec/TeX  markup, so I'll 
just include my own basic solution and if you have more questions about how to 
hack it for your own use I can try and answer them. As I mentioned, I'm still 
pretty new to the whole thing myself though, so hopefully some of the pros will 
chime in and help me out if I'm heading in the wrong direction, at least on the 
LyX implementation.

Regardless of whether you stick with LyX 1.6 or go with 2.0, the stuff below 
should work as long as you can get LyX to use XeTeX somehow, whether 
conveniently (2.0) or otherwise(1.6).

I've attached a module that sets up character insets for different languages.  
I like this approach because it allows me to use any system fonts I have in the 
output, and to tweak the typeset appearance of each language individually--e.g. 
my own favorite font for Hebrew, different favorite for Thai, scale the Greek 
font up, but scale the Chinese down, etc.

For where to put the module, and how to get Lyx to recognize it, check out the "Layout 
Modules" section in the help document "Customizing LyX". (at least that is where it 
is in the 2.0 documentation)

If you can get the module to be recognized in LyX, then all you need to do is 
include it in your document settings.  You should be able find the new character 
style insets in the Edit--->Text Style menu.   Just click the desired language 
style and input the unicode characters into the new inset box.

In order to typeset the insets correctly, you will also have to add the 
material I've included below to your document preamble.  The only thing you 
should have to change in your preamble is the font names, to whatever fonts you 
have available on your system (see the fontspec documentation for more info on 
setting up fonts).   I've attached a screenshot of a sample document in LyX, as 
well as the corresponding PDF output from XeTeX.

This is nice work, Daron, and an excellent example of how to use modules and character styles to extend LyX's functionality. The only thing I'll add is that this last thing you said, about adding things to the preamble, isn't actually necessary, since you can include the preamble information in the module itself, using the Preamble tag. E.g.:

InsetLayout Thai
    LyxType            charstyle
    MultiPar        1
    Custom Pars        1
    LabelString        Thai
    LatexType        command
    LatexName        thai
    Preamble
        %: --------- thai font
        \newfontfamily{\TH}[Scale=1.2]{Ayuthaya}
        \newcommand{\thai}[1]{{\TH #1}}
    EndPreamble
End

Richard

Reply via email to