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.
Related
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}
When compiling a LaTeX document, I get two pages numbered at "1": the front page and the first of the table of contents. Here's a MWE:
\documentclass[12pt,a4paper]{report}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\title{Title}
\begin{document}
\maketitle
\tableofcontents
\chapter{Chapter one}
\end{document}
When compiling this (using simply pdflatex file.tex), I get this:
But when I remove the line \usepackage{hyperref}, page numbers are fine. Note that I need this package to have links to pages in my table of contents, but maybe there's a better way to do so. What is happening here ? How do I get normal page numbers ?
Thanks in advance.
\maketitle under the report class sets the page number to 1 on the title page, but also restarts it from 1 for the following page. That's why you achieve a virtual page number 1 for the title, followed by an actual page number one for the ToC. I emphasize virtual here because \maketitle sets the title on an empty page style so that nothing is printed in the header/footer. However, these page numbers still appear in the toolbar when viewed in Adobe Acrobat.
One way around it would be to manually change the page display to something more appropriate just for the title page. For example, let's make the title page be called T:
\documentclass{report}
\usepackage{hyperref}
\title{Title}
\author{Author}
\begin{document}
\begingroup
\renewcommand{\thepage}{T}
\maketitle % Page T
\endgroup
\tableofcontents % Page 1
\chapter{A chapter} % Page 2
\end{document}
I am new to latex and I wrote the below tex code on Texmaker editor.
What I want to do is to add the "University" section without any numbering preceeding it and to be centered horizontally, because when I run the code I find that the word "University" is displayed but it is preceeded by a number and I do not want to display any number preceeding that word.
code:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\section{University}
\end{document}
\section*{\centering University}
% * removes numbering for _this_ \section instance,
% \centering within environment centres the title.
Note however, that this is a local solution, and that it's better practice (and easier for you to make later document-global changes) to re-define the \section, \subsection, ... environments using the titlesec package, as is described well in Alan Munn:s answer in the following tex.stackexchange thread:
https://tex.stackexchange.com/questions/8546/section-heading-centering-problem
All you have to do is to edit your line 9:
\section{University}
this way:
\section*{\centering University}
since the command \section* produces unnumbered sections.
Further, if you want to to include an unnumbered section to your table of contents, you can add
\addcontentsline{toc}{section}{University}
(this time without \centering) just after. The resulting code:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\tableofcontents
\section*{\centering University}
\addcontentsline{toc}{section}{University}
Text.
\end{document}
So i'm trying to hide the label in my cover image.
>\begin{figure}
>\center
>\includegraphics[scale=0.5]{universidade}
>\caption* {Mycaption}
>\end {figure}
This way it's not labeling the figure but its not showing on the list of figures
Help please ;D
You can give the caption package the option labelformat=empty to suppress the Figure 1 etc. labelling:
\usepackage[labelformat=empty]{caption}
You can use square brackets to specify the description for the figure list, and curly brackets for the actual figure caption. So I think you should be able to do the following to supress the caption but still have an entry in the figure list:
\begin{figure}
\center
\includegraphics[scale=0.5]{universidade}
\caption[Mycaption]{}
\end {figure}
There are a couple of options, depending on what yo're after exactly:
\documentclass{article}
\usepackage{graphicx}
\setcounter{topnumber}{3}% Just for this example
\begin{document}
\listoffigures
\begin{figure}
\addcontentsline{lof}{figure}{Example image A}%
\centering
\includegraphics[height=4\baselineskip]{example-image-a}
Example image A
\end{figure}
\begin{figure}
\addcontentsline{lof}{figure}{\protect\numberline{}Example image B}%
\centering
\includegraphics[height=4\baselineskip]{example-image-b}
Example image B
\end{figure}
\begin{figure}
\centering
\includegraphics[height=4\baselineskip]{example-image-c}
\caption{Example image C}
\end{figure}
\end{document}
The figure caption is added using \addcontentsline{lof}{figure}{<caption>}, where <caption> can either contain a blank \numberline{}, or just the regular caption. The above example shows the usage of either.
It would also be possible to have no label shows in the image, but have a numbered entry in the LoF using caption. But it would seem strange to have a numbered entry in the LoF and an unnumbered figure.
I'd like to insert a picture (figure) into a document which is using a two-column layout. However, I want it to take one whole page and not be centered on one of the columns. Currently if I add a [p] modifier to the figure, the whole image lands on the last page, instead in the middle of the document.
How can I force one page to switch back to a single-column layout and insert a single big picture there?
Use the figure* environment. So instead of
\begin{figure}[ht] % I typically use ht
\centering
...
\end{figure}
you should use
\begin{figure*}[ht]
\centering
...
\end{figure*}
This also works for tables (i.e. table*).
Consider this link for more information
It is not elegant, but with float package loaded you can use:
\begin{figure}[H]
\onecolumn\includegraphics{arc}
\end{figure}
\twocolumn
But you have to place this piece of code to exact locetion in source code. Otherwise you'll get pagebreak anywhere in twocolumned page, then page with image image.
To supplement #Crowley's answer, to avoid pagebreak after implementation.
Instead of using \twocolumn, use this package instead \usepackage{multicol}.
Then,
\begin{multicols}{2}
\section Write or place anything you want
\end{multicols}
This works for me!
\usepackage{multicol} in your preamble.
Then
\begin{document}
\begin{multicols}{2}
blah blah blah text
\end{multicols}
\begin{figure}[H]
\includegraphics[width=1\textwidth]{arc}
\end{figure}
\begin{multicols}{2}
blah blah blah text
\end{multicols}
\end{document}
This is ugly, and dirty. and you will need to fiddle with where you figure is in order to get the text balanced, but it is exactly what you asked for.