LaTeX Beamer -- Nested itemize, vertical spacing isn't constant - latex

I'm working on a beamer template and I'm struggling to customize my itemize environment. More precisely, I've troubles with the itemsep in my itemize environment. In general, I'm changing the font size for deeper levels (-> the font size becomes smaller) and that's where the problems begin.
In the appendix you can see a picture with three itemize levels (itemsep_not_constant). If you look closely, then you can see that the vertical spacing between the penultimate and the last items of the same level becomes smaller. This applies for the first level and for the second level.
I've noticed that this problem only occurs, if I add a another (deeper) itemize level with a different font size. Therefore, you can see that the vertical spacing between the items in the third level remains constant.
To get rid of this problem I've tried different approaches, e.g. defining a \newlist. After some research in the internet I've found out that it is recommended to use the \setbeamertemplate for customizations and to avoid using the itemize package (\usepackage{itemize}) in beamer.
Here's my MWE:
\documentclass[aspectratio=169,xcolor=table,12pt]{beamer}
% compile in pdfLaTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[type=none]{fgruler} % ruler
\usepackage{xcolor}
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
\definecolor{footerGrey}{RGB}{135,135,135}
\setbeamercolor*{normal text}{fg=footerGrey}
\setbeamertemplate{itemize/enumerate body begin}{\normalsize}
\setbeamertemplate{itemize/enumerate subbody begin}{\footnotesize}
\setbeamertemplate{itemize/enumerate subsubbody begin}{\scriptsize}
\setbeamertemplate{itemize item}{\color{footerGrey}\rule[0.9mm]{0.6ex}{0.6ex}}
\setbeamertemplate{itemize subitem}{\color{footerGrey}\rule[0.8mm]{0.6ex}{0.6ex}}
\setbeamertemplate{itemize subsubitem}{\color{footerGrey}\rule[0.5mm]{0.6ex}{0.6ex}}
\begin{document}
\begin{frame}
\fgruler{upperleft}{0cm}{0cm}%
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\begin{itemize}
\item Item 4
\item Item 5
\item Item 6
\begin{itemize}
\item Item 7
\item Item 8
\item Item 9
\item Item 10
\end{itemize}
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
I'm running out of ideas and I'd really appreciate any help! Thank you and
DIFFERENT APPROACHES THAT HAVE BEEN TRIED:
define \setbeamertemplate (see case description);
another approach:
create a newlist and change the settings for each level
\setlist[unthaItemize,1]{font=\sffamily\bfseries\Huge,
label=\color{footerGrey}\rule[0.9mm]{0.6ex}{0.6ex},
align = left,
leftmargin = 0.025\paperwidth,
labelsep = 0pt,
labelwidth = 8pt,
itemindent= -0.5pt,
topsep = 2.5pt,
itemsep = 2.5pt,
}
\setlist[unthaItemize,2]{label=\color{footerGrey}\rule[0.8mm]{0.6ex}{0.6ex},
align = left,
leftmargin = 0.025\paperwidth,
labelsep = 0pt,
labelwidth = 8pt,
itemindent= -0.5pt,
topsep = 2.5pt,
itemsep = 2.5pt,
%before* = \fontsize{10pt}{10pt}\selectfont
}
etc.

You have to finish the paragraph (e.g. by inserting an empty line) before you switch to a different font size (see also https://github.com/josephwright/beamer/issues/530):
\documentclass[aspectratio=169,xcolor=table,12pt]{beamer}
% compile in pdfLaTeX
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage[type=none]{fgruler} % ruler
%\usepackage{xcolor}
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
\definecolor{footerGrey}{RGB}{135,135,135}
\setbeamercolor*{normal text}{fg=footerGrey}
\setbeamertemplate{itemize/enumerate body begin}{\normalsize}
\setbeamertemplate{itemize/enumerate subbody begin}{\footnotesize}
\setbeamertemplate{itemize/enumerate subsubbody begin}{\scriptsize}
\setbeamertemplate{itemize item}{\color{footerGrey}\rule[0.9mm]{0.6ex}{0.6ex}}
\setbeamertemplate{itemize subitem}{\color{footerGrey}\rule[0.8mm]{0.6ex}{0.6ex}}
\setbeamertemplate{itemize subsubitem}{\color{footerGrey}\rule[0.5mm]{0.6ex}{0.6ex}}
\begin{document}
\begin{frame}
\fgruler{upperleft}{0cm}{0cm}%
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\begin{itemize}
\item Item 4
\item Item 5
\item Item 6
\begin{itemize}
\item Item 7
\item Item 8
\item Item 9
\item Item 10
\end{itemize}
\end{itemize}
\end{itemize}
\end{frame}
\end{document}

Related

Correct way to use "enumitem" (or its alternatives) for itemize in Latex Beamer

I'm trying to customize my itemize list in a Beamer slide using the noitemsep and topsep settings available in the enumitem package. However, using enumitem with Beamer causes the bullet points to disappear (images attached below). I also came to know that enumitem isn't really compatible with Beamer, and should not be used alongside the enumerate package, but I can't figure out what alternatives are available for my use case.
When I don't use enumitem
\begin{frame}
\begin{itemize}
\item Apples
\item Oranges
\item Bananas
\end{itemize}
\end{frame}
Output (contains bullet points):
When I use enumitem:
\usepackage{enumitem}
\begin{frame}
\begin{itemize}[noitemsep]
\item Apples
\item Oranges
\item Bananas
\end{itemize}
\end{frame}
Output (the bullets have disappeared):
Any hints regarding what settings I should use with enumitem when using Beamer, or what other alternative packages I can use (which is more compatible with Beamer) which can fulfill my objective, would be greatly appreciated.
Don't use enumitem with beamer, it is not compatible.
You can adjust the spacing in various ways, either locally or globally.
\documentclass{beamer}
\begin{document}
\begin{frame}
text
\vskip-1ex
\begin{itemize}
\addtolength{\itemsep}{-1ex}
\item Apples
\item Oranges
\item Bananas
\end{itemize}
\end{frame}
\end{document}
\documentclass{beamer}
\usepackage{xpatch}
\xpatchcmd{\itemize}
{\def\makelabel}
{%
\addtolength{\itemsep}{-1ex}%
\def\makelabel%
}
{}
{}
\BeforeBeginEnvironment{itemize}{\vskip-1ex}
\begin{document}
\begin{frame}
text
\begin{itemize}
\item Apples
\item Oranges
\item Bananas
\end{itemize}
\end{frame}
\end{document}

Change \itemize bullet point after certain slide in nestled \itemize environment

I want to change the bullet point symbol of certain items in my list after a certain slide.
A solution to a similar problem, but without nestled \itemize environments, was posted here: https://tex.stackexchange.com/questions/424011/change-beamer-itemize-symbol-and-overlay
The list looks like this:
\documentclass[9pt,aspectratio=169]{beamer}
\newenvironment{redenv}{\only{\setbeamercolor{local structure}{fg=red}}}{}
\begin{itemize}
\item<1-|red#3-> Item 1
\item Item 2
\begin{itemize}
\item<2-|red#3-> Item 3
\end{itemize}
\item Item 4
\end{itemize}
\end{document}
I want to change the symbol for Item 1 and Item 3 after a certain pause. This solution works only for Item 1, but not Item 3.
Edit:
Turns out I copied the example wrongly here, but not in my actual document. Instead I found the real culprit: My document uses a beamercolor.sty sheet that defines the color of the bullet points:
\setbeamercolor{item}{parent=local structure}
\setbeamercolor{subitem}{parent=item, fg=gray}
\setbeamercolor{subsubitem}{parent=subitem}
So, when I delete the fg=gray, it works as indended. But I want the gray color as default and only change the color in places I choose. How can reconcile both coloring methods?
You are missing the fg= in your colour definition:
\documentclass[9pt,aspectratio=169]{beamer}
\newenvironment{redenv}{\only{\setbeamercolor{local structure}{fg=red}}}{}
\begin{document}
\begin{frame}
\begin{itemize}
\item<1-|red#3-> Item 1
\item Item 2
\begin{itemize}
\item<2-|red#3-> Item 3
\end{itemize}
\item Item 4
\end{itemize}
\end{frame}
\end{document}
Or if you don't mind that the text also changes colour, you could use alert:
\documentclass[9pt,aspectratio=169]{beamer}
\begin{document}
\begin{frame}
\begin{itemize}
\item<1-|alert#3-> Item 1
\item Item 2
\begin{itemize}
\item<2-|alert#3-> Item 3
\end{itemize}
\item Item 4
\end{itemize}
\end{frame}
\end{document}

List bullet problems in latex

I want the effect:
Stage 1 xxxx
Stage 2 xxxx
Stage 3 xxxx
but the latex setting code
\begin{enumerate}[Stage 1]
produces
Stage 1 xxxx
Stbge 2 xxxx
Stcge 3 xxxx
Obviously latex take the character 'a' in stage as bullet starter. So how to set static characters in the parameter?
You'll have to hide the non-enumerable content from enumerate. There are a number of ways to achieve this:
\documentclass{article}
\usepackage{enumerate}
\begin{document}
% Default enumeration
\begin{enumerate}[Stage 1]
\item First
\item Second
\item Last
\end{enumerate}
% Hide non-enumerable content using {braces}
\begin{enumerate}[{Stage} 1]
\item First
\item Second
\item Last
\end{enumerate}
% Hide non-enumerable content using macros
\newcommand{\enumprefix}{Stage}
\begin{enumerate}[\enumprefix{} 1]
\item First
\item Second
\item Last
\end{enumerate}
\end{document}
enumitem provides a more explicit way of identifying the enumeration:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label={Stage \arabic*}]
\item First
\item Second
\item Last
\end{enumerate}
\end{document}

Latex Remove Spaces Between Items in List

What is the best way to format a list as to remove the spaces between list items.
It's easier with the enumitem package:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
Less space:
\begin{itemize}[noitemsep]
\item foo
\item bar
\item baz
\end{itemize}
Even more compact:
\begin{itemize}[noitemsep,nolistsep]
\item foo
\item bar
\item baz
\end{itemize}
\end{document}
The enumitem package provides a lot of features to customize bullets, numbering and lengths.
The paralist package provides very compact lists: compactitem, compactenum and even lists within paragraphs like inparaenum and inparaitem.
You could do something like this:
\documentclass{article}
\begin{document}
Normal:
\begin{itemize}
\item foo
\item bar
\item baz
\end{itemize}
Less space:
\begin{itemize}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\item foo
\item bar
\item baz
\end{itemize}
\end{document}
This question was already asked on https://tex.stackexchange.com/questions/10684/vertical-space-in-lists. The highest voted answer also mentioned the enumitem package (here answered by Stefan), but I also like this one, which involves creating your own itemizing environment instead of loading a new package:
\newenvironment{myitemize}
{ \begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt} }
{ \end{itemize} }
Which should be used like this:
\begin{myitemize}
\item one
\item two
\item three
\end{myitemize}
Source: https://tex.stackexchange.com/a/136050/12065
compactitem does the job.
\usepackage{paralist}
...
\begin{compactitem}[$\bullet$]
\item Element 1
\item Element 2
\end{compactitem}
\vspace{\baselineskip} % new line after list

Latex: text should automatically fill the frame in Beamer slides

In beamer frames I want the contents to be spread out evenly across the frame.
Using option \documentclass[slidestop]{beamer} I can easily specify the contents to be top/center aligned but when I have only few bullets on a slide they get clustered together at the top, I want beamer to decide the spacing between them automatically to spread them evenly.
Is this possible without putting vspace by trial and error?
I think using \vfill would reduce the trial and error part. One \vfill between each bullet should guarantee even spacing. Try \vfill before and/or after bullets to get separation from preceding text or from bottom of page. I don't use or know Beamer, but I suspect there's a way to put the \vfill commands into the Beamer template.
\documentclass{article}
\begin{document}
\begin{itemize}
\vfill\item This is text of first item
\vfill\item This is text of second item
\vfill\item This is text of third item
\end{itemize}
\end{document}
Per your comment, here's one way you could define vfill to be automatically used in main list items but have no vfill in subitems. THis way lets you use same \item command regardless of whether you're in main list or in nested list, but requires you to define or redefine environments, and to be aware of when you're adding a main (i.e, vfilled) list and when you're adding a non-vfilled (i.e, nested) list:
\documentclass{article}
\newenvironment{novfillenum}{\begin{enumerate}\let\item\olditem}%
{\end{enumerate}}
\newenvironment{vfilleditems}{\begin{itemize} \let\olditem\item \renewcommand\item{\vfill\olditem}}%
{\end{itemize}}
\begin{document}
\begin{vfilleditems}
\item Item One
\begin{novfillenum}
\item subitem1
\item s2
\item s3
\end{novfillenum}
\item Item Two
\begin{novfillenum}
\item subitem1
\item s2
\item s3
\end{novfillenum}
\item item three
\begin{novfillenum}
\item subitem1
\item s2
\item s3
\end{novfillenum}
\end{vfilleditems}
\end{document}
Adding another sample here because first answer getting too crowded. Tested altering the label commands and, what do you know, it seems to work, sort of. It gives errors, though, which I'm sure are related to having the \vfill as part of the label construct. I'm surprised it does seem to create the desired output, but the method would need some tweaking to get it to work without errors:
\begin{document}
\let\oldlabelitemi\labelitemi
\renewcommand{\labelitemi}{\vfill\oldlabelitemi{\hspace{1ex}}}
\begin{itemize}
\item Item One
\begin{itemize}
\item subone
\item subtwo
\item subthree
\end{itemize}
\item Item Two
\begin{itemize}
\item subitem1
\item s2
\item s3
\end{itemize}
\item item three
\begin{itemize}
\item subitem1
\item s2
\item s3
\end{itemize}
\end{itemize}
\end{document}

Resources