% \iffalse meta-comment % % File: hypgotoe.dtx % Version: 2019/12/29 v0.3 % Info: Links to embedded files % % Copyright (C) % 2007 Heiko Oberdiek % 2016-2019 Oberdiek Package Support Group % https://github.com/ho-tex/oberdiek/issues % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3c of this license or (at your option) any later % version. This version of this license is in % https://www.latex-project.org/lppl/lppl-1-3c.txt % and the latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of % LaTeX version 2005/12/01 or later. % % This work has the LPPL maintenance status "maintained". % % The Current Maintainers of this work are % Heiko Oberdiek and the Oberdiek Package Support Group % https://github.com/ho-tex/oberdiek/issues % % This work consists of the main source file hypgotoe.dtx % and the derived files % hypgotoe.sty, hypgotoe.pdf, hypgotoe.ins, hypgotoe.drv, % hypgotoe-example.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/hypgotoe.dtx % CTAN:macros/latex/contrib/oberdiek/hypgotoe.pdf % % Unpacking: % (a) If hypgotoe.ins is present: % tex hypgotoe.ins % (b) Without hypgotoe.ins: % tex hypgotoe.dtx % (c) If you insist on using LaTeX % latex \let\install=y\input{hypgotoe.dtx} % (quote the arguments according to the demands of your shell) % % Documentation: % (a) If hypgotoe.drv is present: % latex hypgotoe.drv % (b) Without hypgotoe.drv: % latex hypgotoe.dtx; ... % The class ltxdoc loads the configuration file ltxdoc.cfg % if available. Here you can specify further options, e.g. % use A4 as paper format: % \PassOptionsToClass{a4paper}{article} % % Programm calls to get the documentation (example): % pdflatex hypgotoe.dtx % makeindex -s gind.ist hypgotoe.idx % pdflatex hypgotoe.dtx % makeindex -s gind.ist hypgotoe.idx % pdflatex hypgotoe.dtx % % Installation: % TDS:tex/latex/oberdiek/hypgotoe.sty % TDS:doc/latex/oberdiek/hypgotoe.pdf % TDS:doc/latex/oberdiek/hypgotoe-example.tex % TDS:source/latex/oberdiek/hypgotoe.dtx % %<*ignore> \begingroup \catcode123=1 % \catcode125=2 % \def\x{LaTeX2e}% \expandafter\endgroup \ifcase 0\ifx\install y1\fi\expandafter \ifx\csname processbatchFile\endcsname\relax\else1\fi \ifx\fmtname\x\else 1\fi\relax \else\csname fi\endcsname % %<*install> \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} \Msg{* Package: hypgotoe 2019/12/29 v0.3 Links to embedded files (HO)} \Msg{************************************************************************} \keepsilent \askforoverwritefalse \let\MetaPrefix\relax \preamble This is a generated file. Project: hypgotoe Version: 2019/12/29 v0.3 Copyright (C) 2007 Heiko Oberdiek 2016-2019 Oberdiek Package Support Group This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. This version of this license is in https://www.latex-project.org/lppl/lppl-1-3c.txt and the latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. This work has the LPPL maintenance status "maintained". The Current Maintainers of this work are Heiko Oberdiek and the Oberdiek Package Support Group https://github.com/ho-tex/oberdiek/issues This work consists of the main source file hypgotoe.dtx and the derived files hypgotoe.sty, hypgotoe.pdf, hypgotoe.ins, hypgotoe.drv, hypgotoe-example.tex. \endpreamble \let\MetaPrefix\DoubleperCent \generate{% \file{hypgotoe.ins}{\from{hypgotoe.dtx}{install}}% \file{hypgotoe.drv}{\from{hypgotoe.dtx}{driver}}% \usedir{tex/latex/oberdiek}% \file{hypgotoe.sty}{\from{hypgotoe.dtx}{package}}% \usedir{doc/latex/oberdiek}% \file{hypgotoe-example.tex}{\from{hypgotoe.dtx}{example}}% } \catcode32=13\relax% active space \let =\space% \Msg{************************************************************************} \Msg{*} \Msg{* To finish the installation you have to move the following} \Msg{* file into a directory searched by TeX:} \Msg{*} \Msg{* hypgotoe.sty} \Msg{*} \Msg{* To produce the documentation run the file `hypgotoe.drv'} \Msg{* through LaTeX.} \Msg{*} \Msg{* Happy TeXing!} \Msg{*} \Msg{************************************************************************} \endbatchfile % %<*ignore> \fi % %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{hypgotoe.drv}% [2019/12/29 v0.3 Links to embedded files (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2011/11/22] \begin{document} \DocInput{hypgotoe.dtx}% \end{document} % % \fi % % % % \GetFileInfo{hypgotoe.drv} % % \title{The \xpackage{hypgotoe} package} % \date{2019/12/29 v0.3} % \author{Heiko Oberdiek\thanks % {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}} % % \maketitle % % \begin{abstract} % Experimental package for links to embedded files. % \end{abstract} % % \tableofcontents % % \section{Documentation} % % \subsection{Introduction} % % This is a first experiment for links to embedded files. % The package \xpackage{hypgotoe} is named after the PDF action % name \texttt{/GoToE}. % Feedback is welcome, especially to the user interface. % \begin{itemize} % \item % Currently only embedded files and named destinations are supported. % \item % Missing are support for destination arrays and attachted files. % \item % Special characters aren't supported either. % \end{itemize} % In the future the package may be merged into package \xpackage{hyperref}. % % \subsection{User interface} % % \cs{href} is extended to detect the prefix `\texttt{gotoe:}'. % The part after the prefix is evaluated as key value list % from left to right. % For details, see ``8.5.3 Action Types, Embedded Go-To Actions'' % \cite{pdfspec}. % \begin{description} % \item[\xoption{dest}:] The destination name. The destination name % can be set by \cs{hypertarget} in the target document. Or check % the \xfile{.aux} file for destination names of \cs{label} commands. % Also the target PDF file can be inspected, look for \texttt{/Dests} % in the /Names entry of the catalog for named destinations. (Required.) % \item[\xoption{root}:] The file name of the root document. % (Optional.) % \item[\xoption{parent}:] Go to the parent document. (No value, optional.) % \item[\xoption{embedded}:] Go to the embedded document. The % value is the file name as it appears in /EmbeddedFiles of the current % document. % \end{description} % % The colors are controlled by \xpackage{hyperref}'s options % \xoption{gotoecolor} and \xoption{gotoebordercolor}. They can % be set in \cs{hypersetup}, for example. % Default is the color of file links. % % \subsection{Example} % % \begin{macrocode} %<*example> \NeedsTeXFormat{LaTeX2e} \RequirePackage{filecontents} \begin{filecontents}{hypgotoe-child.tex} \NeedsTeXFormat{LaTeX2e} \documentclass{article} \usepackage{hypgotoe}[2019/12/29] \begin{document} \section{This is the child document.} \href{gotoe:% dest={page.1},parent% }{Go to first page of main document}\\ \href{gotoe:% dest={page.2},parent% }{Go to second page of main document} \newpage \section{This is the second page of the child document.} \href{gotoe:% dest={page.1},parent% }{Go to first page of main document}\\ \href{gotoe:% dest={page.2},parent% }{Go to second page of main document} \hypertarget{foobar}{} Anker foobar is here. \end{document} \end{filecontents} \documentclass{article} \usepackage{hypgotoe}[2019/12/29] \usepackage{embedfile} \IfFileExists{hypgotoe-child.pdf}{% \embedfile{hypgotoe-child.pdf}% }{% \typeout{}% \typeout{--> Run hypgotoe-child.tex through pdflatex}% \typeout{}% } \begin{document} \section{First page of main document} \href{gotoe:% dest=page.1,embedded=hypgotoe-child.pdf% }{Go to first page of child document}\\ \href{gotoe:% dest=page.2,embedded=hypgotoe-child.pdf% }{Go to second page of child document}\\ \href{gotoe:% dest=foobar,embedded=hypgotoe-child.pdf% }{Go to foobar in child document} \newpage \section{Second page of main document} \href{gotoe:% dest=section.1,embedded=hypgotoe-child.pdf% }{Go to first section of child document}\\ \href{gotoe:% dest=section.2,embedded=hypgotoe-child.pdf% }{Go to second section of child document}\\ \href{gotoe:% dest=foobar,embedded=hypgotoe-child.pdf% }{Go to foobar in child document} \end{document} % % \end{macrocode} % % \StopEventually{ % } % % \section{Implementation} % % \subsection{Identification} % % \begin{macrocode} %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{hypgotoe}% [2019/12/29 v0.3 Links to embedded files (HO)]% % \end{macrocode} % % \subsection{Load packages} % % \begin{macrocode} \RequirePackage{iftex}[2019/11/07] \ifpdf \else \PackageError{hypgotoe}{% Other drivers than pdfTeX in PDF mode are not supported.% \MessageBreak Package loading is aborted% }\@ehc \expandafter\endinput \fi \RequirePackage{pdfescape}[2007/10/27] \RequirePackage{hyperref}[2019/12/29] % \end{macrocode} % % \subsection{Color support} % % \begin{macrocode} \define@key{Hyp}{gotoebordercolor}{% \HyColor@HyperrefBordercolor{#1}% \@gotoebordercolor{hyperref}{gotoebordercolor}% } \providecommand*{\@gotoecolor}{\@filecolor} \providecommand*{\@gotoebordercolor}{\@filebordercolor} % \end{macrocode} % % \subsection{Extend \cs{href}} % % \begin{macro}{\@hyper@readexternallink} % \begin{macrocode} \def\@hyper@readexternallink#1#2#3#4:#5:#6\\#7{% \ifx\\#6\\% \expandafter\@hyper@linkfile file:#7\\{#3}{#2}% \else \ifx\\#4\\% \expandafter\@hyper@linkfile file:#7\\{#3}{#2}% \else \def\@pdftempa{#4}% \ifx\@pdftempa\@pdftempwordfile \expandafter\@hyper@linkfile#7\\{#3}{#2}% \else \ifx\@pdftempa\@pdftempwordrun \expandafter\@hyper@launch#7\\{#3}{#2}% \else \ifx\@pdftempa\@pdftempwordgotoe \hyper@linkgotoe{#3}{#5}% \else \hyper@linkurl{#3}{#7\ifx\\#2\\\else\hyper@hash#2\fi}% \fi \fi \fi \fi \fi } % \end{macrocode} % \end{macro} % \begin{macro}{\@pdftempwordgotoe} % \begin{macrocode} \def\@pdftempwordgotoe{gotoe} % \end{macrocode} % \end{macro} % % \subsection{Implement gotoe action} % % \begin{macro}{\hyper@linkgotoe} % \begin{macrocode} \def\hyper@linkgotoe#1#2{% \begingroup \let\HyGoToE@Root\@empty \let\HyGoToE@Dest\@empty \let\HyGoToE@TBegin\@empty \let\HyGoToE@TEnd\@empty \setkeys{HyGoToE}{#2}% \leavevmode \pdfstartlink attr{% \Hy@setpdfborder \ifx\@pdfhightlight\@empty \else /H\@pdfhighlight \fi \ifx\@urlbordercolor\relax \else /C[\@urlbordercolor]% \fi }% user{% /Subtype/Link% /A<<% /Type/Action% /S/GoToE% \Hy@SetNewWindow \HyGoToE@Root \HyGoToE@Dest \HyGoToE@TBegin \HyGoToE@TEnd >>% }% \relax \Hy@colorlink\@gotoecolor#1% \close@pdflink \endgroup } % \end{macrocode} % \end{macro} % % \subsection{Keys for gotoe action} % % \begin{macrocode} \define@key{HyGoToE}{root}{% \EdefEscapeString\HyGoToE@temp{#1}% \edef\HyGoToE@Root{% /F<<% /Type/Filespec% /F(\HyGoToE@temp)% >>% }% } \define@key{HyGoToE}{dest}{% \EdefEscapeString\HyGoToE@temp{#1}% \edef\HyGoToE@Dest{% /D(\HyGoToE@temp)% }% } \define@key{HyGoToE}{parent}[]{% \def\HyGoToE@temp{#1}% \ifx\HyGoToE@temp\@empty \else \PackageWarning{hypgotoe}{Ignore value for `parent'}% \fi \edef\HyGoToE@TBegin{% \HyGoToE@TBegin /T<<% /R/P% }% \edef\HyGoToE@TEnd{% \HyGoToE@TEnd >>% }% } \define@key{HyGoToE}{embedded}{% \EdefEscapeString\HyGoToE@temp{#1}% \edef\HyGoToE@TBegin{% \HyGoToE@TBegin /T<<% /R/C% /N(\HyGoToE@temp)% }% \edef\HyGoToE@TEnd{% \HyGoToE@TEnd >>% }% } % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \section{Installation} % % \subsection{Download} % % \paragraph{Package.} This package is available on % CTAN\footnote{\CTANpkg{hypgotoe}}: % \begin{description} % \item[\CTAN{macros/latex/contrib/oberdiek/hypgotoe.dtx}] The source file. % \item[\CTAN{macros/latex/contrib/oberdiek/hypgotoe.pdf}] Documentation. % \end{description} % % % \paragraph{Bundle.} All the packages of the bundle `oberdiek' % are also available in a TDS compliant ZIP archive. There % the packages are already unpacked and the documentation files % are generated. The files and directories obey the TDS standard. % \begin{description} % \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}] % \end{description} % \emph{TDS} refers to the standard ``A Directory Structure % for \TeX\ Files'' (\CTANpkg{tds}). Directories % with \xfile{texmf} in their name are usually organized this way. % % \subsection{Bundle installation} % % \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the % TDS tree (also known as \xfile{texmf} tree) of your choice. % Example (linux): % \begin{quote} % |unzip oberdiek.tds.zip -d ~/texmf| % \end{quote} % % \subsection{Package installation} % % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting % \docstrip\ archive. The files are extracted by running the % \xfile{.dtx} through \plainTeX: % \begin{quote} % \verb|tex hypgotoe.dtx| % \end{quote} % % \paragraph{TDS.} Now the different files must be moved into % the different directories in your installation TDS tree % (also known as \xfile{texmf} tree): % \begin{quote} % \def\t{^^A % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % hypgotoe.sty & tex/latex/oberdiek/hypgotoe.sty\\ % hypgotoe.pdf & doc/latex/oberdiek/hypgotoe.pdf\\ % hypgotoe-example.tex & doc/latex/oberdiek/hypgotoe-example.tex\\ % hypgotoe.dtx & source/latex/oberdiek/hypgotoe.dtx\\ % \end{tabular}^^A % }^^A % \sbox0{\t}^^A % \ifdim\wd0>\linewidth % \begingroup % \advance\linewidth by\leftmargin % \advance\linewidth by\rightmargin % \edef\x{\endgroup % \def\noexpand\lw{\the\linewidth}^^A % }\x % \def\lwbox{^^A % \leavevmode % \hbox to \linewidth{^^A % \kern-\leftmargin\relax % \hss % \usebox0 % \hss % \kern-\rightmargin\relax % }^^A % }^^A % \ifdim\wd0>\lw % \sbox0{\small\t}^^A % \ifdim\wd0>\linewidth % \ifdim\wd0>\lw % \sbox0{\footnotesize\t}^^A % \ifdim\wd0>\linewidth % \ifdim\wd0>\lw % \sbox0{\scriptsize\t}^^A % \ifdim\wd0>\linewidth % \ifdim\wd0>\lw % \sbox0{\tiny\t}^^A % \ifdim\wd0>\linewidth % \lwbox % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \end{quote} % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's % TDS installing feature, then some files can already be in the right % place, see the documentation of \docstrip. % % \subsection{Refresh file name databases} % % If your \TeX~distribution % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh % these. For example, \TeX\,Live\ users run \verb|texhash| or % \verb|mktexlsr|. % % \subsection{Some details for the interested} % % \paragraph{Unpacking with \LaTeX.} % The \xfile{.dtx} chooses its action depending on the format: % \begin{description} % \item[\plainTeX:] Run \docstrip\ and extract the files. % \item[\LaTeX:] Generate the documentation. % \end{description} % If you insist on using \LaTeX\ for \docstrip\ (really, % \docstrip\ does not need \LaTeX), then inform the autodetect routine % about your intention: % \begin{quote} % \verb|latex \let\install=y\input{hypgotoe.dtx}| % \end{quote} % Do not forget to quote the argument according to the demands % of your shell. % % \paragraph{Generating the documentation.} % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate % the documentation. The process can be configured by the % configuration file \xfile{ltxdoc.cfg}. For instance, put this % line into this file, if you want to have A4 as paper format: % \begin{quote} % \verb|\PassOptionsToClass{a4paper}{article}| % \end{quote} % An example follows how to generate the % documentation with pdf\LaTeX: % \begin{quote} %\begin{verbatim} %pdflatex hypgotoe.dtx %makeindex -s gind.ist hypgotoe.idx %pdflatex hypgotoe.dtx %makeindex -s gind.ist hypgotoe.idx %pdflatex hypgotoe.dtx %\end{verbatim} % \end{quote} % % \begin{thebibliography}{9} % \bibitem{pdfspec} % Adobe Systems Incorporated: % \href{http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference.pdf}% % {\textit{PDF Reference, Sixth Edition, Version 1.7}},% % Oktober 2006; % \url{http://www.adobe.com/devnet/pdf/pdf_reference.html}. % % \end{thebibliography} % % \begin{History} % \begin{Version}{2007/10/30 v0.1} % \item % First experimental version. % \end{Version} % \begin{Version}{2016/05/16 v0.2} % \item % Documentation updates. % \end{Version} % \begin{Version}{2019/12/29 v0.3} % \item % \xpackage{iftex} package % \end{Version} % \end{History} % % \PrintIndex % % \Finale \endinput