citation, tables and equation exceed page width in beamer - latex

I am using Latex for the first time and I am preparing a slide using 'beamer'. What happening is that some of my citations, tables and long equations are exceeding beyond the text width, though it wasn't the problem when the document class was 'article'. My tables aren't long, as one of them has only 3 rows and 6 columns.
The latex codes are
\documentclass[9pt]{beamer}
\mode<presentation> {
\usefonttheme{serif}
\usetheme{Madrid}
\definecolor{BlueGreen}{cmyk}{0.85,0,0.33,0}
\colorlet{beamer#blendedblue}{BlueGreen!120}}
\usepackage{booktabs}
\usepackage{caption}
\hypersetup{pdfnewwindow}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{frametitle}{size=\footnotesize}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{postit}{bg=violet!110}
\usepackage{ragged2e} %new code
\addtobeamertemplate{block begin}{}{\justifying}
\usepackage{textpos}
\begin{document}
\begin{frame} \frametitle{\textbf{{\Large Objective}}}
\begin{itemize}
\justifying
\item This package gives you easy access to the Lorem Ipsum dummy text; an option is available to separate the paragraphs of the dummy text. This text \cite{kumar2015method}.
\item The long equation is:
\begin{equation}
A(\theta,\alpha) = \dfrac{ A*{-(\alpha*A)}\beta*{(\delta-1)} \left(A* \hspace{1mm}\hspace{1mm}C^{-A Z_{H}} \hspace{1mm}C^{-C^{-A *Z_{H}}} \prod_{i=1}^{m-1} \left( \dfrac{ A \hspace{1mm}C^{-A* Z_{u(i)}} C^{-C^{-A* Z_{u(i)}}}}{1- \frac{1}{C-1} (C^{1-C^{-A Z_{u(i)}}}-1)}\right) \right) }{ \int_{0}^{\infty} C^{-(\alpha *A)}(A^{(\beta-1)} \left( A* \hspace{1mm}\hspace{1mm}C^{-A Z_{H}} \hspace{1mm}C^{-C^{-A Z_{H}}} \prod_{i=1}^{B-1} \left(\dfrac{ A \hspace{1mm}C^{-A Z_{u(i)}} C^{-C^{-A* Z_{u(i)}}}}{1- \frac{1}{C-1} (C^{1-C^{-A* Z_{u(i)}}}-1)}\right) \right) A} .
\end{equation}
\end{itemize}
\end{frame}
\bibliography{ref}
\bibliographystyle{plainnat}
\end{document}
And the contents of the .bib file is:
#article{kumar2015method,
title={This is the title of the article},
author={Kumar, Dinesh and others},
journal={This is Journal},
volume={2},
number={3},
pages={150-180},
year={2015}
}

If you use the plainnat bib style, you should also load the natbib package. This will automatically allow line breaks
you don't need the caption package, beamer provides it's own mechanism to customise captions
you must place the bibliography inside a frame
for the very large equation, I would suggest to replace the fraction with (...) \times (...)^{-1}, this way you can split it over multiple lines. In addition you'll probably want to use a smaller font size and maybe remove all the manual spaces.
\documentclass[9pt]{beamer}
\mode<presentation> {
\usefonttheme{serif}
\usetheme{Madrid}
\definecolor{BlueGreen}{cmyk}{0.85,0,0.33,0}
\makeatletter
\colorlet{beamer#blendedblue}{BlueGreen!120}
\makeatother
}
\usepackage{booktabs}
%\usepackage{caption}
\hypersetup{pdfnewwindow}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{frametitle}{size=\footnotesize}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{postit}{bg=violet!110}
\usepackage{ragged2e} %new code
\addtobeamertemplate{block begin}{}{\justifying}
\usepackage{natbib}
\usepackage{textpos}
\begin{document}
\begin{frame} \frametitle{\textbf{{\Large Objective}}}
\begin{itemize}
\justifying
\item This package gives you easy access to the Lorem Ipsum dummy text; an option is available to separate the paragraphs of the dummy text. This text \cite{kumar2015method}.
\item The long equation is:
\end{itemize}
\end{frame}
\begin{frame}
\bibliography{ref}
\bibliographystyle{plainnat}
\end{frame}
\end{document}

Related

avoiding transparent caption in beamer/latex

I am trying to insert a figure but its caption is transparent in the current page. how to prevent this? many thanks in advance.
\documentclass{beamer}
\usetheme{Ilmenau}
\setbeamercovered{transparent}
\setbeamercolor*{item}{fg=blue}
\usepackage{caption}
\captionsetup{font=scriptsize,labelfont=scriptsize}
\usepackage{hyperref}
\hypersetup{urlcolor=blue}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\title{DNA - Computing}
\author{Aleyna Acikyol \& Alina Grahic
}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
%5 FOTO
\begin{frame}{Probleme heutiger Computer (3)}
%\begin{enumerate}
% \item \textcolor{blue}{Transistoren:}
\begin{itemize}
\item \textcolor{blue}{Transistoren:}
\begin{itemize}
\item kleiner geht nicht
\item Ausgleich mit Multicores /Multiprozessorsysteme
\end{itemize}
\end{itemize}
\pause
\begin{figure}
%\begin{itemize}
\begin{columns}
\column{0.50\linewidth}
\centering
\includegraphics[height=3cm, width=3cm]{./5.jpg}\caption{diverse Datenträger im Privatgebrauch}
\column{0.50\linewidth}
\centering
\includegraphics[height=3cm, width=3cm]{./5.2.jpg}\caption{Data Centre, Cloud}
\end{columns}
%\end{itemize}
\end{figure}
%\end{enumerate}
\end{frame}
\end{document}
It looks like
The caption is transparent because you are using \setbeamercovered{transparent}. You have two options to avoid the transparent caption:
immediately show the images and caption by avoid the \pause in front of them
switching to \setbeamercovered{invisible} either temporarily or for the whole presentation to delay the images and caption to the next overlay:
\documentclass{beamer}
\usetheme{Ilmenau}
\setbeamercovered{transparent}
\setbeamercolor*{item}{fg=blue}
\setbeamerfont{caption}{size=\scriptsize}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\title{DNA - Computing}
\author{Aleyna Acikyol \& Alina Grahic
}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
%5 FOTO
\begin{frame}
\frametitle{Probleme heutiger Computer (3)}
%\begin{enumerate}
% \item \textcolor{blue}{Transistoren:}
\begin{itemize}
\item \textcolor{blue}{Transistoren:}
\begin{itemize}
\item kleiner geht nicht
\item Ausgleich mit Multicores /Multiprozessorsysteme
\end{itemize}
\end{itemize}
{
\setbeamercovered{invisible}
\pause
\begin{figure}
%\begin{itemize}
\begin{columns}
\column{0.50\linewidth}
\centering
\includegraphics[height=3cm, width=3cm]{example-image-duck}\caption{diverse Datenträger im Privatgebrauch}
\column{0.50\linewidth}
\centering
\includegraphics[height=3cm, width=3cm]{example-image-duck}\caption{Data Centre, Cloud}
\end{columns}
%\end{itemize}
\end{figure}
%\end{enumerate}
}
\end{frame}
\end{document}
Some other comments:
you don't need \usepackage{hyperref}, beamer already loads it
I'd be wary to use \hypersetup{urlcolor=blue} with beamer, this can lead to strange alternations to the carefully constructed colour themes of beamer in places one would never expect
If your tex distribution was updated within the last 5 years or so, you don't need \usepackage[utf8]{inputenc}, that's now the default
If you just want to change the font size of the caption, you don't actually need the caption package, beamer has its own mechanism to control the size of captions
Instead of \begin{frame}{...} I would use \frametitle{...}. That's much more flexible and powerful
If you specify both the width and height of your images, they will end up distorted. Please consider adding the keepaspectratio option to avoid this
to avoid manually repeating the same frame title several times ("Probleme heutiger Computer (3)") you could use overlays and add the slide in frame counter to the frametitle

Switch Overlay Specification in Latex Beamer

I have a beamer document with
\beamerdefaultoverlayspecification{<+->}
in the preamble to make \items appear separately. However, this seems to also make \bibitems
appear separately. How can I switch back to 'normal' within the document, such that all bibitems appear on one slide?
You can change the default overlay specification before the bibliography:
\documentclass{beamer}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\beamerdefaultoverlayspecification{<+->}
\begin{document}
\begin{frame}
\begin{itemize}
\item content...
\item content...
\end{itemize}
\end{frame}
\beamerdefaultoverlayspecification{}
\begin{frame}
\nocite{knuth:ct,angenendt}
\printbibliography
\end{frame}
\end{document}

Title not being rendered with LaTeX

So I have the following document:
\include{preamble}
\title{test title}
\begin{document}
\maketitle
\begin{equation*}
\begin{aligned}
\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\dots}}}}}
\end{aligned}
\end{equation*}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
the contents of my preamble.tex file is:
%%%%% Document Setup %%%%%%%%
\documentclass[10pt,onecolumn]{revtex4} % Font size (10,11 or 12pt) and column number (one or two).
\usepackage{times} % Times New Roman font type
\usepackage[a4paper, left=1.85cm, right=1.85cm,top=1.85cm, bottom=1.85cm]{geometry} % Defines paper size and margin length
\usepackage[font=small, labelfont=bf]{caption} % Defines caption font size as 9pt and caption title bolded
\usepackage{graphics,graphicx,epsfig,ulem} % Makes sure all graphics works
\usepackage{amsmath} % Adds mathematical features for equations
\usepackage{etoolbox} % Customise date to preferred format
\usepackage{subcaption}
\usepackage{caption}
\makeatletter
\patchcmd{\frontmatter#RRAP#format}{(}{}{}{}
\patchcmd{\frontmatter#RRAP#format}{)}{}{}{}
\renewcommand\Dated#name{}
\makeatother
\usepackage{fancyhdr}
\def\bibsection{\section*{References}} % Position reference section correctly
\usepackage{import}
\usepackage{pdfpages}
\usepackage{transparent}
\usepackage{xcolor}
\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
\pdfsuppresswarningpagegroup=1
For some reason the title just will not be included on the pdf when I compile the code, I am sure I have \title{} and \maketitle in the correct positions. Any help as to why this is would be much appreciated.
Move the title after \begin{document}:
\documentclass{revtex4}
\begin{document}
\title{test title}
\maketitle
\end{document}
(don't do this with other documentclasses. Most of the time it is better to have the \title in the preamble, e.g. to get sensible pdf meta data if combined with hyperref)

How can I print the presentation made in Beamer without white bars?

How can I print on Epson L4160, or any other printer the presentation made in Latex connected with Beamer, having scale of frame 16:9? My trouble is strange, because I don't want to have a white bars... But, what I have discovered, on the preview in Adobe Reader, in full screen preview it looks very good...
Snapshot of printing:
Snapshot of fullscreen presentation:
And code: (due to many lines, I can paste it on other page if it is necessary)
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
\usepackage[inline]{enumitem}
\usepackage{multicol}
\usepackage{gensymb} %degree
\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{url} %bibliography
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\DeclareMathOperator*{\Bigcdot}{\scalerel*{\cdot}{\bigodot}}
\usetikzlibrary{positioning, calc}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\setlength{\parindent}{0pt}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
%\date{}
\expandafter\def\expandafter\insertshorttitle\expandafter{%
\insertshorttitle\hfill \hspace*{3.85cm}%
\insertframenumber\,/\,\inserttotalframenumber}
\makeatletter
\long\def\beamer##ssection*#1{\beamer#section[]{}}
\makeatother %remove section both from header and outline in beamer
\newcommand{\lcancel}[2]{\cancel{#1}_{#2}}
\newcommand{\ucancel}[2]{\cancel{#1}^{#2}}
\newcommand*{\rechterWinkel}[3]{% #1 = point, #2 = start angle, #3 = radius
\draw[shift={(#2:#3)}] (#1) arc[start angle=#2, delta angle=90, radius = #3];
\fill[shift={(#2+45:#3/2)}] (#1) circle[radius=2.5\pgflinewidth];
}
%\special{pdf:encrypt ownerpw (prezentacjaPL2020) userpw (prezentacja2020) length 128 perm 2052}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents
\end{frame}
\section{Wprowadzenie}
\begin{frame}{O czym będziemy mówili?}
\begin{figure}[h!]
\begin{center}
\includegraphics[scale=0.2]{idea-3383766_1280.jpg}
\end{center}
\caption{Jak sądzicie?}
\end{figure}
\end{frame}
\begin{frame}{Przypomnienie}
\justify
Do tej pory mówiliśmy wyłącznie o \textbf{zdaniach logicznych} i ich \textbf{zaprzeczeniach}.
\\[0.25cm]
\pause
\textbf{Przykład:} \textit{Kwadrat ma nieskończenie wiele osi symetrii.}
\pause
\\[0.25cm] Są to tak zwane zdania proste - wyrażają one bowiem jedną myśl, składają się z jednego orzeczenia.
\pause \\[0.25cm] \textcolor{myAmber}{Pytanie:} Co się dzieje, gdy zdanie jest bardziej rozbudowane, skomplikowane? W jaki sposób wówczas z nim poradzić?
\end{frame}
\subsection{Zdania złożone}
\begin{frame}{Zdania złożone}
\justifying
Okazuje się, że zdania tej postaci:
\\[0.25cm] \pause \textit{Wojtek poszedł do kina lub zjawił się na stadionie.}
\\[0.25cm] \pause \textit{Eliza narysowała dom i wymieniła cieńkopis.}
\pause \\[0.25cm] prowadzą nas do nowego pojęcia: \textbf{zdania złożonego}. Powiedzmy coś o nich.
\end{frame}
To get more or less the same aspect ration than a A4 paper, you could modify the page geometry like this:
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
%\usepackage[inline]{enumitem}
%\usepackage{multicol}
\usepackage{gensymb} %degree
%\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
%\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{url} %bibliography
%\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
\makeatletter
\setlength\beamer#paperwidth{16.00cm} \setlength\beamer#paperheight{11.31cm}
\geometry{%
papersize={\beamer#paperwidth,\beamer#paperheight},
hmargin=2cm,%
vmargin=0cm,%
head=1cm,% might be changed later
headsep=0pt,%
foot=1cm% might be changed later
}
\makeatother
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}
Some other comments about your code:
don't use enumitem with beamer
beamer has its own column mechanism, multicol is not necessary
if you need something from the colortbl package, use the xcolor={table} documentclass option instead of loading the package
you don't need graphicx
you also don't need url - beamer loads hyperref
no need for amsmath either, beamer already loads this
using floating specifier such as [h!] in a documentclass without floating mechanism makes no sense
don't use \begin{center}...\end{center} within your figures. This adds additional vertical space and is also unnecessary because figures are centred by default
don't abuse \\ for line breaks. Leave an empty line instead
instead of manually numbering things like Definicja 1., use an appropriate environment like definition, these can be made to number things automatically
Just give the filename of images without file type. Latex will automatically choose the best suited type in case you have the image in different formats
have a look at the booktabs package. Data prison style tables are really ugly
it should be \justifying and not \justify (the later kinda works by accidents, but causes many strange problems because it actually is an environment and not a macro)

Define fonts in Beamer

I want to define distinct fonts for text and math. I used this code
\documentclass{beamer}
\renewcommand {\rmdefault }{ibh}
\usepackage{fontspec}
\setmainfont{Segoe Print}
\usefonttheme[onlymath]{serif}
\renewcommand\sfdefault{cmbr}
\begin{document}
\begin{frame}
Some text, $x^2 + y^2 = r^2$
\end{frame}
\end{document}
but it has a inverse result:
How can i correct it?
You may need the package lmodern too:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{fontspec}
\setmainfont{Segoe Print}
\usefonttheme{serif}
\begin{document}
\begin{frame}
Some text, $x^2 + y^2 = r^2$
\end{frame}
\end{document}
This code, compiled with LuaLaTeX, gives:
Also, check the option no-math of package fontspec.

Resources