Thursday, November 17, 2011

More XeLaTeX tips

A few tricks I've learned in XeLaTeX recently:

1. Quotation marks. XLTX sometimes gives the ugly straight quotes, like " and won't play nicely with the usual way of making curly quotes in LaTeX, which uses `` and '' to generate “…”. The trick is to make sure you're including (in this order)

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Charis SIL} 
(or whatever your main font is)

I had the font mapping line after I set the main font and it wouldn't allow me to generate smart quotes.


2. Double-spacing and margin size. The article class is nice, but for rough drafts, it can be difficult for my editors to make comments. I've figured out how to insert double spacing and to make the margins a little smaller. If you enable this package
\usepackage{setspace}
You can insert this line before the body of the document:

\doublespacing
And to change the margins quickly, just insert a different paper size when calling the package "geometry"
\usepackage[a4paper]{geometry} 

3. Sanskrit and text-wrapping. This one I have yet to fix. Sanskrit sentences, even when hyphenation has been inserted for long compounds, have a tendency to hang off the end of the paragraph. I don't want to force hyphenation manually, either. At this point, since my translation is a draft, I'm just living with the ugliness at the margins.