How can I add text line on left side and frame number on right side of footer in latex beamer presentation?
Also, I need to exclude title page from this footer placement.
Found a solution:
To obtain text and frame number as required, the following code is needed in the beginning.
\setbeamertemplate{footline}{text line}{text here \hspace{3cm} \insertframenumber{}/\inserttotalframenumber}
Instead of adding the frame number to the textline template, I find it easier to do it the other way round and add some text to the predefined framenumber footline:
\documentclass{beamer}
\setbeamertemplate{footline}[frame number]
\addtobeamertemplate{footline}{\hskip1em text you want to add}{}
\begin{document}
\begin{frame}
content...
\end{frame}
\end{document}
Related
Hello I am new at beamer (overleaf), so I have learned very much, so I would like to change the design of the numeration in table of contents. I mean with that (see picture attached):
I would like to change to a square, or simply the number. Anyone knows others styles? I am using the \usetheme{CambridgeUS}.
You can set the sections/subsections in toc template to change to e.g. a square or plain numbered sections:
\documentclass{beamer}
\usetheme{CambridgeUS}
\setbeamertemplate{sections/subsections in toc}[square]
%\setbeamertemplate{sections/subsections in toc}[sections numbered]
\begin{document}
\section{title}
\begin{frame}
\tableofcontents
\end{frame}
\end{document}
I'm working on a presentation with Latex {beamer}. I have the following problem:
When I use the itemize command on a slide in conjunction with \visible<2->{text} Latex counts a new page for each item. That's why I have something like 17/11 on my presentation.
Does one know how to solve this problem?
With \thispagestyle{empty} I solve the problem only temporarily and not satisfactorily
If I understood correctly, you may not want a new page (slide) for each item in each itemize environment in your presentation, for example if you have to print your slides. In this case, you may switch from
\documentclass{beamer}
to
\documentclass[handout]{beamer}
before compiling again and print your output pdf file (whose page count will now be the same or smaller). The handout option is discussed in section 4.6 of this Beamer User Guide.
Don't show the page number, but use the frame number instead:
\documentclass{beamer}
%\setbeamertemplate{footline}[page number]
\setbeamertemplate{footline}[frame number]
\begin{document}
\begin{frame}
\begin{itemize}
\item text text
\item text \visible<2->{text}
\end{itemize}
\end{frame}
\end{document}
I'm currently working on an own beamer template (actually I'm trying to remodell an existing power point design so I can do my presentations using Latex).
The existing template has a titlebar which shows a logo on the right and a small colored bar below the bar. This titlebar is shown for the titlepage, as well as for the text slides. Within the textslides the titlebar also contains the current frames title and subtitle, each in i its own font size and color.
Using the beamer user guide and other templates, I figured that every frame has a headline, which is sometimes used to show the current section, and a frame title where usually the frametitle and subtitle are shown. The headline is shown topmost, followed by the frame title. The frame title however, is not shown on the titlepage.
A (I hope as minimal as possible) working example of my setup is:
\setbeamercolor*{frametitle}{fg=white,bg=blue}
\setbeamercolor*{framesubtitle}{fg=gray,bg=blue}
\defbeamertemplate*{headline}{formusic}
\ifx\insertframetitle\#empty%
\begin{beamercolorbox}[wd=\paperwidth, ht=1.5cm]{frametitle}
\hfill
\includegraphics[scale=0.15]{logo.png}
\end{beamercolorbox}
\else%
\fi%
\defbeamertemplate*{frametitle}{formusic}
\ifx\insertframetitle\#empty%
\begin{beamercolorbox}[wd=\paperwidth, ht=1.5cm]{frametitle}
\end{beamercolorbox}
\else%
\ifx\insertframesubtitle\#empty%
\begin{beamercolorbox}[wd=\paperwidth, ht=1.5cm]{frametitle}
\raisebox{0.55cm}{\insertframetitle}
\hfill
\includegraphics[scale=0.15]{logo.png}
\end{beamercolorbox}
\else%
\hbox{
\vbox{
\begin{beamercolorbox}[wd=\paperwidth, ht=0.7cm]{frametitle}
\insertframetitle
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth, ht=0.7cm]{framesubtitle}
\insertframesubtitle
\end{beamercolorbox}}
\includegraphics[scale=0.15]{logo.png}}
\fi
\fi%
The results of this can be seen in these slide headers. For the first, the titlepage this looks fine (I used the blue background color in order to visualize my problems), however for the other slides it does not look that good.
The headline does not seem to support the '\insertframe(sub)title' commands. Therefore I use a workaround where I display the empty titlebar within the headline for the first page with ifnum\c#framenumber=1, and for all other pages an empty headline. On these slides, the titlebar is displayed by the frametitle. This works - almost - as there is still a small white line visible between the frametitle and the top border of the slide.
My second problem is: How do I ideally arange the frametitle, -subtitle and logo in my titlebar? I played around a lot with beamercolorboxes, however I'm not 100% satisfied with what I have achieved so far. My attempt would be to have the frametitle and the subtitle in separate beamercolorboxes (this seems to be the most clean attempt, since I can use separately defined layouts for each, instead of switching font size and color), which are below each other. However now I don't know how to position the logo.
Edit: Added code example and images according to Werners suggestion and edited the text acordingly.
A quick workaround: not use a headline at all, but make sure that the frametitle will be shown on all frames, even those without frametitle:
\documentclass{beamer}
\setbeamertemplate{headline}{}
\setbeamercolor{frametitle}{fg=white,bg=blue}
\setbeamercolor{framesubtitle}{fg=gray,bg=blue}
\makeatletter
\patchcmd{\endbeamer#frameslide}{\ifx\beamer#frametitle\#empty}{\iffalse}{}{\errmessage{failed to patch}}
\makeatother
\makeatletter
\setbeamertemplate{frametitle}{%
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\#tempdima=\textwidth%
\advance\#tempdima by\beamer#leftmargin%
\advance\#tempdima by\beamer#rightmargin%
\begin{beamercolorbox}[sep=0.3cm,left,wd=\the\#tempdima]{frametitle}
\begin{minipage}{.81\paperwidth}
\usebeamerfont{frametitle}%
\vbox{}\vskip-1ex%
\if#tempswa\else\csname beamer#fteleft\endcsname\fi%
\strut\insertframetitle\par%
{%
\ifx\insertframesubtitle\#empty%
\else%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\strut\insertframesubtitle\par}%
\fi
}%
\end{minipage}%
\quad\raisebox{-0.3cm}{\includegraphics[width=.1\paperwidth]{example-image-duck}}
\if#tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
\end{beamercolorbox}%
}
\makeatother
\begin{document}
\begin{frame}
abc
\end{frame}
\begin{frame}
\frametitle{title}
abc
\end{frame}
\begin{frame}
\frametitle{very long title which possible spans over multiples lines...}
abc
\end{frame}
\begin{frame}
\frametitle{title}
\framesubtitle{subtitle}
abc
\end{frame}
\begin{frame}
abc
\end{frame}
\end{document}
I am trying to create a reference to a float that doesn't use a caption. If I include \label{foo} within the float and reference it using \pageref{foo}, the correct page number is displayed in my pdf document but the hyperlink created by the hyperref package links to a different page (the first page of the section). If I include a caption before the label in the float, the hyperref link goes to the correct page.
Is there a way to get the hyperref link to work correctly without including a caption in the float? Or else is there a way to suppress the display of a caption so I can include one without it being shown?
Below is a minimal example. If I process it using pdflatex, I get three pages. The "figure" is shown on the second page, and the third page says, correctly, "See figure on page 2." But the hyperlink on the '2' says "Go to page 1", and if I click it it takes me to page 1.
If I put an empty \caption{} before the \label{foo}, then the hyperlink works correctly, but I don't want to show a caption for my float.
\documentclass[11pt]{memoir}
\usepackage{hyperref}
\begin{document}
some text
\clearpage
\begin{figure}
a figure
\label{foo}
\end{figure}
more text
\clearpage
See figure on page \pageref{foo}.
\end{document}
The \label command references the last invocation of \refstepcounter. \caption recognises that it is in a figure environment and calls \refstepcounter{figure}. You can call \refstepcounter by yourself.
To avoid skipping a number in the series of figures, you may create an own, meaningless counter with \newcounter{dummy}. The result:
\documentclass{scrreprt}
\usepackage{hyperref}
\newcounter{dummy}
\begin{document}
\chapter{First}
\newpage
\begin{figure}
{\Huge FIGURE}
\refstepcounter{dummy}
\label{fig:figure}
\end{figure}
\chapter{Second}
Goto \pageref{fig:figure}
\end{document}
Creates an hyperlink to the end of the figure. (works on my machine :-)
Note than \ref{fig:figure} is meaningless.
Right before the label, use \phantomsection, like so:
\documentclass{memoir}
\usepackage{hyperref}
\begin{document}
some text
\clearpage
\begin{figure}
a figure
\phantomsection
\label{foo}
\end{figure}
more text
\clearpage
See figure on page \pageref{foo}.
\end{document}
:)
Loading the caption package should suppress caption output of empty captions. The labels for floats are always determined by the caption command preceding the label command.
How do I center text within a listing in Latex?
Or another way not using listing. (Need a box with monospace font)
The answer given at tex.stackexchange is:
\documentclass{article}
\usepackage{listings}
\renewcommand{\figurename}{Listing}
% replace figurename with the text that should preceed the caption
\begin{document}
\begin{figure}[thp] % the figure provides the caption
\centering % which should be centered
\caption{Ausgabe des C-Programms}
\begin{tabular}{c} % the tabular makes the listing as small as possible and centers it
\begin{lstlisting}[label={gtt_c_ausgabe}]
printf("Your code goes here.\n");
\end{lstlisting}
\end{tabular}
\end{figure}
\end{document}
...which still leaves me wondering:
Using a frame around the code, e.g. using \lstset{frame=single,frameround=tttt}, places the frame way over to the right. How can this be avoided?
What does the renewcommand bit do?
I don't have an answer for the listing package on top of my head, but you could try the following:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\tt Hello World\\Second line}}
That produces a box with 90% of the line width, with text of width 85% of line width.
If you want it centered you just put \centering in front of the \tt command:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\centering \tt Hello World\\Second line}}
If you prefer the box without a frame, simply change \framebox into \makebox (and keep the arguments as they stand).