On Sat, Oct 19, 2013 at 7:23 AM, Enrico Forestieri <for...@lyx.org> wrote:
> On Sat, Oct 19, 2013 at 04:56:21AM -0400, Scott Kostyshak wrote:
>
>> To reproduce,
>>
>> 1. Open examples/he/splash.lyx
>> 2. In Document > Settings > Fonts, check the box "Use non-TeX fonts"
>> and change the three fonts to FreeSans (or any other font that
>> supports Hebrew).
>> 3. Click OK.
>> 4. Try to export with XeTeX. It fails.
>> 5. Now go to Document > Settings > Document Class and change "Hebrew
>> Article" to "Article (Standard Class)".
>> 6. XeTeX export compiles fine for me.
>>
>> The heb-article layout adds the following to the preamble:
>>
>>         \usepackage{theorem}
>>         \theorembodyfont{\upshape}
>>         \newtheorem{theorem}{\R{משפט}}[section]
>>         \AtBeginDocument{\make@lr\thetheorem}
>>
>> XeTeX gives the following error:
>> ! Undefined control sequence.
>>
>> \@begindocumenthook ...aybe_setup_maths: \make@lr
>>
>> Are the \newtheorem command (this is the only place in layout files I
>> see the \R command) and the \AtBeginDocument command correctly
>> written? Is a protect missing?
>
> I think that polyglossia is used by default and \make@lr is only defined
> by babel, maybe. Try adding the following snippet to the preamble:
>
> \@ifundefined{make@lr}
> {\def\make@lr#1{\begingroup
>     \toks@=\expandafter{#1}%
>     \edef\x{\endgroup
>   \def\noexpand#1{\noexpand\@number{\the\toks@}}}%
>   \x}}{\relax}

This works well. Unless someone objects, I will commit the attached
patch after beta2.

Thanks, Enrico.

Scott
From 0d887172c326fe6269c3165565b24fdd632c2cf9 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Sat, 19 Oct 2013 13:35:49 -0400
Subject: [PATCH] Fix XeTeX export when using heb-article.layout

polyglossia is used by default and \make@lr is only defined
by babel. Modifying the preamble fixes XeTeX export and pdfTeX
continues to work.

See the following thread for more information:
  http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg181220.html

Thanks to Enrico for the patch.
---
 lib/layouts/heb-article.layout | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/layouts/heb-article.layout b/lib/layouts/heb-article.layout
index aa1da0d..98528c4 100644
--- a/lib/layouts/heb-article.layout
+++ b/lib/layouts/heb-article.layout
@@ -13,6 +13,13 @@ Preamble
        \theorembodyfont{\upshape}
        \newtheorem{theorem}{\R{משפט}}[section]
        \AtBeginDocument{\make@lr\thetheorem}
+
+       \@ifundefined{make@lr}
+       {\def\make@lr#1{\begingroup
+           \toks@=\expandafter{#1}%
+           \edef\x{\endgroup
+         \def\noexpand#1{\noexpand\@number{\the\toks@}}}%
+         \x}}{\relax}
 EndPreamble
 
 
-- 
1.8.1.2

Reply via email to