Seite 1 von 1

Beamer Class: Frames, Framebreaks und Longtables

Verfasst: Mi 22. Mai 2013, 23:11
von likelihood
Hi zusammen,

ich möchte gerne in einer Präsentation der Beamer Class für einen Frame ein Framebreak erzwingen, damit die darin befindliche Longtable automatisch auf einem nächsten Frame fortgeführt wird.

Das Minimalbeispiel ist wie folgt:
\documentclass[9pt]{beamer}

\mode<presentation>

\usepackage{scrextend}

\usepackage{graphicx}

\usepackage{amsmath}

\usepackage{tabularx}

\usepackage{longtable}
\usepackage[labelformat=empty,justification=centering,singlelinecheck=off]{caption}

\usepackage[none]{hyphenat}
\sloppy

\makeatletter

\newsavebox{\mybox}\newsavebox{\mysim}

\newcommand{
	\distas}[1]{\mathbin{\overset{#1}{\kern\z@\sim}}
}

\newcommand{\distras}[1]{
  \savebox{\mybox}{\hbox{\kern3pt$\scriptstyle#1$\kern3pt}}
  \savebox{\mysim}{\hbox{$\sim$}}
  
  \mathbin{\overset{#1}{\kern\z@\resizebox{\wd\mybox}{\ht\mysim}{$\sim$}}}
}

\newcommand{
	\superscript}[1]{\ensuremath{^{\textrm{#1}}}
}

\newcommand{
	\subscript}[1]{\ensuremath{_{\textrm{#1}}}
}

\newcommand{\who}[1]{
	\widehat{\rule{0pt}{1.6ex}#1}
}

\makeatother

\renewcommand{\footnoterule}{\rule{0pt}{0pt}}

\title{}

\subtitle{}

\author{}

\institute{}

\date{\today}

\begin{document}

\begin{frame}[t,allowframebreaks]

\tiny

\center

\frametitle{Descriptive Statistics (2/2)}

\hypertarget<1>{Table0_end}{}

\setlength{\LTpost}{0pt}

\begin{longtable}{lccccc}

\hline
Variables									&	Mean					&	Standard Deviation		&	Minimum					&	Maximum					&			Observations																											\\
\hline
\endfirsthead
\multicolumn{6}{c}{\textit{Continued from previous page}}				\\
\hline
Variables									&	Mean					&	Standard Deviation		&	Minimum					&	Maximum					&			Observations																											\\
\hline
\endhead
\multicolumn{6}{c}{\textit{Continued on next page}}						\\
\endfoot
\endlastfoot
\multicolumn{6}{c}{}													\\
\textit{Dependent Variables}				&	\multicolumn{5}{c}{}	\\
Satisfaction With Life						&	7.03					&	1.68					&	0						&	10						&	110,301					\\
Vitality									&	50.61					&	9.08					&	26.82					&	70.60					&	24,078					\\
Social Functioning							&	50.66					&	9.12					&	14.69					&	57.12					&	24,078					\\
Role-Emotional Functioning					&	50.85					&	8.95					&	13.34					&	58.08					&	24,078					\\
Mental Health in General					&	49.64					&	9.44					&	19.73					&	68.58					&	24,078					\\
Mental Health Summary Scale					&	50.14					&	9.28					&	4.19					&	79.43					&	24,078					\\
\multicolumn{6}{c}{}													\\
\textit{Independent Variables of Interest}	&	\multicolumn{5}{c}{}	\\
test1								&	0.05					&	0.22					&	0						&	1						&	110,301					\\
test2								&	0.00					&	0.07					&	0						&	1						&	110,301					\\
test3								&	0.17					&	0.37					&	0						&	1						&	110,301					\\
test4									&	0.29					&	0.46					&	0						&	1						&	110,301					\\
\multicolumn{6}{c}{}													\\
\textit{Other Independent Variables}		&	\multicolumn{5}{c}{}	\\
Age											&	44.84					&	9.31					&	17						&	88						&	110,301					\\
Is Female									&	0.46					&	0.50					&	0						&	1						&	110,301					\\
Is Married									&	0.86					&	0.35					&	0						&	1						&	110,301					\\
Is in Relationship							&	0.07					&	0.25					&	0						&	1						&	110,301					\\
Number of Close Friends						&	4.16					&	1.20					&	0						&	50						&	110,301					\\
Is Healthy									&	0.67					&	0.47					&	0						&	1						&	110,301					\\
Is Religious								&	0.05					&	0.22					&	0						&	1						&	110,301					\\
Years of Education							&	11.93					&	2.69					&	7						&	18						&	110,301					\\
Has Secondary School Degree					&	0.62					&	0.49					&	0						&	1						&	110,301					\\
Has University Degree						&	0.21					&	0.41					&	0						&	1						&	110,301					\\
Is Blue-Collar Worker						&	0.38					&	0.48					&	0						&	1						&	110,301					\\
Is White-Collar Worker						&	0.44					&	0.50					&	0						&	1						&	110,301					\\
Is Civil Servant							&	0.07					&	0.26					&	0						&	1						&	110,301					\\
Is Self-Employed							&	0.07					&	0.25					&	0						&	1						&	110,301					\\
Works Half-Time								&	0.19					&	0.39					&	0						&	1						&	110,301					\\
Works Full-Time								&	0.75					&	0.43					&	0						&	1						&	110,301					\\
Is Unemployed								&	0.01					&	0.10					&	0						&	1						&	110,301					\\
Net Individual Income\superscript{a}		&	1415.04					&	1102.57					&	0						&	80,000					&	110,301					\\
Net Household Income\superscript{a}			&	2663.94					&	1592.01					&	0						&	85,000					&	110,301					\\
Number of Individuals\superscript{c}		&	3.34					&	1.21					&	1						&	14						&	110,301					\\
\hline
\hline
\multicolumn{6}{l}{\scalebox{.8}{\superscript{a} Monthly in Euro/Inflation-Adjusted (Base Year 2000), \superscript{c} In Household}}											\\

\end{longtable}

\begin{flushleft}

\begin{tabularx}{\linewidth}{lX}

\textit{Note:}		&	All figures are rounded to two decimal places.	\\
\textit{Source:}	&	SOEP 1984-2010, own calculations				\\

\end{tabularx}

\end{flushleft}

\hyperlink{Table0_beginning}{\beamergotobutton{Back}}

\end{frame}

\end{document}

Der Framebreak funktioniert - allerdings wird die Tabellenunterschrift im Flushleft unnötigerweise auf ein weiteres Frame gepackt, wobei auf dem vorherigen Frame noch genügend Platz gewesen wäre.

Weiß jemand von euch, woran das liegt?

Viele Grüße aus Berlin,

Chris

Verfasst: Do 23. Mai 2013, 00:43
von Johannes_B
Dein Minimalbeispiel ist nicht minimal.
Deine "Beschriftung" gehört nicht zur Tabelle, damit meinst du doch den Teil mit Note und Source? Pack das einfach mit in die longtable.

Warum eine longtable in einer Präsentation? Ich habe zwar nicht gelesen, was in deiner steht, aber im Allgemeinen ist das Quatsch. Wer soll denn das alles Lesen?

EDIT: Tippfehler korrigiert

Workaround

Verfasst: Do 23. Mai 2013, 16:07
von likelihood
Vielen Dank fuer den Tipp mit dem Workaround (die Bildunterschrift unter die Longtable packen).

Weisst du trotzdem, warum so komisch gebrochen wird, wenn ich dem Workaround nicht nachgehen wuerde?

Ich wuerde das gerne verstehen.

Verfasst: Do 23. Mai 2013, 17:24
von Johannes_B
\documentclass{beamer}

\usepackage{longtable}
\usepackage{tabularx}

\begin{document}

\begin{frame}[allowframebreaks]{Titel}
  \begin{longtable}{cc}
    Eins & Zwei \\
  \end{longtable}
  \begin{tabularx}{\linewidth}{lX}
    Eins & Zwei \\
  \end{tabularx}
\end{frame}
\end{document}
Du siehst, beide vertragen sich scheinbar nicht. Ich habe noch nie mit einem der beiden Pakete gearbeitet, kann deshalb jetzt auch nicht sagen, warum das so ist oder sein könnte.

Vielleicht hat ja einer der erfahrenen Nutzer eine Idee.