On 09/25/2018 04:08 PM, Paul Johnson wrote:
This seems like my LyX day to ask questions. Thanks for your help.
We have some instructional web pages that have accompanying Beamer
slides. It is a hassle to edit the web page and the Beamer slides,
content goes out of sync.
The idea hit me to write one document that can be exported as Beamer
Slides or as a Beamer Article. I've explored the details quite a bit
and the process almost works smoothly. My preamble for slides has a
lot of customized settings and LyX does not gracefully convert from
Beamer slides to Beamer article as a result. I manually insert some
code... I need the \mode<> statements to adjust for the output format.
I control input for each format with \mode<presentation>{} and
\mode<article>{}. I find the back-and-forth transition mostly works.
However, there is one piece of conditional code where I need your
help. A Beamer slide document is declared like so
\documentclass[english]{beamer}
Because beamer is the class, then "\mode" is immediately available.
However, the Beamer article is declared as an article:
\documentclass[english]{article}
Because the \mode macro is not available yet, I am not able to
conditionalize setup statements for the article. I want to take the
"BeamerArticle" preamble code and wrap inside \mode:
\mode<article>{
\makeatletter
% Textclass specific LaTeX commands.
\usepackage{beamerarticle,pgf}
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
\AtBeginDocument{
\let\origtableofcontents=\tableofcontents
\def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
\def\gobbletableofcontents#1{\origtableofcontents}
}
\makeatother
}
That fails, pdflatex error:
\mode<presentation>{
The control sequence at the end of the top line of your error message
was never \def'ed.
Well, that should happen. "\mode" is an unrecognized symbol in the
article document. I can't have any \mode<presentation> or
\mode<article> settings until "\usepackage{beamerarticle}" package is
loaded.
I need to write a conditional statement like "if this document is not
a Beamer slide document, then include the following code" to fix the
problem. That's where I'm stuck at the current time.
pj
Have you tried using the other Beamer article layout (listed in the
document settings as "Beamer Article (KOMA-script)", using the
scrarticle-beamer.layout layout file? I just tried it, and \mode seems
to be defined.
Paul Rubin