Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

By trying we can easily learn to endure adversity. Another man's, I mean. -- Mark Twain


comp / comp.text.tex / Re: pgfplots: link to top of embedded page

SubjectAuthor
* pgfplots: link to top of embedded pageHolger Schieferdecker
`* Re: pgfplots: link to top of embedded pageUlrich D i e z
 +* Re: pgfplots: link to top of embedded pageHolger Schieferdecker
 |`* Re: pgfplots: link to top of embedded pageUlrich D i e z
 | `* Re: pgfplots: link to top of embedded pageHolger Schieferdecker
 |  `- Re: pgfplots: link to top of embedded pageUlrich D i e z
 `- Re: pgfplots: link to top of embedded pageHolger Schieferdecker

1
Subject: pgfplots: link to top of embedded page
From: Holger Schieferdecke
Newsgroups: comp.text.tex
Organization: [ posted via ] IN-Ulm
Date: Mon, 23 Sep 2024 11:35 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!news.bawue.net!newsfeed.in-ulm.de!.POSTED!not-for-mail
From: spamless@gmx.de (Holger Schieferdecker)
Newsgroups: comp.text.tex
Subject: pgfplots: link to top of embedded page
Date: Mon, 23 Sep 2024 13:35:25 +0200
Organization: [ posted via ] IN-Ulm
Message-ID: <vcrjpsU2ns40L1@usenet.in-ulm.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.in-ulm.de 09E3F22AADC951BD5326D474DE40A72D
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
X-Mozilla-News-Host: news://news.in-ulm.de:119
View all headers

Hi,

I include single page PDF documents with \includepdf. They have the same
size and aspect ratio as the output document (A4). With the option
"addtotoc" I can add an entry to the tableofcontents and the bookmarks.
But clicking on that doesn't jump to the top of the included page.

It seems like the link target set by \includepdf is set with respect of
the page margins of the output document. I didn't find any hints in the
manual of pdfpages, besides that "addtotoc" is experimental. Is there a
way of positioning the link target at the top of the included pdf page?

In the example below the link to the first pdf jumps somewhere inside
the pdf. The link target of the second pdf is a bit above of the
embedded page.

Holger

%%%%%%%%%%%%%%%%%%
\documentclass{article}

\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\includepdf[landscape, scale=0.97,
addtotoc={1, section, 1, Example A, sp:ex-a}]{example-image-a}

\includepdf[scale=0.97,
addtotoc={1, section, 1, Example B, sp:ex-b}]{example-image-b}

\clearpage

Nothing here.

\end{document}
%%%%%%%%%%%%%%%%%%

Subject: Re: pgfplots: link to top of embedded page
From: Ulrich D i e z
Newsgroups: comp.text.tex
Date: Fri, 27 Sep 2024 02:51 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ud.usenetcorrespondence@web.de (Ulrich D i e z)
Newsgroups: comp.text.tex
Subject: Re: pgfplots: link to top of embedded page
Date: Fri, 27 Sep 2024 04:51:30 +0200
Message-ID: <vd56ie$pqj6$1@solani.org>
References: <vcrjpsU2ns40L1@usenet.in-ulm.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 Sep 2024 02:50:54 -0000 (UTC)
Injection-Info: solani.org;
logging-data="846438"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:BtMMy+GusggzZbH5xYnv50wasyk=
Content-Language: de-DE
In-Reply-To: <vcrjpsU2ns40L1@usenet.in-ulm.de>
X-User-ID: eJwFwYkRwDAIA7CVeGwI45D0vP8IlZjl9RrFAkVl4LLNBWMphQ3wuM+bxVFH2bVJBgzvW/75CA/W
View all headers

Holger Schieferdecker wrote:

> I include single page PDF documents with \includepdf. They have the same
> size and aspect ratio as the output document (A4). With the option
> "addtotoc" I can add an entry to the tableofcontents and the bookmarks.
> But clicking on that doesn't jump to the top of the included page.
>
> It seems like the link target set by \includepdf is set with respect of
> the page margins of the output document. I didn't find any hints in the
> manual of pdfpages, besides that "addtotoc" is experimental. Is there a
> way of positioning the link target at the top of the included pdf page?

I think there is no official interface but you can hook into
\includegraphics.

To test behavior with multiple pages I created testpictures.pdf from
testpictures.tex;

\documentclass[multi=true]{standalone}
\usepackage{graphicx}
\newenvironment{img}{}{}
\standaloneenv{img}
\begin{document}
\begin{img}%
\includegraphics[width=8cm]{example-image-a}%
\end{img}
\begin{img}%
\includegraphics[width=8cm]{example-image-b}%
\end{img}
\begin{img}%
\includegraphics[width=8cm]{example-image-c}%
\end{img}
\end{document}

This is how I hook into \includegraphics to get a bookmark and a
toc-entry for the first page of the included pdf-file:

\documentclass{article}

\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{hyperref}

\makeatletter
\newif\iffirstpicture
\newcommand\HookIntoIncludegraphics[4]{%
\let\includegraphicscopy=\includegraphics
\def\includegraphics##1##{\MyIncludegraphicsB{##1}}%
\firstpicturetrue
\def\MyIncludegraphicsB##1##2{%
\ifnum
\iffirstpicture\csname pdfpages@includegraphics@status\endcsname
\else 0\fi
=1 %
\global\firstpicturefalse
\vbox{%
\ifAM@landscape\else
\hbox{\kern-\baselineskip\phantomsection}%
\hrule height 0pt
\fi
\hbox{\includegraphicscopy##1{##2}}%
\ifAM@landscape
\hrule height 0pt
\hbox{%
\def\HyperRaiseLinkDefault{-\baselineskip}%
\kern-\baselineskip
\phantomsection
\kern\baselineskip
}%
\fi
\addcontentsline{#1}{#2}{#3}%
\NR@gettitle{#3}%
\label{#4}%
}%
\else
\includegraphicscopy##1{##2}%
\fi
}%
}%
\makeatother

\begin{document}

\tableofcontents

\bigskip

\noindent \verb|\nameref|-links:

\bigskip

\nameref{sp:ex-a}%

\medskip

\nameref{sp:ex-b}%

\medskip

\nameref{sp:ex-c}%

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example A}{sp:ex-a}%
\includepdf[landscape, scale=0.97, pages=1]{testpictures.pdf}%
\endgroup

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example A, B, C}{sp:ex-b}%
\includepdf[scale=0.97, pages=-]{testpictures.pdf}%
\endgroup

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example B, C}{sp:ex-c}%
\includepdf[landscape, scale=0.97, pages=2-3]{testpictures.pdf}%
\endgroup

Nothing here.

\end{document}

Sincerely

Ulrich

Subject: Re: pgfplots: link to top of embedded page
From: Holger Schieferdecke
Newsgroups: comp.text.tex
Organization: [ posted via ] IN-Ulm
Date: Fri, 27 Sep 2024 12:50 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.swapon.de!news.in-chemnitz.de!news2.arglkargh.de!news.karotte.org!news.bawue.net!newsfeed.in-ulm.de!.POSTED!not-for-mail
From: spamless@gmx.de (Holger Schieferdecker)
Newsgroups: comp.text.tex
Subject: Re: pgfplots: link to top of embedded page
Date: Fri, 27 Sep 2024 14:50:02 +0200
Organization: [ posted via ] IN-Ulm
Message-ID: <vd69loU3b7quL1@usenet.in-ulm.de>
References: <vcrjpsU2ns40L1@usenet.in-ulm.de> <vd56ie$pqj6$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.in-ulm.de 19F0C6CB431E9D3283D30FA2AB302433
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
In-Reply-To: <vd56ie$pqj6$1@solani.org>
View all headers

Am 27.09.2024 um 04:51 schrieb Ulrich D i e z:
> Holger Schieferdecker wrote:
>
>> I include single page PDF documents with \includepdf. They have the same
>> size and aspect ratio as the output document (A4). With the option
>> "addtotoc" I can add an entry to the tableofcontents and the bookmarks.
>> But clicking on that doesn't jump to the top of the included page.
>>
>> It seems like the link target set by \includepdf is set with respect of
>> the page margins of the output document. I didn't find any hints in the
>> manual of pdfpages, besides that "addtotoc" is experimental. Is there a
>> way of positioning the link target at the top of the included pdf page?
>
> I think there is no official interface but you can hook into
> \includegraphics.

Many thanks for your help, that works. There is one difference in the
toc entries. These don't get a number. But I consider that even better.

In my case I have a section in an appendix where three pages are
included as subsection. There is no separate heading for each of them.
So numbers in the toc and bookmarks are not needed.

Holger

Subject: Re: pgfplots: link to top of embedded page
From: Ulrich D i e z
Newsgroups: comp.text.tex
Date: Sat, 28 Sep 2024 00:35 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ud.usenetcorrespondence@web.de (Ulrich D i e z)
Newsgroups: comp.text.tex
Subject: Re: pgfplots: link to top of embedded page
Date: Sat, 28 Sep 2024 02:35:29 +0200
Message-ID: <vd7j0j$voaf$1@solani.org>
References: <vcrjpsU2ns40L1@usenet.in-ulm.de> <vd56ie$pqj6$1@solani.org>
<vd69loU3b7quL1@usenet.in-ulm.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 28 Sep 2024 00:35:31 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1040719"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:OiLcgDaYOeMk+bmsc6KCVpFfPa8=
Content-Language: de-DE
X-User-ID: eJwFwYEBgDAIA7CXrNDCzhEY/59gQhPU4aKcy73o/FD97MBUw9xyvZVuROv0hC0v7p4Ylf0sXhGX
In-Reply-To: <vd69loU3b7quL1@usenet.in-ulm.de>
View all headers

Holger Schieferdecker wrote:

> Am 27.09.2024 um 04:51 schrieb Ulrich D i e z:
>> Holger Schieferdecker wrote:
>>
>>> I include single page PDF documents with \includepdf. They have the same
>>> size and aspect ratio as the output document (A4). With the option
>>> "addtotoc" I can add an entry to the tableofcontents and the bookmarks.
>>> But clicking on that doesn't jump to the top of the included page.
>>>
>>> It seems like the link target set by \includepdf is set with respect of
>>> the page margins of the output document. I didn't find any hints in the
>>> manual of pdfpages, besides that "addtotoc" is experimental. Is there a
>>> way of positioning the link target at the top of the included pdf page?
>>
>> I think there is no official interface but you can hook into
>> \includegraphics.
>
> Many thanks for your help, that works. There is one difference in the
> toc entries. These don't get a number. But I consider that even better.

If you wish numbered sections in the table of contents, then remove the
line

\addcontentsline{#1}{#2}{#3}%

right before

\NR@gettitle{#3}%

and replace each call to

\phantomsection

by

\refstepcounter{#2}%
\addcontentsline{#1}{#2}{\protect\numberline{\@currentlabel}#3}%

..

\documentclass{article}

\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{hyperref}

\makeatletter
\newif\iffirstpicture
\newcommand\HookIntoIncludegraphics[4]{%
\let\includegraphicscopy=\includegraphics
\def\includegraphics##1##{\MyIncludegraphicsB{##1}}%
\firstpicturetrue
\def\MyIncludegraphicsB##1##2{%
\ifnum
\iffirstpicture\pdfpages@includegraphics@status
\else 0\fi
=1 %
\global\firstpicturefalse
\vbox{%
\ifAM@landscape\else
\hbox{%
\kern-\baselineskip
\refstepcounter{#2}%
\addcontentsline{#1}{#2}{%
\protect\numberline{\@currentlabel}#3%
}%
}%
\hrule height 0pt
\fi
\hbox{\includegraphicscopy##1{##2}}%
\ifAM@landscape
\hrule height 0pt
\hbox{%
\def\HyperRaiseLinkDefault{-\baselineskip}%
\kern-\baselineskip
\refstepcounter{#2}%
\addcontentsline{#1}{#2}{%
\protect\numberline{\@currentlabel}#3%
}%
\kern\baselineskip
}%
\fi
\NR@gettitle{#3}%
\label{#4}%
}%
\else
\includegraphicscopy##1{##2}%
\fi
}%
}%
\makeatother

\begin{document}

\tableofcontents

\bigskip

\noindent \verb|\nameref|-links:

\bigskip

\nameref{sp:ex-a}%

\medskip

\nameref{sp:ex-b}%

\medskip

\nameref{sp:ex-c}%

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example A}{sp:ex-a}%
\includepdf[landscape, scale=0.97, pages=1]{testpictures.pdf}%
\endgroup

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example A, B, C}{sp:ex-b}%
\includepdf[scale=0.97, pages=-]{testpictures.pdf}%
\endgroup

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example B, C}{sp:ex-c}%
\includepdf[landscape, scale=0.97, pages=2-3]{testpictures.pdf}%
\endgroup

Nothing here.

\end{document}

Sincerely

Ulrich

Subject: Re: pgfplots: link to top of embedded page
From: Holger Schieferdecke
Newsgroups: comp.text.tex
Organization: [ posted via ] IN-Ulm
Date: Mon, 30 Sep 2024 09:32 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!news.bawue.net!newsfeed.in-ulm.de!.POSTED!not-for-mail
From: spamless@gmx.de (Holger Schieferdecker)
Newsgroups: comp.text.tex
Subject: Re: pgfplots: link to top of embedded page
Date: Mon, 30 Sep 2024 11:32:11 +0200
Organization: [ posted via ] IN-Ulm
Message-ID: <vddr6rU3p0jqL1@usenet.in-ulm.de>
References: <vcrjpsU2ns40L1@usenet.in-ulm.de> <vd56ie$pqj6$1@solani.org>
<vd69loU3b7quL1@usenet.in-ulm.de> <vd7j0j$voaf$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.in-ulm.de 1AC6E46194F8C017D7ADA02C6023E9B1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
In-Reply-To: <vd7j0j$voaf$1@solani.org>
View all headers

Am 28.09.2024 um 02:35 schrieb Ulrich D i e z:
> Holger Schieferdecker wrote:
>
>> Am 27.09.2024 um 04:51 schrieb Ulrich D i e z:
>>> Holger Schieferdecker wrote:
>>>
>>>> I include single page PDF documents with \includepdf. They have the same
>>>> size and aspect ratio as the output document (A4). With the option
>>>> "addtotoc" I can add an entry to the tableofcontents and the bookmarks.
>>>> But clicking on that doesn't jump to the top of the included page.
>>>>
>>>> It seems like the link target set by \includepdf is set with respect of
>>>> the page margins of the output document. I didn't find any hints in the
>>>> manual of pdfpages, besides that "addtotoc" is experimental. Is there a
>>>> way of positioning the link target at the top of the included pdf page?
>>>
>>> I think there is no official interface but you can hook into
>>> \includegraphics.
>>
>> Many thanks for your help, that works. There is one difference in the
>> toc entries. These don't get a number. But I consider that even better.
>
> If you wish numbered sections in the table of contents, then remove the
> line
>
> \addcontentsline{#1}{#2}{#3}%
>
> right before
>
> \NR@gettitle{#3}%
>
> and replace each call to
>
> \phantomsection
>
> by
>
> \refstepcounter{#2}%
> \addcontentsline{#1}{#2}{\protect\numberline{\@currentlabel}#3}%

Thank you very much. Now I have to decide which version I like better :-)

By the way, how fragile (or not fragile) is your solution? I mean, is it
likely to break with possible future changes of pdfpages or graphicx? Of
course one never knows what could change. But as far as I understand
your helper macro \HookIntoIncludegraphics I would assume it is rather
unlikely to break.

And finally I wonder why I wrote 'pgfplots' in the subject... :-/

Holger

Subject: Re: pgfplots: link to top of embedded page
From: Ulrich D i e z
Newsgroups: comp.text.tex
Date: Mon, 30 Sep 2024 19:48 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ud.usenetcorrespondence@web.de (Ulrich D i e z)
Newsgroups: comp.text.tex
Subject: Re: pgfplots: link to top of embedded page
Date: Mon, 30 Sep 2024 21:48:31 +0200
Message-ID: <vdevac$v20l$1@solani.org>
References: <vcrjpsU2ns40L1@usenet.in-ulm.de> <vd56ie$pqj6$1@solani.org>
<vd69loU3b7quL1@usenet.in-ulm.de> <vd7j0j$voaf$1@solani.org>
<vddr6rU3p0jqL1@usenet.in-ulm.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 30 Sep 2024 19:48:28 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1017877"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:sepI4EnwxrZHIKmMMbUu7Na0wII=
X-User-ID: eJwVxkkRwDAMA0BKPpUETiPV/CF0uq/thIOr0KienmDMc2imFO2q3pZ7jPB/M+zobgWQXEZ9MvkR3A==
Content-Language: en-US
In-Reply-To: <vddr6rU3p0jqL1@usenet.in-ulm.de>
View all headers

Holger Schieferdecker wrote:

> Thank you very much. Now I have to decide which version I like better :-)

You are welcome.

> By the way, how fragile (or not fragile) is your solution? I mean, is it
> likely to break with possible future changes of pdfpages or graphicx? Of
> course one never knows what could change. But as far as I understand
> your helper macro \HookIntoIncludegraphics I would assume it is rather
> unlikely to break.

I can't make any statements or predictions about what changes to the
pdfpages package are planned and how they will interfere with the macro
suggested by me. I also don't know what is planned for hyperref and the
LaTeX kernel - for example whether the current infrastructure for
cross-referencing and creating bookmarks will be retained in the
middle-term or long run.

However, since, when patching `\includegraphics` in the local scope,
only things are used that belong to the documented official interfaces,
I'm optimistic that changes under the hood on pdfpages/hyperref/the
LaTeX kernel in the near future won't affect the macro suggested by me.

But I would still like to say that my focus was more on a scenario where
a workaround is used to get a job done in the short term, not on a
permanent long-standing solution.

Sincerely

Ulrich

Subject: Re: pgfplots: link to top of embedded page
From: Holger Schieferdecke
Newsgroups: comp.text.tex
Organization: [ posted via ] IN-Ulm
Date: Wed, 30 Oct 2024 10:53 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!news.szaf.org!news.bawue.net!newsfeed.in-ulm.de!.POSTED!not-for-mail
From: spamless@gmx.de (Holger Schieferdecker)
Newsgroups: comp.text.tex
Subject: Re: pgfplots: link to top of embedded page
Date: Wed, 30 Oct 2024 11:53:57 +0100
Organization: [ posted via ] IN-Ulm
Message-ID: <vft384Uqrd7L1@usenet.in-ulm.de>
References: <vcrjpsU2ns40L1@usenet.in-ulm.de> <vd56ie$pqj6$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.in-ulm.de EFAF9A7328109E6208E0844C0303E83B
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
In-Reply-To: <vd56ie$pqj6$1@solani.org>
View all headers

Am 27.09.2024 um 04:51 schrieb Ulrich D i e z:
> Holger Schieferdecker wrote:
>
>> I include single page PDF documents with \includepdf. They have the same
>> size and aspect ratio as the output document (A4). With the option
>> "addtotoc" I can add an entry to the tableofcontents and the bookmarks.
>> But clicking on that doesn't jump to the top of the included page.
>>
>> It seems like the link target set by \includepdf is set with respect of
>> the page margins of the output document. I didn't find any hints in the
>> manual of pdfpages, besides that "addtotoc" is experimental. Is there a
>> way of positioning the link target at the top of the included pdf page?
>
> I think there is no official interface but you can hook into
> \includegraphics.

In the meantime I wrote to the author of pdfpages and asked if your
workaround could be used to create a solution internally in the package.
Unfortunately he found out that your macro has a problem. For the
landscape version a negative y coordinate is created. Some PDF viewers
like Evince and Atril he used for his test jump to the end of the page.
I used SumatraPDF and Adobe Reader which jump to the beginning of the
page like it is desired.

He also mentioned that some people use the geometry package and
temporarily change the type area. His suggestion was to use something like

\newgeometry{top=0pt, headheight=0pt, headsep=0pt, vscale=1}
\includepdf{file.pdf}

In my tests I tried with \newgeometry{margin=0pt}.

In the example below there are 4 documents embedded. Example A shows the
problem with the negative y coordinate for some viewers. Example C1 and
C2 are created with the help of geometry. This works for the landscape
document on a landscape page (C1), but not for the landscape document on
a portrait page (C2). Of course this is obvious as the page has no
margins and the link then is at the very top.

Anyway, I can solve my limited use case. There are just landscape
documents on a landscape page.

Holger

%%%%%%%%%%%%%%
\documentclass{article}

\usepackage{geometry}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{hyperref}

%% Get links to top of images included with \includepdf
%From: Ulrich D i e z <ud.usenetcorrespondence@web.de>
%Newsgroups: comp.text.tex
%Subject: Re: pgfplots: link to top of embedded page
%Date: Sat, 28 Sep 2024 02:35:29 +0200
%Message-ID: <vd7j0j$voaf$1@solani.org>
\makeatletter
\newif\iffirstpicture
\newcommand\HookIntoIncludegraphics[4]{%
\let\includegraphicscopy=\includegraphics
\def\includegraphics##1##{\MyIncludegraphicsB{##1}}%
\firstpicturetrue
\def\MyIncludegraphicsB##1##2{%
\ifnum
\iffirstpicture\csname pdfpages@includegraphics@status\endcsname
\else 0\fi
=1 %
\global\firstpicturefalse
\vbox{%
\ifAM@landscape\else
\hbox{%
\kern-\baselineskip
\refstepcounter{#2}%
\addcontentsline{#1}{#2}{%
\protect\numberline{\@currentlabel}#3%
}%
}%
\hrule height 0pt
\fi
\hbox{\includegraphicscopy##1{##2}}%
\ifAM@landscape
\hrule height 0pt
\hbox{%
\def\HyperRaiseLinkDefault{-\baselineskip}%
\kern-\baselineskip
\refstepcounter{#2}%
\addcontentsline{#1}{#2}{%
\protect\numberline{\@currentlabel}#3%
}%
\kern\baselineskip
}%
\fi
\NR@gettitle{#3}%
\label{#4}%
}%
\else
\includegraphicscopy##1{##2}%
\fi
}%
}%
\makeatother

\begin{document}

\tableofcontents

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example A}{sp:ex-a}%
\includepdf[landscape, scale=0.97]{example-image-a}
\endgroup

\begingroup
\HookIntoIncludegraphics{toc}{section}{Example B}{sp:ex-b}%
\includepdf[scale=0.97]{example-image-b}
\endgroup

\begingroup
\newgeometry{margin=0pt}
\includepdf[landscape, scale=0.97,
addtotoc={1, section, 1, Example C1, sp:ex-c1}]{example-image-c}

\includepdf[scale=0.97,
addtotoc={1, section, 1, Example C2, sp:ex-c2}]{example-image-c}
\endgroup

\clearpage

Nothing here.

\end{document}
%%%%%%%%%%%%%%%

1

rocksolid light 0.9.8
clearnet tor