Custom command for begin-frame with package beamerarticle
I would definitely advise against creating a custom command to wrap the frame in. In the long run this causes much more trouble then it solves.
Furthermore it will not cure the underlying problem, as your [H]
floating specifier just does give tex any other options then to produce this ugly page break. A few other possibilities:
use other floating specifier, such as
[tbph]
which allows the image to be at the top of a page (I would take this option)or force all the text on the previous page with
\clearpage
%\documentclass[ignorenonframetext]{beamer}
\documentclass[12pt,titlepage,a4paper,fleqn]{article}
\usepackage{beamerarticle}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{tikz}
\mode<article>
{
\usepackage{fancyhdr}
\setbeamertemplate{frametitle}{}
% Seitenränder definieren
\geometry{a4paper, top=28mm, left=20mm, right=20mm, bottom=40mm, headsep=14mm, footskip=12mm}
}
\begin{document}
\pagestyle{fancy}
\lipsum
\begin{frame}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\draw (0,0) -- (10,10);
\end{tikzpicture}
\end{figure}
\end{frame}
\lipsum
\clearpage
\begin{frame}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\draw (0,0) -- (10,10);
\end{tikzpicture}
\end{figure}
\end{frame}
\lipsum
\newpage
\lipsum
\begin{frame}{Test Frame Title}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\draw (0,0) -- (10,10);
\end{tikzpicture}
\end{figure}
\end{frame}
\lipsum
\begin{frame}{Test Frame Title}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\draw (0,0) -- (10,10);
\end{tikzpicture}
\end{figure}
\end{frame}
\lipsum
\end{document}
Related videos on Youtube
freakinpenguin
Updated on March 17, 2020Comments
-
freakinpenguin over 3 years
I want to use one latex-document for an article and beamer-frames. For this I'm using the beamer-article-package.
I noticed that the titles of the beamer-frames are also shown in the article and I don't want this. I search the internet and found a way to modify the beamer-template (in article-mode). Nevertheless, this sometimes disturbs my document-structure in combination with the hyperref package.
So I thought the easiest way would be to use a custom command to define my frame content, but unfortunately this doesn't work as expected, because no frames are created with my custom commands (I also tried it with \newenvironment, but got the same results).
So the question is: What is the problem with my own command to enclose a the begin- and end-frame-command?
Example-Code which produces only one output-frame:
% Comment lines below and uncomment this for beamer \documentclass[ignorenonframetext]{beamer} % Comment above and uncomment below for article %\documentclass[12pt,titlepage,a4paper,fleqn]{article} %\usepackage{beamerarticle} \mode<presentation> { \newcommand{\MBF}[1]{\begin{frame}{#1}} \newcommand{\MEF}{\end{frame}} } \mode<article> { \newcommand{\MBF}[1]{} \newcommand{\MEF}{} % You can use this to hide the title, but this disturbs the layout sometimes. %\setbeamertemplate{frametitle}{} } \begin{document} \begin{frame}{Testframe 1} First test page \end{frame} \MBF{Testframe 2} Second test page \MEF \end{document}
**EDIT: **
As request an example of the broken layout.
Source:
\paragraph{Das Kamerakoordinatensystem} Zusätzlich zu dem Objekt- und Weltkoordinatensystem existiert das Kamerakoordinatensystem. Das Kamerakoordinatensystem beschreibt eine Kamera im Weltkoordinatensystem. \\ Theoretisch könnte das Kamerakoordinatensystem ersetzt werden, indem man alle Geometrien im Weltkoordinatensystem entsprechend transformiert. Aus Gründen der Einfachheit ist es allerdings empfehlenswert ein Kamerakoordinatensystem zu verwenden. \begin{frame}{Das Kamerakoordinatensystem} \begin{figure}[H] \centering \includegraphics[width=0.8\textwidth]{Images/MathematicalBasics/Koordinatensysteme/Kamerakoordinatensystem} \caption{Das Kamerakoordinatensystem} \label{img:mathbasics:kamerakoordinatensystem} \end{figure} \end{frame}
Edit 2:
As requested the source code for creating the layout-problem-result: http://pastebin.com/8hgcBfGK
-
samcarter_is_at_topanswers.xyz over 6 yearsBad idea! This will likely cause more problems then it solves. Instead you can just redefine the frametitle in article mode.
-
samcarter_is_at_topanswers.xyz over 6 yearsCan you instead show an example where the empty frametitle template disturbs the layout?
-
freakinpenguin over 6 yearsSure! See my edit.
-
samcarter_is_at_topanswers.xyz over 6 yearsThanks for posting the code. Can you make something compilable that reproduces your problem? I tried to add random text of many different lengths, but I did not manage to create this page break. Maybe a other floating options might help, for example
[htbp]
, but this is just a guess. -
freakinpenguin over 6 yearsYes, you can get the code via the added link in the question. When I compile here I get the effect between page three and four.
-
samcarter_is_at_topanswers.xyz over 6 yearsThanks! The this ugly pagebreak also happens if there is no frametitle given, so I think
\setbeamertemplate{frametitle}{}
can safely be used. What would help are other floating options, for example allow the figure to be on top of the page with[t]
. Or if you don't want text to float before your figure, you can add a\clearpage
after the\lipsum
.
-
-
freakinpenguin over 6 yearsAny other idea? Because I actually want to have the figures directly below my text. And I don't want to have a page break before every figure (that would happen when using \clearpage, right?).
-
samcarter_is_at_topanswers.xyz over 6 years@ThomasSpranger The other idea is to have floating figures.
-
freakinpenguin over 6 yearsSorry if I get this wrong, but when you mean floating, then the figures won't be next to the places where I define them (!= H modifier). But this is exactly what I want!
-
samcarter_is_at_topanswers.xyz over 6 years@ThomasSpranger But then you have to have the empty space on the bottom of the previous page, as a) there is not enough room for the image and b) no other text can be there. This means either using
\clearpage
or another floating barrier. -
freakinpenguin over 6 yearsI'm aware of that, but my problem is that the last line of the text is put on the next page (with the figure)!
-
samcarter_is_at_topanswers.xyz over 6 years@ThomasSpranger And to prevent this last line to go on the next page, either allow the figure to be at the top of the page or force the line to go back to its own page by using some kind of floating barrier. [seems like we are going in circles with this conversation :) ]
-
freakinpenguin over 6 yearsLet us continue this discussion in chat.