On 2011-11-04, Murat Yildizoglu wrote:

> I am stopping my tentatives to import my beamer documents from pure Latex
> into Lyx. The result is currently really too unreliable to be used without
> a lot of supplementary work. 

The basic problem is, that

* beamer is complex

* LyX's beamer.layout uses special environments/commands to cope with LyX
  limitations (merging of subsequent objects of the same style into one
  LaTeX environment if not separated by the "Environment separator" hack.

> I will have to retype a lot of stuff to get
> them going... I have already shared some strange bibliography problems, and
> one meets a lot of others while importing latex into Lyx. Not very useful
> yet in my humble opinion.

> What does not yet get recognized at all (some of them are very surprising
> to me):
> - Sections, subsections (very strange, no?)

Look at the definition of a section in beamer.layout:

  Style Section
    ...
    LatexName        lyxframeend{}\section

I don't think that any LaTeX sources (except the LyX-generated ones) use
this construct.

> - Some environments (\begin{definition} for example, I do not remember if
> it is a standard theorem environment)

Similar.

> - Itemizes inside other environments

> Not very well imported:
> - arrays, as soon as they have some cosmetics in them (multi-line); they
> really get messed up (and this is a game theory course, so, I have a lot of
> them...).
> - text color instructions (like [rgb]{0,0,0.5}) (not very important,
> but pollutes the text any way)
> - importing frames also poses some problems, so, I replace them now with
> some text instead (like ---Beg-Frame- for \begin{frame} and the like for
> the \end...), and introduce them later in Lyx manually.

This is the main "culprit":

Style BeginFrame
  Category         Frames
  TocLevel         4
  KeepEmpty        1
  LatexType        Command
  LatexName        lyxframeend{}\lyxframe
...
  Preamble
    \long\def\lyxframe#1{\@lyxframe#1\@lyxframestop}%
    \def\@lyxframe{\@ifnextchar<{\@@lyxframe}{\@@lyxframe<*>}}%
    \def\@@lyxframe<#1>{\@ifnextchar[{\@@@lyxframe<#1>}{\@@@lyxframe<#1>[]}}
    
\def\@@@lyxframe<#1>[{\@ifnextchar<{\@@@@@lyxframe<#1>[}{\@@@@lyxframe<#1>[<*>][}}
    
\def\@@@@@lyxframe<#1>[#2]{\@ifnextchar[{\@@@@lyxframe<#1>[#2]}{\@@@@lyxframe<#1>[#2][]}}
    \long\def\@@@@lyxframe<#1>[#2][#3]#4\@lyxframestop#5\lyxframeend{%
      \frame<#1>[#2][#3]{\frametitle{#4}#5}}
  EndPreamble


> These documents were initially written in Scientific Word. I also take care
> of cleaning all comments introduced by SW (I use the regular expression %.*
> to find all comment segments and replace them with space) before trying to
> import.

As you are pre-processing your sources anyway, you could also try to convert
the failing commands/environments to the form used by LyX.

> I really love Lyx, and the inability to import my old courses beamers in
> Lyx is quite regrettable, since I use Lyx for my new documents and would
> like to completely get rid of SW (and of the virtual machine Windows 7 that
> I keep on my Mac solely for it).

My idea for a better beamer support in LyX would be a layout where frames
are represented by custom insets rather than paragraph styles. This would
make the "lyxframe" hack obsolete.

I have implemented the concept for the seminar layout, see
http://www.lyx.org/trac/ticket/7624 

Günter

Reply via email to