Support for beamer \frametitle

The \frametitle command is less convenient to use than the \frame argument, but it provides more options (overlay/action and short title). We thus provide this additionally to the option, like beamer itself does.
This commit is contained in:
Juergen Spitzmueller 2012-12-22 16:28:43 +01:00
parent a8b81312b3
commit 483b99193f
5 changed files with 96 additions and 3 deletions

View File

@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2012-12-22 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 455: Support for beamer \frametitle
\frametitle<overlay>[short]{title} > begin_layout FrameTitle
2012-12-19 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 454:
Real support for beamer overprint environment. This environment has a

View File

@ -554,6 +554,36 @@ Style EndFrame
EndPreamble
End
Style FrameTitle
Category Frames
Margin Static
LatexType Command
LatexName frametitle
ParSkip 0.4
ItemSep 0
TopSep 0
BottomSep 1
ParSep 1
Align Center
LabelType No_Label
Font
Series Bold
Color Blue
Size Largest
EndFont
Argument 1
LabelString "On Slide"
MenuString "Overlay Specifications|S"
Tooltip "Specify the overlay settings (see beamer manual)"
LeftDelim <
RightDelim >
EndArgument
Argument 2
LabelString "Short Frame Title|S"
Tooltip "A short form of the frame title used in some themes"
EndArgument
End
Style FrameSubtitle
Category Frames
Margin Static

View File

@ -2843,6 +2843,61 @@ def revert_overprint(document):
i = endseq
def revert_frametitle(document):
" Reverts beamer frametitle layout to ERT "
beamer_classes = ["beamer", "article-beamer", "scrarticle-beamer"]
if document.textclass not in beamer_classes:
return
rx = re.compile(r'^\\begin_inset Argument (\S+)$')
i = 0
while True:
i = find_token(document.body, "\\begin_layout FrameTitle", i)
if i == -1:
return
j = find_end_of_layout(document.body, i)
if j == -1:
document.warning("Malformed lyx document: Can't find end of FrameTitle layout")
i = i + 1
continue
endlay = j
document.body[j : j] = put_cmd_in_ert("}") + document.body[j : j]
endlay += len(put_cmd_in_ert("}"))
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\frametitle")
for p in range(i, j):
if p >= endlay:
break
m = rx.match(document.body[p])
if m:
argnr = m.group(1)
if argnr == "1":
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", p)
endPlain = find_end_of_layout(document.body, beginPlain)
endInset = find_end_of_inset(document.body, p)
content = document.body[beginPlain + 1 : endPlain]
# Adjust range end
endlay = endlay - len(document.body[p : endInset + 1])
# Remove arg inset
del document.body[p : endInset + 1]
subst += put_cmd_in_ert("<") + content + put_cmd_in_ert(">")
elif argnr == "2":
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", p)
endPlain = find_end_of_layout(document.body, beginPlain)
endInset = find_end_of_inset(document.body, p)
content = document.body[beginPlain + 1 : endPlain]
# Adjust range end
endlay = endlay - len(document.body[p : endInset + 1])
# Remove arg inset
del document.body[p : endInset + 1]
subst += put_cmd_in_ert("[") + content + put_cmd_in_ert("]")
subst += put_cmd_in_ert("{")
document.body[i : i + 1] = subst
i = endlay
##
# Conversion hub
#
@ -2889,10 +2944,12 @@ convert = [
[451, [convert_beamerargs, convert_againframe_args, convert_corollary_args, convert_quote_args]],
[452, [convert_beamerblocks]],
[453, [convert_use_stmaryrd]],
[454, [convert_overprint]]
[454, [convert_overprint]],
[455, []]
]
revert = [
[454, [revert_frametitle]],
[453, [revert_overprint]],
[452, [revert_use_stmaryrd]],
[451, [revert_beamerblocks]],

View File

@ -94,6 +94,8 @@ Format LaTeX feature LyX feature
\begin{overprint}[maxlength]
\onslide<slide> text ...
\end{overprint}
455 beamer frametitle command \begin_layout FrameTitle
\frametitle<overlay>[short}{long}
General

View File

@ -30,8 +30,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 454 // spitz: support for beamer overprint
#define LYX_FORMAT_TEX2LYX 454 // spitz: support for beamer overprint
#define LYX_FORMAT_LYX 455 // spitz: support for beamer FrameTitle layout
#define LYX_FORMAT_TEX2LYX 455 // spitz: support for beamer FrameTitle layout
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER