[OS X TeX] Intermingling fonts using Fontspec
Ross Moore
ross at ics.mq.edu.au
Sat Feb 17 18:21:42 EST 2007
Hi Jonathan, and Erik,
On 18/02/2007, at 6:48 AM, Jonathan Kew wrote:
> On 17 Feb 2007, at 7:18 pm, Signups wrote:
>
>> Greetings,
>>
>> I've just figured out the answer to my own question. If I define the
>> command \gk{} as follows,
>>
>> \newcommand{\gk}[1]{\fontspec{Porson}#1\rmfamily}
>>
>> things turn out much better.
>
> I think a better answer is probably:
>
> \newcommand{\gk}[1]{{\fontspec{Porson}#1}}
>
> (Note the extra set of braces.)
>
> Better still, if you're doing this often, I believe you could say:
>
> \newfontfamily{\porson}{Porson}
> \newcommand{\gk}[1]{{\porson #1}}
Even better is to have a robust markup command, as follows:
\newfontfamily{\porson}{Porson}
\DeclareRobustCommand{\grk}[1]{{\porson #1}}
This means that if you use \grk within titles and headings,
then you do not freeze the size and style into the Table of Contents,
or otherwise upset Bookmarks listings.
Similarly for figure & table captions, and any other special features
that you might be using, which require writing information into
auxiliary files.
When such information is re-read for placing onto the PDF page,
you can locally adjust the expansion of \grk to suit the actual
situation.
>
> This saves fontspec having to re-evaluate the font name every time, so
> it is more efficient.
>
> JK
>
Hope this helps,
Ross
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the MacOSX-TeX
mailing list