I'm trying to make alignment points in a list environment. The following code gives me an error, but it almost compiles to what I want, just missing the bullet points. I must be misunderstanding something about align and/or tabular and how they work with linebreaks. Guidance appreciated!
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Title}
\begin{itemize}
\begin{tabular}{ll}
\item Topic Apple: &Something to say about it \\
\item Topic Watermelons: &Something different
\end{tabular}
\end{itemize}
\end{frame}
\end{document}
How about this?
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Title}
\begin{tabular}{p{0.4\textwidth}p{0.5\textwidth}}
\begin{itemize}
\item Topic Apple:
\item Topic Watermelon:
\end{itemize} &
\begin{itemize}
\item[] Something to say about it
\item[] Something to say about it
\end{itemize} \\
\end{tabular}
\end{frame}
\end{document}
Yours will actually work if you change {ll} to {p{width}l} or {p{width}p{width}} but I found that if you don't have itemize in the second column, your text ends up vertically top aligned while the itemized text in the left column is center (or maybe even slightly bottom) aligned vertically so it doesn't look good.
I tried using the array package and m{width} which provides a vertical center alignment but that was still different than whatever itemize is using. I'd say just play with the width argument inside of p{} to get the spacing/width you want. If your right column spills on to another line, you may need a "dummy" item in the right column.
Anyway, based on all the jimmy rigging that might be necessary if things spill onto two lines, I'm assuming my solution is potentially hackish but it looks like it provides what you want for the most part.
the \item[] for the right column is to create the same itemize alignment with no bullet. If you want bullets on the right, just remove the empty square brackets and you'll have them.
Related
I have a LaTeX beamer slide where I want to show an image on the right and some bullet item with a hyperlink on the left, but the link doesn't start right next to the bullet. Instead there is a line break. How can I get rid of that line break?
\documentclass[14pt, serif]{beamer}
\usepackage{hyperref}
\begin{document}
\begin{frame}{Links}
\begin{columns}[T]
\begin{column}{0.75\textwidth}
\begin{itemize}
\item \href{https://www.scrum.org/resources/blog/managing-risk-scrum}{scrum.org/resources/blog/managing-risk-scrum}
\end{itemize}
\end{column}
\begin{column}{0.25\textwidth}
image goes here
\end{column}
\end{columns}
\end{frame}
\end{document}
(It's not a problem that the link overlaps the dummy text "image goes here" as in real life my image displays fine as there are more links with the given one at the bottom and the image is at the top of the column.)
The problem is that there are no possible breaking points in the very long string scrum.org/resources/blog/managing. I suggest to not give an alternative text, but show the original url. This way, hyperref can automatically determine good break points within the url.
If these break points aren't aggressive enough, you could also try the xurl package, which will allow breaks at every point of the url.
If you want to keep your alternative text, you can add \allowbreak to add break points.
Some other comments:
you don't need to load the hyperref package, beamer automatically does this for you
the serif class option is obsolete. A warning in the log file will inform you about this and recommand the serif font theme instead
I recommend using \frametitle{...}, this is much more flexible
\documentclass[14pt]{beamer}
\usefonttheme{serif}
%\usepackage{xurl}
\begin{document}
\begin{frame}
\frametitle{Links}
\begin{columns}[T]
\begin{column}{0.75\textwidth}
\begin{itemize}
\item \href{https://www.scrum.org/resources/blog/managing-risk-scrum}{scrum.org/\allowbreak resources/\allowbreak blog/\allowbreak managing-risk-scrum}
\end{itemize}
\end{column}
\begin{column}{0.25\textwidth}
image goes here
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Links}
\begin{columns}[T]
\begin{column}{0.75\textwidth}
\begin{itemize}
\item \url{www.scrum.org/resources/blog/managing-risk-scrum}
\end{itemize}
\end{column}
\begin{column}{0.25\textwidth}
image goes here
\end{column}
\end{columns}
\end{frame}
\end{document}
it's my first post here, so please don't mind, if I'm doing something wrong.
I'm using the default beamer theme and changed some colors, like the color of the itemize bullets. Therefore, there are many lines like \setbeamercolor{item}{fg=MyColor} in the preamble. Now, I noticed that this in particular overrides the default coloring of the bullets when using an alert action like \item<alert#1-> An alerted item. On my slides, there is only the color of the text, but not of the bullet changed to red.
I wonder if nobody already came across this issue, but I found nothing after hours of searching, especially stack overflow or reddit.
I hope that I don't do anything obviously wrong...
Your help would be greatly appreciated, so thanks in advance :)
Yes, to this point this is a copy of my post on reddit, because I though, this is probably the better place to ask for help.
What I already tried:
using \AtBeginEnvironment{alertenv}{\setbeamercolor{itemize item}{fg=red}} of the etoolbox package
this works at first sight, but the bullet color is then changed without taking overlay specifications into account, so something like \item<alert#2-> An alerted item results in a red bullet also in the first overlay
Here's my MWE:
\documentclass{beamer}
% to demonstrate the faulty behaviour I put this in the document body, usually it would be here in the preamble
% \setbeamercolor{item}{fg=cyan}
% try uncommenting these lines to see the faulty behaviour with overlay specifications
% \AtBeginEnvironment{alertenv}{\setbeamercolor{itemize item}{fg=red}}
% \AtBeginEnvironment{alertenv}{\setbeamercolor{itemize subitem}{fg=red}}
% \AtBeginEnvironment{alertenv}{\setbeamercolor{itemize subsubitem}{fg=red}}
\begin{document}
\begin{frame}{MWE Beamer item color}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A default neutral item
\item<alert#2-> An alerted item
\end{itemize}
\end{column}
\setbeamercolor{item}{fg=cyan}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A default neutral item
\item<alert#2-> An alerted item
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
You can work around the problem like this:
\documentclass{beamer}
\setbeamercolor{item}{fg=cyan}
\addtobeamertemplate{alerted text begin}{\setbeamercolor{item}{fg=alerted text.fg}}{}
\begin{document}
\begin{frame}{MWE Beamer item color}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A default neutral item
\item<alert#2-> An alerted item
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A default neutral item
\item<alert#2-> An alerted item
\item A default neutral item
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
(if you are using this colour for more elements, it is usually easier to change the structure colour or directly redefine beamer#blendedblue)
Update:
This issue was fixed in https://github.com/josephwright/beamer/commit/53c13cbe1f48918703f93f310c209c5e3f7f44f5
Starting with beamer v3.65 the above workaround should no longer be necessary.
Suppose I want to center align the enumerated list. I did this:
\begin{center}
\begin{enumerate}[label=(\Roman*)]
\item Equation 1
\item Equation 2
\item Equation 3
\item Equation 4
\end{enumerate}
\end{center}
This is not working nicely. I have also tried without 'enumerate' and just 'center' and labeling manually. It does work but the alignment is not looking perfect.
Also instead for center we can also do:
I. Equation 1 \quad II. Equation 2
III. Equation 3 \quad IV.Equation 4
You cannot center an item list like that. Enumerate is a formatting environment that will supersedes the center environment.
What can be done is to put the enumerate list in a box (like a minipage), and to center this box.
Standard minipage requires a width, but there is a package (varwidth) that allows to define minipages with an unknown width (more precisely, you give a width parameter, but if width is smaller than that, the actual with is used).
So here is a solution with varwidth.
\documentclass{article}
\usepackage{enumitem}
\usepackage{varwidth}
\usepackage{tasks}
\begin{document}
\begin{center}
\begin{varwidth}{\textwidth}
\begin{enumerate}[label=(\Roman*)]
\item Equation 1
\item Equation 2
\item Equation 3
\item Equation 4
\end{enumerate}
\end{varwidth}
\end{center}
\end{document}
If you want to have several enumerate items per line, your solution is not very robust, as you must adjust the spacing depending on the item length if you want your items to be aligned.
The 'tabto' package provides a way to do the alignment in a flexible way. But the best solution is to use the 'tasks' package that allows to define columned list. This package is not as smart as others to determine the item width and, if required, this must be given explicitely. The parenthesized parameter is the number of columns. As previously, if you want to center globally the environment, you must use varwidth.
\begin{center}
\begin{varwidth}{\textwidth}
\begin{tasks}[label={(\Roman*)},label-width={1cm}](2)
\task Equation 1
\task Equation 2
\task Equation 3
\task Equation 4
\end{tasks}
\end{varwidth}
\end{center}
For simple lists like yours, a tabular could also be used.
You can just use
\begin{enumerate}[label=(\Roman*)]\centering
I just started learning Latex and I have this code in which I first define a figure which is a photo and then I want to have items in my PDF file.
But the output file isn't so and it first shows the items and then the photo! even though I have [!h] statement too.
\documentclass[12pt]{report}
\begin{document}
\begin{figure}[!h]
\centering
\includegraphics[width= 90mm]{./class.jpg}
\caption{pic1}
\end{figure}
\begin{enumerate}
\item first option with number
\item second option with number
\end{enumerate}
\end{document}
What I do is to use the package float and change !h for H
\documentclass[12pt]{report}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\centering
\includegraphics[width= 90mm]{./class.jpg}
\caption{pic1}
\end{figure}
\begin{enumerate}
\item first option with number
\item second option with number
\end{enumerate}
\end{document}
This forces latex to place the image right in the position you put it.
When I compile your code with \usepackage{graphicx}, and using a generic image, I first get the image, then the item list. Usually LaTeX will force the image onto the next empty page, if the image is too large (the width may fit, but possibly the height is off?). Maybe try playing with \includegraphics[scale=0.8].
I am producing some latex beamer slides (but I think it is not a beamer specific question per se).
I have the following:
\begin{itemize}
\item Issue1
\item Issue2
\item Issue3
\end{itemize}
Now, I want to have a right curly brace (i.e. '}') behind the items spreading over issue1 and issue2. And of course I want to write something behind that curly brace.
In a perfect world I would write something like:
\begin{itemize}
\left .
\item Issue1
\item Issue2
\right \} One and Two are cool
\item Issue3
\end{itemize}
This does not work because I am not in a math environment and I can not put the whole snippet inside a math environment because itemize would not work in that case.
Is there a clean solution or a hack to produce my desired result?
Regards,
Bastian.
I'd use tikz and make an overlay.
First include the proper packages (you may not need to include tikz since this is a beamer question):
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
Then when you make your list, give names to the places after each item:
\begin{itemize}
\item Issue 1
\tikz[remember picture] \node[coordinate,yshift=0.5em] (n1) {};
\item Issue 2
\tikz[remember picture] \node[coordinate] (n2) {};
\item Issue 3
\end{itemize}
(Note: I shifted the y value up by 1/2 of a line maybe more would be better.)
Because we used remember picture we can refer to these places in an overlay:
\begin{tikzpicture}[overlay,remember picture]
\path (n2) -| node[coordinate] (n3) {} (n1);
\draw[thick,decorate,decoration={brace,amplitude=3pt}]
(n1) -- (n3) node[midway, right=4pt] {One and two are cool};
\end{tikzpicture}
The path is there to deal with items that do not have the same width. This edit comes from ESultanik's answer.
The result is:
Side note: You can remove all of the remember picture options and add the following to automatically add remember to all pictures:
\tikzstyle{every picture}+=[remember picture]
You could (ab)use a table instead:
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{ll}
\textbullet Issue 1 & \multirow{2}{*}{{\LARGE \}} One and Two are cool} \\
\textbullet Issue 2 \\
\textbullet Issue 3 \\
\end{tabular}
\end{document}
produces:
removed dead Imageshack link
Here is Geoffs code with some small adaptions (just for other beamer users)
\begin{frame}{Example}
\begin{itemize}
\item The long Issue 1
\tikz[remember picture] \node[coordinate,yshift=0.7em] (n1) {}; \\
spanning 2 lines
\item Issue 2
\tikz[remember picture] \node[coordinate, xshift=1.597cm] (n2) {};
\item Issue 3
\end{itemize}
\visible<2->{
\begin{tikzpicture}[overlay,remember picture]
\draw[thick,decorate,decoration={brace,amplitude=5pt}]
(n1) -- (n2) node[midway, right=4pt] {One and two are cool};
\end{tikzpicture}
} % end visible
\end{frame}
Ressult (2nd slide of that frame):
The adaptions are:
added the visible command (because I think it is useful to blend in the brace later)
made the items more complex so the use of xshift became necessary (I figured out the xshift value simply by try and error so thats a drop of bitterness) Edit 2018-12-23: manual try-and-error shifting can be overcome by using this method: (n1 -| n2) -- (n2) instead of (n1) -- (n2).
One way to get around this would be to use a math environment like align, put the bullet points by hand (with \bullet ), and then use the resources of the math environment for big braces and such.
I did something similar once. I let the list be in a column to the left, and in the right column, I did the $\right\}$-thing so that it was as tall as some \mbox or something (which I decided with \vphantom or something similar). Unfortunately I don't have time to dig it out... I actually don't have time to be at SO at all right now ;)
I tried my idea, below. It doesn't work: unfortunately, the vboxes produced by the itemize environment all have width \textwidth.
The UI of my suggestion is nice, and by redefining \item it should be possible to get the item vboxes be of reasonable width. Or calculate a reasonable width for the vboxes containing the items. But since there are functional solutions already, I won't spend anymore time on this.
\documentclass{article}
\def\setgrouptext#1{\gdef\grouptext{#1}}
\newenvironment{groupeditems}{\begin{displaymath}\left.\vbox\bgroup\setgrouptext}{%
\egroup\right\rbrace\hbox{\grouptext}\end{displaymath}}
\begin{document}
\begin{itemize}
\item Line 1
\begin{groupeditems}{Lines 2 and 3 together!}
\item Line 2
\item Line 3
\end{groupeditems}
\item Line 4
\end{itemize}
\end{document}