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].
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.
I am trying to cross reference some numbered paragraphs. I am using \numpar but the first one always is off aligned. (\item didn't work)
Here is what I did:
\section{First section}
\subsection*{Subsection1}
\numpar\label{A1} blablabla1
\numpar\label{A2} blablabla2
\numpar\label{A3} blablabla3
\section{Second section}
Statement \ref{A2} = 2 must be true.
which results in:
I need all numbers to be aligned without affecting on unnumbered paragraphs. I am open to other commands instead of \numpar if any. Any advice is appreciated.
Why don't you use enumerate? It is done for that kind of problem.
\documentclass{article}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
\section{Second section}
Statement \ref{A2} = 2 must be true.
\end{document}
If required, you can customize the appearance with the enumitem package.
For instance, to increase the indentation, load the package, and start enumerate with :
\begin{enumerate}[leftmargin=3cm]`
Many options in the enumitem package and it can certainly fit your needs.
Edit:
Note that \item will indent anything that is after it. If you dont want this behavior, close the enumerate before your paragraph. Then you can restart the enumerate, but you must take care of the item numbering (see below).
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
This paragraph will be indented
\end{enumerate}
But this one will not.
\begin{enumerate}\setcounter{enumi}{1}
% This insures that item numbering will be coherent
% set it to the value of the last item
% If using the enumitem package, there is a simpler way with 'resume'
% \begin{enumerate}[resume]
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
And another non indented par
\section{Second section}
Statement \ref{A2} = 2 must be true.
\end{document}
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.
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}