% \iffalse meta-comment % % Copyright (C) 2007 by % Heiko Oberdiek % % 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 % http://www.latex-project.org/lppl/lppl-1-3c.txt % and the latest version of this license is in % http://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". % % This Current Maintainer of this work is Heiko Oberdiek. % % 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 \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 2007/10/30 v0.1 Experimental links to embedded files (HO)} \Msg{************************************************************************} \keepsilent \askforoverwritefalse \let\MetaPrefix\relax \preamble This is a generated file. Copyright (C) 2007 by Heiko Oberdiek 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 http://www.latex-project.org/lppl/lppl-1-3c.txt and the latest version of this license is in http://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". This Current Maintainer of this work is Heiko Oberdiek. 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}}% } \obeyspaces \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{* And install the following script file:} \Msg{*} \Msg{* } \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}% [2007/10/30 v0.1 Experimental links to embedded files (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2008/08/11] \begin{document} \DocInput{hypgotoe.dtx}% \end{document} % % \fi % % \CheckSum{163} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \GetFileInfo{hypgotoe.drv} % % \title{The \xpackage{hypgotoe} package} % \date{2007/10/30 v0.1} % \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}} % % \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}[2007/10/30] \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}[2007/10/30] \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}% [2007/10/30 v0.1 Experimental links to embedded files (HO)]% % \end{macrocode} % % \subsection{Load packages} % % \begin{macrocode} \RequirePackage{ifpdf}[2007/09/09] \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}[2007/10/30] % \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{\url{ftp://ftp.ctan.org/tex-archive/}}: % \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[\CTAN{install/macros/latex/contrib/oberdiek.tds.zip}] % \end{description} % \emph{TDS} refers to the standard ``A Directory Structure % for \TeX\ Files'' (\CTAN{tds/tds.pdf}). 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} % % \paragraph{Script installation.} % Check the directory \xfile{TDS:scripts/oberdiek/} for % scripts that need further installation steps. % Package \xpackage{attachfile2} comes with the Perl script % \xfile{pdfatfi.pl} that should be installed in such a way % that it can be called as \texttt{pdfatfi}. % Example (linux): % \begin{quote} % |chmod +x scripts/oberdiek/pdfatfi.pl|\\ % |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| % \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 % (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh % these. For example, \teTeX\ users run \verb|texhash| or % \verb|mktexlsr|. % % \subsection{Some details for the interested} % % \paragraph{Attached source.} % % The PDF documentation on CTAN also includes the % \xfile{.dtx} source file. It can be extracted by % AcrobatReader 6 or higher. Another option is \textsf{pdftk}, % e.g. unpack the file into the current directory: % \begin{quote} % \verb|pdftk hypgotoe.pdf unpack_files output .| % \end{quote} % % \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} % \end{History} % % \PrintIndex % % \Finale \endinput