Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-13 Thread Justin Wood
(Apologies for the slow reply.) I've tried adding the \AtBeginDocument{} as
you suggest but while the error goes away, the cross ref formatting is not
honoured.

I think I might try to get my head around *refstyle* as this is the way LyX
is moving for cross ref formatting, correct?

On 10 December 2010 18:29, Jürgen Spitzmüller  wrote:

>  Justin Wood wrote:
> > The template files do actually have this embrace, but it doesn't prevent
> > the parsing error.
>
> No. \addto\extrasenglish is not embraced by \AtBeginDocument{}
>
>
> > Or do you mean the next release will do something else
> > that will fix the problem? Thanks Jürgen.
>
> No. Look below.
>
>
> > For completeness, this is the preamble, taken directly from the chapter
> > template:
>
> [...]
>
> >
> > *\addto\extrasenglish{*
>
> >
> > * \renewcommand{\equationautorefname}{\hspace{-\abc}}*
> >
> > * \renewcommand{\sectionautorefname}{sec.\negthinspace}*
> >
> > * \renewcommand{\subsectionautorefname}{sec.\negthinspace}*
> >
> > * \renewcommand{\subsubsectionautorefname}{sec.\negthinspace}*
> >
> > * \renewcommand{\figureautorefname}{Fig.\negthinspace}*
> >
> > * \renewcommand{\tableautorefname}{Tab.\negthinspace}*
> >
> > *}*
> >
>
> change this to
>
> \AtBeginDocument{%
>
> \addto\extrasenglish{
> \renewcommand{\equationautorefname}{\hspace{-\abc}}
> \renewcommand{\sectionautorefname}{sec.\negthinspace}
> \renewcommand{\subsectionautorefname}{sec.\negthinspace}
> \renewcommand{\subsubsectionautorefname}{sec.\negthinspace}
> \renewcommand{\figureautorefname}{Fig.\negthinspace}
> \renewcommand{\tableautorefname}{Tab.\negthinspace}
> }
> }
>
> Jürgen
>


Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-10 Thread Jürgen Spitzmüller
Justin Wood wrote:
> The template files do actually have this embrace, but it doesn't prevent
> the parsing error. 

No. \addto\extrasenglish is not embraced by \AtBeginDocument{}

> Or do you mean the next release will do something else
> that will fix the problem? Thanks Jürgen.

No. Look below.

> For completeness, this is the preamble, taken directly from the chapter
> template:

[...]

> 
> *\addto\extrasenglish{*
> 
> * \renewcommand{\equationautorefname}{\hspace{-\abc}}*
> 
> * \renewcommand{\sectionautorefname}{sec.\negthinspace}*
> 
> * \renewcommand{\subsectionautorefname}{sec.\negthinspace}*
> 
> * \renewcommand{\subsubsectionautorefname}{sec.\negthinspace}*
> 
> * \renewcommand{\figureautorefname}{Fig.\negthinspace}*
> 
> * \renewcommand{\tableautorefname}{Tab.\negthinspace}*
> 
> *}*
> 

change this to

\AtBeginDocument{%
\addto\extrasenglish{
\renewcommand{\equationautorefname}{\hspace{-\abc}}
\renewcommand{\sectionautorefname}{sec.\negthinspace}
\renewcommand{\subsectionautorefname}{sec.\negthinspace}
\renewcommand{\subsubsectionautorefname}{sec.\negthinspace}
\renewcommand{\figureautorefname}{Fig.\negthinspace}
\renewcommand{\tableautorefname}{Tab.\negthinspace}
}
}

Jürgen


Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-10 Thread Guenter Milde
On 2010-12-09, Jürgen Spitzmüller wrote:
> Guenter Milde wrote:

>> I am glad you found the core of the problem.
>> (BTW: the current version of fontspec does no longer load xunicode, but
>> we should care for users with older versions.)

> I have fontspec v2.1e (2010/11/17), which is the most recent version on 
> CTAN. The documentation states:

> "Ross Moore’s xunicode package is now automatically loaded for users of both 
> XELATEX and LuaLATEX."

> So it seems to me that the situation is reverse (unless you use an 
> unreleased pre-release)

Sorry, I mixed it up with xltxtra.

So xunicode is now also usable with LuaLaTeX?

The version at CTAN, 2010/11/06 v0.96, still checks solely for XeTeX.

However, I found in fontspec.dtx:

% Now we load \pkg{xunicode}, working around its internal \XeTeX\ check
% when under \LuaTeX.


Günter



Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-09 Thread Vincent van Ravesteijn
> However, I also found that even if I do not check any of the AMS math
> options, LyX 2 behaves as if the "Load AMS math automatically" option
> were set:
>
> a) the "AMS symbols" toolbox is enabled.
> b) inserting a symbol from it inserts \usepackage{amssymb} in the preamble.
> c) even writing \Rrightarrow in a math box (converts this to the symbol and)
>   inserts \usepackage{amssymb} in the preamble.
>
> Because of c), a work-around with disabling AMS math in the checkbox and
> loading in the LaTeX preamble will fail.


Note there is (correctly or not) a difference between amsmath and
amssymb. The Document->Settings->Math Options can only prevent using
\usepackages{amsmath}. amssymb is always loaded automatically or
loaded when you choose "use amsmath".

This is the same as in 1.6.x.

Vincent


Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-09 Thread Justin Wood
On 10 December 2010 12:37,  wrote:

> >
> > The reason for this is that XeTeX now uses polyglossia, which does not
> > know these \addto commands (which are from babel). Are these templates
> > shipped with LyX? If so, we need to embrace these calls in
> >
> > \...@ifpackageloaded{babel}{%
> > ...
> > }{}
>
> This problem should be fixed in the next release. The trick is to embrace
> these calls in
>
> \AtBeginDocument{%
> ...
> }
>
> so that they are executed after polyglossia (and babel).
>
> Jürgen
>

The template files do actually have this embrace, but it doesn't prevent the
parsing error. Or do you mean the next release will do something else that
will fix the problem? Thanks Jürgen.

For completeness, this is the preamble, taken directly from the chapter
template:


 % increase link area for cross-references and autoname them

*\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1*

*\newlength{\abc}*

*\settowidth{\abc}{\space}*

*\addto\extrasenglish{*

* \renewcommand{\equationautorefname}{\hspace{-\abc}}*

* \renewcommand{\sectionautorefname}{sec.\negthinspace}*

* \renewcommand{\subsectionautorefname}{sec.\negthinspace}*

* \renewcommand{\subsubsectionautorefname}{sec.\negthinspace}*

* \renewcommand{\figureautorefname}{Fig.\negthinspace}*

* \renewcommand{\tableautorefname}{Tab.\negthinspace}*

*}*

% in case somebody want to have the label "Gleichung"

%\renewcommand{\eqref}[1]{Gleichung~(\negthinspace\autoref{#1})}

% put the link to figure floats to the beginning

% of the figure and not to its end

\usepackage[figure]{hypcap}

% the pages of the TOC is numbered roman

% and a pdf-bookmark for the TOC is added

\let\myTOC\tableofcontents

\renewcommand\tableofcontents{%

\frontmatter

\pdfbookmark[1]{\contentsname}{}

\myTOC

\mainmatter }

% make caption labels bold

\setkomafont{captionlabel}{\bfseries}

\setcapindent{1em}

% enable calculations

\usepackage{calc}

% fancy page header/footer settings

\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}

\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

% increase the bottom float placement fraction

\renewcommand{\bottomfraction}{0.5}

% avoid that floats are placed above its sections

\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}


Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-09 Thread Justin Wood
On 10 December 2010 12:37,  wrote:

> > 2. conflict in thesis template
> > Beyond that, changing to the automatic AMS math package in the thesis
> > document introduces new errors. In a brand new, entirely unmodified
> > chapter template file, XeTeX compilation now complains about the use of '
> > \addto \extrasenglish{' in the preamble (used to define cross reference
> > identifiers). Is this another conflict between XeTeX and ... is it
> > *hyperref * these overrides refer to?
>
> The reason for this is that XeTeX now uses polyglossia, which does not know
> these \addto commands (which are from babel). Are these templates shipped
> with LyX? If so, we need to embrace these calls in
>
> \...@ifpackageloaded{babel}{%
> ...
> }{}
>

Yes, these are the thesis set of template files that ship with LyX 2.0.

I tried adding this to the chapter template preamble. The error is removed,
but it seems to be because the commands are not processed — the cross ref
labels are not applied.


>
> > 3. custom character-style error
> > Finally, and this is more an annoyance than an impediment, my custom
> > character style module (based on info from Rob
> > Oakes character-styles
> >)
> > generates an *Undefined flex inset *error: 'Flex inset
> TechnicalDefinition
> > is undefined because of class conversion from article to article' (and
> the
> > same occurs in scrbook). This only seems to get thrown if I save a change
> > made within Document Settings, not on view, etc. Is there something in my
> > module that might cause this?
> >
> > #\DeclareLyXModule{thesis styles}
>
> There has been some syntax change. And if I remember well, it is difficult
> to handle self-defined modules. But I'm not sure. Richard can tell you
> more.
>
>
Is there documentation on the correct syntax? I've not been able to find
that until now.

Thanks again. [Sorry for accidentally posting to you twice, Jürgen]

 Jürgen
>
> > Thanks!
>


Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-09 Thread Jürgen Spitzmüller
Guenter Milde wrote:

> I am glad you found the core of the problem.
> (BTW: the current version of fontspec does no longer load xunicode, but
> we should care for users with older versions.)

I have fontspec v2.1e (2010/11/17), which is the most recent version on 
CTAN. The documentation states:

"Ross Moore’s xunicode package is now automatically loaded for users of both 
XELATEX and LuaLATEX."

So it seems to me that the situation is reverse (unless you use an 
unreleased pre-release)

Jürgen



Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-08 Thread Guenter Milde
On 2010-12-08, Jürgen Spitzmüller wrote:
> Jürgen Spitzmüller wrote:

>> Justin Wood wrote:
>>> 1. conflict with AMS package
>>> I've found that simply activating XeTeX under *Document Settings –
>>> Fonts*will cause parsing errors on viewing if the document also has
>>> *Math Options – Use AMS math package* checked; eg, LaTeX Error: Command
>>> `\Finv' already defined, etc. I think this is a known conflict between
>>> XeTeX and the AMS package, is that right? By changing the setting to *Use
>>> AMS math package automatically* though, these particular errors go away.
>>> Note that this occurs in the generic default new document (*article*
>>> class) as well as the *KOMA-script book *class that the thesis uses.

>> Yes, I've seen this too. Not sure what to do. We could disable "AMS
>> always" for XeTeX, if necessary, but I guess we need to do some more
>> research yet.

Please never disable "AMS always" but not "AMS automatically": this would
lead to errors as soon as an AMS-requiring construct is put into the
document.

> This should be fixed as well in the next release. The trick is to load all 
> AMS packages before fontspec (which itself loads xunicode, which has to be 
> loaded after the AMS packages). See
> http://www.macfreek.nl/mindmaster/LaTeX_package_conflicts#Amssymb_with_Xunicode

I am glad you found the core of the problem.
(BTW: the current version of fontspec does no longer load xunicode, but
we should care for users with older versions.)

Testing here with a pre-beta-2 SVN version,

  LyX 2.0.0svn (not released yet)
  Built on Nov 26 2010, 14:31:19

I get

%% LyX 2.0.0svn created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[british]{article}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}
\begin{document}
Hallo $\Rrightarrow$.
\end{document}

which compiles fine.

However, I also found that even if I do not check any of the AMS math
options, LyX 2 behaves as if the "Load AMS math automatically" option
were set:

a) the "AMS symbols" toolbox is enabled.
b) inserting a symbol from it inserts \usepackage{amssymb} in the preamble.
c) even writing \Rrightarrow in a math box (converts this to the symbol and)
   inserts \usepackage{amssymb} in the preamble.
   
Because of c), a work-around with disabling AMS math in the checkbox and
loading in the LaTeX preamble will fail.

Günter

   
 

Günter



Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-08 Thread Jürgen Spitzmüller
Jürgen Spitzmüller wrote:

> Justin Wood wrote:
>> 1. conflict with AMS package
>> I've found that simply activating XeTeX under *Document Settings –
>> Fonts*will cause parsing errors on viewing if the document also has
>> *Math Options – Use AMS math package* checked; eg, LaTeX Error: Command
>> `\Finv' already defined, etc. I think this is a known conflict between
>> XeTeX and the AMS package, is that right? By changing the setting to *Use
>> AMS math package automatically* though, these particular errors go away.
>> Note that this occurs in the generic default new document (*article*
>> class) as well as the *KOMA-script book *class that the thesis uses.
> 
> Yes, I've seen this too. Not sure what to do. We could disable "AMS
> always" for XeTeX, if necessary, but I guess we need to do some more
> research yet.

This should be fixed as well in the next release. The trick is to load all 
AMS packages before fontspec (which itself loads xunicode, which has to be 
loaded after the AMS packages). See
http://www.macfreek.nl/mindmaster/LaTeX_package_conflicts#Amssymb_with_Xunicode

Jürgen



Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-08 Thread Jürgen Spitzmüller
Jürgen Spitzmüller wrote:

>> 2. conflict in thesis template
>> Beyond that, changing to the automatic AMS math package in the thesis
>> document introduces new errors. In a brand new, entirely unmodified
>> chapter template file, XeTeX compilation now complains about the use of '
>> \addto \extrasenglish{' in the preamble (used to define cross reference
>> identifiers). Is this another conflict between XeTeX and ... is it
>> *hyperref * these overrides refer to?
> 
> The reason for this is that XeTeX now uses polyglossia, which does not
> know these \addto commands (which are from babel). Are these templates
> shipped with LyX? If so, we need to embrace these calls in
> 
> \...@ifpackageloaded{babel}{%
> ...
> }{}

This problem should be fixed in the next release. The trick is to embrace 
these calls in

\AtBeginDocument{%
...
}

so that they are executed after polyglossia (and babel).

Jürgen



Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-08 Thread Richard Heck

On 12/08/2010 05:58 AM, Jürgen Spitzmüller wrote:

Justin Wood wrote:
   

1. conflict with AMS package
I've found that simply activating XeTeX under *Document Settings –
Fonts*will cause parsing errors on viewing if the document also has
*Math Options – Use AMS math package* checked; eg, LaTeX Error: Command
`\Finv' already defined, etc. I think this is a known conflict between
XeTeX and the AMS package, is that right? By changing the setting to *Use
AMS math package automatically* though, these particular errors go away.
Note that this occurs in the generic default new document (*article*
class) as well as the *KOMA-script book *class that the thesis uses.
 

Yes, I've seen this too. Not sure what to do. We could disable "AMS always"
for XeTeX, if necessary, but I guess we need to do some more research yet.

   

2. conflict in thesis template
Beyond that, changing to the automatic AMS math package in the thesis
document introduces new errors. In a brand new, entirely unmodified
chapter template file, XeTeX compilation now complains about the use of '
\addto \extrasenglish{' in the preamble (used to define cross reference
identifiers). Is this another conflict between XeTeX and ... is it
*hyperref * these overrides refer to?
 

The reason for this is that XeTeX now uses polyglossia, which does not know
these \addto commands (which are from babel). Are these templates shipped
with LyX? If so, we need to embrace these calls in

\...@ifpackageloaded{babel}{%
...
}{}

   

3. custom character-style error
Finally, and this is more an annoyance than an impediment, my custom
character style module generates an *Undefined flex inset *error: 'Flex inset 
TechnicalDefinition
is undefined because of class conversion from article to article' (and the
same occurs in scrbook). This only seems to get thrown if I save a change
made within Document Settings, not on view, etc. Is there something in my
module that might cause this?

#\DeclareLyXModule{thesis styles}
#DescriptionBegin
#Adds character styles for PhD thesis
#DescriptionEnd

InsetLayoutCharStyle:TechnicalDefinition
 LyxType   charstyle
 LabelString   techdefn
 LatexType command
 LatexName techdefn
 Font
 Family  Sans
 EndFont
 Preamble
 \newcommand*{\techdefn}[1]{{\sffamily{\mdseries #1}}}
 EndPreamble
End
 

There has been some syntax change. And if I remember well, it is difficult
to handle self-defined modules. But I'm not sure. Richard can tell you more.

   
I think this bug was in beta1 and has since been fixed. I know I spent 
some time looking at it. If it is still in beta2, please let me know.


Richard



Re: LyX 2.0: problems using XeTeX and thesis template

2010-12-08 Thread Jürgen Spitzmüller
Justin Wood wrote:
> 1. conflict with AMS package
> I've found that simply activating XeTeX under *Document Settings –
> Fonts*will cause parsing errors on viewing if the document also has
> *Math Options – Use AMS math package* checked; eg, LaTeX Error: Command
> `\Finv' already defined, etc. I think this is a known conflict between
> XeTeX and the AMS package, is that right? By changing the setting to *Use
> AMS math package automatically* though, these particular errors go away.
> Note that this occurs in the generic default new document (*article*
> class) as well as the *KOMA-script book *class that the thesis uses.

Yes, I've seen this too. Not sure what to do. We could disable "AMS always" 
for XeTeX, if necessary, but I guess we need to do some more research yet.

> 2. conflict in thesis template
> Beyond that, changing to the automatic AMS math package in the thesis
> document introduces new errors. In a brand new, entirely unmodified
> chapter template file, XeTeX compilation now complains about the use of '
> \addto \extrasenglish{' in the preamble (used to define cross reference
> identifiers). Is this another conflict between XeTeX and ... is it
> *hyperref * these overrides refer to?

The reason for this is that XeTeX now uses polyglossia, which does not know 
these \addto commands (which are from babel). Are these templates shipped 
with LyX? If so, we need to embrace these calls in

\...@ifpackageloaded{babel}{%
...
}{}

> 3. custom character-style error
> Finally, and this is more an annoyance than an impediment, my custom
> character style module (based on info from Rob
> Oakes)
> generates an *Undefined flex inset *error: 'Flex inset TechnicalDefinition
> is undefined because of class conversion from article to article' (and the
> same occurs in scrbook). This only seems to get thrown if I save a change
> made within Document Settings, not on view, etc. Is there something in my
> module that might cause this?
> 
> #\DeclareLyXModule{thesis styles}
> #DescriptionBegin
> #Adds character styles for PhD thesis
> #DescriptionEnd
> 
> InsetLayoutCharStyle:TechnicalDefinition
> LyxType   charstyle
> LabelString   techdefn
> LatexType command
> LatexName techdefn
> Font
> Family  Sans
> EndFont
> Preamble
> \newcommand*{\techdefn}[1]{{\sffamily{\mdseries #1}}}
> EndPreamble
> End

There has been some syntax change. And if I remember well, it is difficult 
to handle self-defined modules. But I'm not sure. Richard can tell you more.

Jürgen

> Thanks!




LyX 2.0: problems using XeTeX and thesis template

2010-12-07 Thread Justin Wood
Hi all. I'm gingerly trying to switch over to LyX 2.0 (beta 1   2) and to
start using XeTeX so I can more easily access additional fonts. I'm writing
a thesis using the included thesis templates. Actually my current work uses
the template set sent out on these lists earlier in 2010, so I created brand
new sample files from the new 2.0 version to test the problems I'm about to
describe.


1. conflict with AMS package
I've found that simply activating XeTeX under *Document Settings –
Fonts*will cause parsing errors on viewing if the document also has
*Math Options – Use AMS math package* checked; eg, LaTeX Error: Command
`\Finv' already defined, etc. I think this is a known conflict between XeTeX
and the AMS package, is that right? By changing the setting to *Use AMS math
package automatically* though, these particular errors go away. Note that
this occurs in the generic default new document (*article* class) as well as
the *KOMA-script book *class that the thesis uses.

So for a 'simple' document — which has the automatic AMS math package option
checked by default anyway — this seems to fix the problem. But is that a
reasonable thing to do, or is the thesis template not initially configured
to use the auto version for good reason?

2. conflict in thesis template
Beyond that, changing to the automatic AMS math package in the thesis
document introduces new errors. In a brand new, entirely unmodified chapter
template file, XeTeX compilation now complains about the use of ' \addto
\extrasenglish{' in the preamble (used to define cross reference
identifiers). Is this another conflict between XeTeX and ... is it *hyperref
* these overrides refer to?

Would this be the appropriate moment to switch to using *refstyle* for
customised cross referencing? And is doing so a case of going and reading
that packages documentation? I can't find much in the LyX help files beyond
the fact that the option exists. One of the benefits of the hyperref
approach is not having to switch each cross ref instance to the *Formatted
reference* type...

3. custom character-style error
Finally, and this is more an annoyance than an impediment, my custom
character style module (based on info from Rob
Oakes)
generates an *Undefined flex inset *error: 'Flex inset TechnicalDefinition
is undefined because of class conversion from article to article' (and the
same occurs in scrbook). This only seems to get thrown if I save a change
made within Document Settings, not on view, etc. Is there something in my
module that might cause this?

#\DeclareLyXModule{thesis styles}
#DescriptionBegin
#Adds character styles for PhD thesis
#DescriptionEnd

InsetLayoutCharStyle:TechnicalDefinition
LyxType   charstyle
LabelString   techdefn
LatexType command
LatexName techdefn
Font
Family  Sans
EndFont
Preamble
\newcommand*{\techdefn}[1]{{\sffamily{\mdseries #1}}}
EndPreamble
End


Thanks!