diff options
Diffstat (limited to 'macros/latex/contrib/fitr')
20 files changed, 1733 insertions, 0 deletions
diff --git a/macros/latex/contrib/fitr/README.md b/macros/latex/contrib/fitr/README.md new file mode 100644 index 0000000000..5f7d97b5d5 --- /dev/null +++ b/macros/latex/contrib/fitr/README.md @@ -0,0 +1,35 @@ +The fitr Package +Author: D. P. Story +Version: v1.2d +Dated: 2016/04/04 + +This package is an implementation of the FitR view-type destination as +described in the PDF Reference. The package defines one new command +\jdRect. The command (optionally) sets a jump to and/or sets a destination +of a FitR (Rectangle). (Can you see where \jdRect comes from?). + +The package requires eforms (part of the AeB) and collectbox (by Martin +Scharrer). Drivers supported are dvips and dvipsone (using Adobe Distiller +as the PDF creator); pdftex (which includes luatex); and dvipdfm, +dvipdfmx, and xetex. + +The package was developed in response to a user of the AeB Bundle who was +interested in developing documents for students with low vision; the idea +is to magnify regions of the document so the student can read more +comfortably. Optional special effects are included (JavaScript functions) +to help focus one the rectangle as it is magnified, and as the previous +view is restored. + +Unpack the distribution by latexing fitr.ins. + +Enjoy! + +Now, I must get back to my retirement. + + +D. P. Story +www.acrotex.net +dpstory@uakron.edu +dpstory@acrotex.net + + diff --git a/macros/latex/contrib/fitr/doc/fitr_man.pdf b/macros/latex/contrib/fitr/doc/fitr_man.pdf Binary files differnew file mode 100644 index 0000000000..b70ee2656b --- /dev/null +++ b/macros/latex/contrib/fitr/doc/fitr_man.pdf diff --git a/macros/latex/contrib/fitr/doc/fitr_man.tex b/macros/latex/contrib/fitr/doc/fitr_man.tex new file mode 100644 index 0000000000..690f498f9a --- /dev/null +++ b/macros/latex/contrib/fitr/doc/fitr_man.tex @@ -0,0 +1,553 @@ +% makeindex < aebpro_man.idx > aebpro_man.ind +\documentclass{article} +\usepackage[fleqn]{amsmath} +\usepackage[ + web={centertitlepage,designv,forcolorpaper, + usesf,latextoc,pro}, %tight, + eforms,aebxmp +]{aeb_pro} +\usepackage{graphicx,array} +\usepackage[dvipsone,!preview,!viewMagWin]{fitr} +\usepackage[js=restoreHookBlink,js=jmpHookBlink]{lmacs} + +\usepackage[fortextbook,usecustomdesign,nomarginwrite]{eqexam} + +%\usepackage{myriadpro} +\usepackage[altbullet]{lucidbry} + +\renewcommand\allowFXDefault{false} + + +%\usepackage{makeidx} +%\makeindex +\usepackage{acroman} + +\makeatletter +\def\eq@fititin#1{\noindent\unskip\nobreak\hfill\penalty50 + \hskip2em\hbox{}\nobreak\hfill#1} +\def\fitit{\eq@fititin{\exrtnlabelformat}} +\@mparswitchfalse\reversemarginpar +\def\meta#1{$\langle\textit{\texttt{#1}}\rangle$} + +\makeatother +%\usepackage[active]{srcltx} + +\urlstyle{rm} +\def\fitrpkg{\textsf{f{i}tr}} + +\DeclareDocInfo +{ + university={\AcroTeX.Net}, + title={\texorpdfstring{The}{The manual for the} f{i}tr Package\texorpdfstring{\\ + Defining and Jumping to\\a Rectangular Destination}{}}, + author={D. P. Story}, + email={dpstory@acrotex.net}, + subject=Documentation for the fitr package, + talksite={\url{www.acrotex.net}}, + version={1.0}, + Keywords={LaTeX,PDF,fitr,JavaScript,Adobe Acrobat}, + copyrightStatus=True, + copyrightNotice={Copyright (C) \the\year, D. P. Story}, + copyrightInfoURL={http://www.acrotex.net} +} +\DeclareInitView{windowoptions={showtitle}} + + +\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\universityLayout{fontsize=Large} +\titleLayout{fontsize=LARGE} +\authorLayout{fontsize=Large} +\tocLayout{fontsize=Large,color=aeb} +\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb} +\subsectionLayout{indent=-31.25pt,color=aeb} +\subsubsectionLayout{indent=0pt,color=aeb} +\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}} + +%\pagestyle{empty} +\parindent0pt +\parskip\medskipamount + + +\definePath\bgPath{"C:/Users/Public/Documents/% + ManualBGs/Manual_BG_Print_AeB.pdf"} +\begin{docassembly} +\addWatermarkFromFile({% + bOnTop: false, + cDIPath: \bgPath +}) +\executeSave() +\end{docassembly} + +\begin{document} + +\maketitle + +\selectColors{linkColor=black} +\tableofcontents +\selectColors{linkColor=webgreen} + +\section{Introduction} + +This package is an implementation of the \textbf{FitR} view-type +destination. The \textsl{PDF Reference} describes \textbf{FitR} as, +\begin{quote} + Display the page designated by page, with its contents + magnified just enough to fit the rectangle specified by the + coordinates \textsl{left}, \textsl{bottom}, \textsl{right}, + and \textsl{top} entirely within the + window both horizontally and vertically. +\end{quote} +The package supports the \textsf{dvips}, \textsf{dvipsone}, and +\textsf{pdftex}, \textsf{luatex}, \textsf{dvipdfm}, \textsf{dvipdfmx}, and +\textsf{xetex} applications, the first two assume that \textbf{Adobe +Distiller} is the PDF creator. + +The only required packages are the \textsf{eforms} package (dated +2012/06/20 or later), which is part of the \textbf{AeB Bundle}, and +\textsf{collectbox} by Martin Scharrer, more on this package later, and +the ubiquitous \textsf{xcolor}.\footnote{The \textsf{eforms} package +itself brings in other packages, including \textsf{hyperref} and +\textsf{insdljs}.} + +The package was developed in response to a user of the AeB Bundle who was +interested in developing documents for students with low vision; the idea +is to magnify regions of the document so the student can read more +comfortably. The demonstration files are \texttt{fitr\_demo.tex} which +illustrates the package and some special methods for people with low +vision, and \texttt{fitr\_minimal.tex}, which is the same demo file with +any and extra package stripped out. + +\section{The Preamble and Package Options} + +The minimal preamble for this package is +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\usepackage[!meta(driver),!meta(options)]{fitr} +\end{Verbatim} +The \textsf{hyperref} package is brought in through the \textsf{eforms} package. +Optionally, {\fitrpkg} can be used with other members of AeB (\textsf{web} and +\textsf{exerquiz}, for example). + +Another package requirement is \textsf{collectbox} by Martin Scharrer; +quoting from the abstract of the documentation, +\begin{quote} +This package provides macros to collect and process an macro argument +(i.e. something which looks like a macro argument) as horizontal box +instead as a real macro argument. These ``arguments'' will be stored like +when using \cs{savebox}, \cs{sbox} or the \texttt{lrbox} environment and +allow verbatim or other special code. Instead of explicit braces also +implicit braces in the form of \cs{bgroup} and \cs{egroup} are supported.\dots +\end{quote} +The \cs{collectbox} command is used to collect the second argument of +\cs{jdRect}, see the discussion of \cs{jdRect} in Section~\ref*{jdRect}. +As a result, the second argument may contain verbatim text in it. Very cool. + +The package has ten options: six driver options and four viewing +options. +\begin{itemize} +\item \textbf{Driver Options:} These are \texttt{dvips} (the default), + \texttt{dvipsone}, and \texttt{pdftex} (which includes the use of + lualatex), \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex}. If you + specify one of the first two, it is assumed that you are using + \textbf{Adobe Distiller} as your PDF creator. + +\item[] The \textsf{fitr} package checks whether the \textsf{web} + package is loaded, if so, its uses the driver used by + \textsf{web}; otherwise \textsf{fitr} auto-detects for + \textsf{pdftex} and \textsf{xetex}. If no driver is passed, and + neither \textsf{pdftex} nor \textsf{xetex} are detected, then + \textsf{dvips} is the default driver. + +\item \textbf{Viewing Options:} When you specify \texttt{preview}, the +bounding boxes of the buttons are shown in the dvi-previewer (or the PDF +document); you can turn off this preview by specifying \texttt{!preview} +(or removing \texttt{preview} entirely from the option list). The other +option type is \texttt{viewMagWin}, when this option the viewing window, a +rectangular region, becomes visible in the dvi-previewer (or in the PDF +document); specifying \texttt{!viewMagWin} turns off this type of preview. + +\item[] The effects of the viewing options will be illustrated later in this +document, see \autoref{previewEx} on page~\pageref*{previewEx}. + +\end{itemize} + +\section{The one and only command}\label{jdRect} + +The {\fitrpkg} has only one command, \cs{jdRect}, but there are two forms +of usage. \cs{jdRect} optionally creates a push button or link, and +optionally creates a viewing window. The term \emph{viewing window} refers +to a rectangular region that is created by the \textbf{FitR} destination +viewing specification, see \textbf{Table~8.2 Destination syntax} of the +\textsl{PDF Reference}, version 1.7. A \emph{named destination} is created +and is associated with the viewing window. When we jump to a viewing +window, this window is magnified to the largest extent possible. For +example, click on the either of the two displayed forms of the syntax for +\cs{jdRect}; after jumping to the viewing window, click on the same +display to return to the previous view. + +%\previewtrue + +There are two versions of \cs{jdRect}, the command itself, and a +\texttt{*} version, \cs{jdRect*}. The syntax follows, along with the +expected parameters. +\begin{quote} + \jdRect*[adddestw=10bp,adddesth=10bp]{\cs{jdRect[\meta{key-values}]}} +\end{quote} +The above version is used to overlay a region with a button and view +window. No content is specified, but is defined by specifying the +\texttt{width} and \texttt{height}; it can be positioned using +\texttt{shift} and \texttt{lift}. + +There is a \texttt{*}-version as well: +\begin{quote} + \jdRect*[adddestw=10bp,adddesth=10bp]{\cs{jdRect*[\meta{key-values}]}\verb!{!\meta{content}\verb!}!} +\end{quote} +The second parameter \meta{content} is required when the \texttt{*} is +present. This version is meant to enclose \meta{content} within the button +and view window. The \texttt{width} and \texttt{height} keys are ignored, +but \texttt{shift} and \texttt{lift} are obeyed (though you may +\texttt{shift} or \texttt{lift} the button/view window away from the +content). + +Before illustrating the \cs{jdRect} command, we first discuss its +key-value pairs. +\begin{itemize} +\item \texttt{lift=\meta{length}}: This key-value lifts (raises) the + button/viewing window up (or down); for example, + \texttt{lift=15pt} (or \texttt{lift=-15pt}). The default is a lift + of \texttt{0pt}. See \autoref{displayEqEx} on page~\pageref*{displayEqEx}. + +\item \texttt{shift=\meta{length}}: The amount of horizontal shift; + positive to the right, negative to the left. For example, + \texttt{shift=-1in} shifts the button/viewing window 1 inch to the + left. The default is \texttt{0pt}. See + \autoref{displayEqEx} on page~\pageref*{displayEqEx}. + +\item \texttt{width=\meta{length}}: When using \cs{jdRect}---as + opposed to \cs{jdRect*}---, the width of the button and viewing + window is determined by the \texttt{width} key. For example + \texttt{width=1in} creates a button/viewing window that is 1 inch + wide. The value of this key is ignored when the \texttt{*} form of + the \cs{jdRect} is used. The default value is \texttt{0pt}. This + key is required when \texttt{*} is not present. See + \autoref{displayEqEx} on page~\pageref*{displayEqEx}. + +\item \texttt{height=\meta{length}}: Similar comments here as was made + for the \texttt{width} key. This key is 0used to set the height of + the button/viewing window. The default is 0pt. It is required when + \texttt{*} is not present. See \autoref{displayEqEx} on + page~\pageref*{displayEqEx}. + +\item \texttt{ref=t|c|b}: The \texttt{ref} key-value pair determines + the reference point of the button/viewing window. Permissible + values are \texttt{t} top (the default), \texttt{c} center, and + \texttt{b} bottom. This key is only obeyed with the \cs{jdRect*} + form of the command; otherwise, a reference point of \texttt{b} is + used. + +\item \texttt{adddestw=\meta{length}}: The default is for the viewing window to have +the same dimensions as the underlying button. The \texttt{adddestw} +key-value pair is used to widen the viewing window; \texttt{adddestw=.2in} +widens the window by \texttt{.2in} on the left and \texttt{.2in} on the +right. See Figure~\ref*{bvw}, page~\pageref*{bvw}. + +\item \texttt{adddesth=\meta{length}}: Similar to \texttt{adddestw} but for height. +The \texttt{adddesth} +key-value pair is used to increase the height the viewing window; \texttt{adddesth=.2in} +increases the height of the window by \texttt{.2in} on the top and \texttt{.2in} in the bottom. +See Figure~\ref*{bvw}, page~\pageref*{bvw}. +\begin{figure}[htb] +\begin{center}\setlength\fboxsep{0pt} + \fbox{\parbox[c][.9in]{2.4in} + {\vfill\hfil\fbox{\parbox[c][.5in]{2in}{\hfill\vfill}}\hfil\vfill}}\\[4pt] + \caption{Button and Viewing Window}\label{bvw} + {\small\texttt{width=2in,height=.5in,adddestw=.2in,adddesth=.2in}} +\end{center} +\end{figure} + +\item \texttt{button=true|false}: \texttt{button} is a Boolean switch. + If \texttt{true} (the default), \cs{jdRect} creates a push button. + When the user pushes the button, the viewer zooms in to the view + window. Clicking the same region again restores the previous view. + +\item[] When \texttt{button} is \texttt{false}, the button is not created, +but the viewing window is still created. You can then jump to the viewing +window with a separate link or button. When \texttt{button=false}, use the +\texttt{dest} key to assigned a numbed destination to viewing window. +({\fitrpkg} automatically creates the definition names internally, they +are used by the buttons. If no button is created, name the destination so +your know its name and can reference it in link that jumps to that viewing +area.) + + +\item \texttt{link=jmp|restore} If \texttt{link} has a value, then + {\fitrpkg} puts \texttt{button=false}. The \texttt{link} key is + used to create jumps or restore actions to or from a viewing + window. When \texttt{link=jmp} a jump action is created, the jump + will be to the value of the \texttt{dest} key. If this is a pure + link that jumps to another viewing window, then use the + \texttt{nodest} key as well; no viewing window will be created + around the link, as it is unlikely you'll want to jump to a link. + +\def\RungePic{\kern0pt\includegraphics[width=\marginparwidth]{runge}} +\def\jrOpts#1#2{link=#1,dest=#2} + +\item[] For example click on the link +\textbf{\jdRect*[nodest,\jrOpts{jmp}{rungePic},adddestw=10,adddesth=10]{Carl Runge}}% +\marginpar{\jdRect*[\jrOpts{restore}{rungePic},adddestw=\marginparsep, +adddesth=\marginparpush]{\parbox[t]{\marginparwidth}{\RungePic\\ +\normalcolor\centering\footnotesize\textsf{Carl Runge}}}} and jump to +the picture of Runge in the margin. Click on the picture of Runge and +return to the previous view. + +The jump to the picture from the text ``Carl Runge'' is as follows: +\begin{Verbatim}[xleftmargin=20pt] +\jdRect*[nodest,link=jmp,dest=rungePic, +adddestw=10bp,adddesth=10bp]{Carl Runge} +\end{Verbatim} +The important options are \texttt{nodest,link=jmp,dest=rungePic}; +no (named) viewing window is created, we want to create a jump link here, +the destination of the jump link is the destination \texttt{rungePic}. + +\item[] The color of the link is determined by \cs{@linkcolor}, a \textsf{hyperref} +command that holds a named color. This can be redefined at anytime, +directly using +\begin{Verbatim}[xleftmargin=20pt] +\makeatletter +\def\@linkcolor{blue} +\makeatother +\end{Verbatim} +or, if you are using the \texttt{pro} option with the \textsf{web} +package, you can say, +\begin{Verbatim}[xleftmargin=20pt] +\selectColors{linkColor=red} +\end{Verbatim} +When using the \textsf{web} package, the default is \texttt{webgreen}. + +\item[] The action to restore the previous view is as follows: +\begin{Verbatim}[xleftmargin=20pt] +\marginpar{\jdRect*[link=restore,dest=rungePic, + adddestw=\marginparsep,adddesth=\marginparpush + ]{\parbox[t]{\marginparwidth}{\RungePic\\ + \normalcolor\centering\footnotesize\textsf{Carl Runge}}}} +\end{Verbatim} +The picture is placed in the margin using \cs{marginpar}; the command +\cs{RungePic} is a convenience macro that uses \cs{includegraphics} in +import the picture. The important options are +\texttt{link=restore,dest=rungePic}, this first key-value pair causes +\cs{jdRect} to create a restore link, the second one says to create a +viewing window with a name of \texttt{rungePic}, this is the +destination the Carl Runge link jumps to. + + +\item \texttt{nodest}: A Boolean switch whose default value is + \texttt{false}. When \texttt{nodest} is used (making the switch a + value of \texttt{true}), no viewing window is created. + +\item \texttt{dest=\meta{name}}: This key is a way of explicitly naming the + viewing window (the destination). The destination is normally + automatically generated when \texttt{button=true}, this key is + used with the \texttt{link} key, as illustrated above. +\item \texttt{allowFX}: A Boolean switch (of sorts). The \texttt{fitr} + allows for special effects (FX) when a viewing window is jumped to + and when the view is restored. The default value of + \texttt{allowFX} is \texttt{true} allow special effects if there + is any defined. By saying \texttt{allowFX=false}, no special + effects are used, even if some are defined. + +\item[] An example of special effects you say? Try clicking on the + Pythagorean Theorem + \jdRect*[allowFX,adddestw=10bp,adddesth=10bp]{$ a^2 + b^2 = c^2 $} +\end{itemize} + +\section{Some Examples} + +\everymath{\displaystyle} + +In this section, several examples are presented that illustrate the +options of \cs{jdRect}. + +\begin{example}\label{previewEx}\previewtrue\viewMagWintrue +\textbf{Illustrate Preview Rectangles.} The \texttt{preview} and +\texttt{viewMagWin} options just set Boolean switches. In this example, we +manually gives these switches a value of \texttt{true} +(\cs{previewtrue}\cs{viewMagWintrue}). Take a close look at the following +function +\jdRect*{$ f(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^x e^{-t^2/2}\,\text{d}t$}, +or the more general form +\jdRect*[adddestw=20bp,adddesth=10bp]{$ f(x;\mu;\sigma) = \frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^x e^{-\frac{(t-\mu)^2}{2\sigma^2}}\,\text{d}t$} +The preview rectangles are shown: For the one on the left, the dimensions +of the push button and the viewing rectangle are the same; for one on the +right, the dimensions of the viewing window have been increased by +using \texttt{adddestw=20bp,adddesth=10bp}. When you jump to each of these +viewing windows, you the one on the left is magnified much more than the +one on the right; the larger viewing window allows the user to see some of +the surrounding text.\fitit +\end{example} + +\begin{example}\label{displayEqEx} +\textbf{Display Math.} Displayed math presents a problem. We take the +following set of equations to illustrate. + +Suppose we want to classify third order \textsf{Runge-Kutta} type methods. +Start with +\begin{align*} +\jdRect[height=1.3in,width=2.6in,lift=16pt,shift=-15pt, + adddestw=10bp,adddesth=10bp] +K_1 &= hf(t_n, y_n)\\ +K_2 &= hf(t_n +r h, y_n+aK_1)\\ +K_3 &= hf(t_n +s h, y_n+bK_1+cK_2)\\ +K &= w_1 K_1+ w_2 K_2+ w_3 K_3\\ +y_{n+1} &= y_n+K +\end{align*} +Find the system of equations satisfied by +\jdRect*[adddestw=10,adddesth=10]{$r,s, a, b, c, w_1, w_2, w_3$} +that will make the above algorithm a third order method. + +The verbatim listing of this set of aligned equations is +\begin{Verbatim}[xleftmargin=20pt,numbers=left] +\begin{align*} +\jdRect[height=1.3in,width=2.6in,lift=16pt,shift=-15pt, + adddestw=10bp,adddesth=10bp] +K_1 &= hf(t_n, y_n)\\ +K_2 &= hf(t_n +r h, y_n+aK_1)\\ +K_3 &= hf(t_n +s h, y_n+bK_1+cK_2)\\ +K &= w_1 K_1+ w_2 K_2+ w_3 K_3\\ +y_{n+1} &= y_n+K +\end{align*} +\end{Verbatim} +This is an example of \cs{jdRect} (the non-\texttt{*} version), so there +is no second argument. In this case, we create our button dimensions +using \texttt{height=1.3in,width=2.6in}, line~(2). Note the positioning +of the \cs{jdRect} command, the upper-left point of the display. We then +use \texttt{lift=16pt,shift=-15pt} to move the button around to cover the +equations, line~(2); finally, we increase the dimensions of the viewing +window in line~(3) with \texttt{adddestw=10bp,adddesth=10bp}. Now, how +were the values of these keys determined? By trial and error, while the +\texttt{preview} and \texttt{viewMagWin} options were in effect. Below are +the same equations with \cs{previewtrue} and \cs{viewMagWintrue}, locally +invoked:\previewtrue\viewMagWintrue +\begin{align*} +\jdRect[height=1.3in,width=2.6in,lift=16pt,shift=-15pt, + adddestw=10bp,adddesth=10bp] +K_1 &= hf(t_n, y_n)\\ +K_2 &= hf(t_n +r h, y_n+aK_1)\\ +K_3 &= hf(t_n +s h, y_n+bK_1+cK_2)\\ +K &= w_1 K_1+ w_2 K_2+ w_3 K_3\\ +y_{n+1} &= y_n+K +\end{align*} +The preview rectangles do not take up any {\TeX} space, so they overlap +parts of the paragraph content. When you zoom in, you'll see part of the +part of the word ``invoked:'', as seen in the upper-left corner, at least +according to the viewing window preview. Is it so? + +After you've set the position of the rectangles, and after all changes +have been made to the underlying content, you don't need the preview +modes.\fitit +\end{example} + +\begin{example}\label{CustomAppr} +\textbf{Customizing the appearance.} The properties of the underlying push button +is to be visible, but does not print. The background and the border are +transparent. The default properties are passed to the push button using a +presets command: +\begin{Verbatim}[xleftmargin=20pt] +\newcommand{\overlayPresets}{\H{I}\BG{}\BC{}\S{S}} +\end{Verbatim} +See the \textsf{eforms} manual for the meaning of these cryptic symbols. +You can modify these settings locally, within a group, or globally. In +this example, we change the border to red dashed line. We redefine +\cs{overlayPresets} as follows: +\begin{Verbatim}[numbers=left,xleftmargin=20pt] +\renewcommand{\overlayPresets}{\H{I}\BG{}\BC{red}\S{D}} +\end{Verbatim} +\renewcommand{\overlayPresets}{\H{I}\BG{}\BC{red}\S{D}}% +The changes are in line~(2), we say \verb!\BC{red}! (the \textsf{xcolor} package is +required here for named colors; otherwise, we would say \verb~\BC{1 0 0}~), +and we've change \verb!\S{S}! to \verb~\S{D}~, which gives a dashed +(\texttt{D}) border as opposed to a solid (\texttt{S}) border. Now to +illustrate this. My name is \jdRect*{D. P. Story!}; lets increase the +viewing window, shall we? My name is \jdRect*[adddestw=10bp,adddesth=10bp]{D. P. +Story!}. Keep in mind that we are overlaying a push button; if you want +the underlying text to have a color, you need to color it yourself: +\jdRect*[adddestw=10bp,adddesth=10bp]{\textcolor{blue}{D. P. Story}!} +This last button has code, +\begin{Verbatim}[xleftmargin=20pt] +\jdRect*[adddestw=10bp,adddesth=10bp]% + {\textcolor{blue}{D. P. Story}!} +\end{Verbatim} +As the changes to the preset appearance are inside a group, after this +example (environment)) \cs{overlayPresets} will revert to its definition +that was in effect outside the example.\fitit +\end{example} + +\section{Special Effects} + +For the standard set up, where there is a push button that overlays the +content along with the viewing window is jumps to, there are two +JavaScript ``hooks'' that can be exploited +\begin{itemize} + \item \texttt{overlayJmpHook()} is an undefined JavaScript + function that is executed after the jump to the viewing + window. (It is enclosed in a \texttt{try/catch} construct that + catches the error thrown.) The document author can define + \texttt{overlayJmpHook()} to perform some action following the + jump. The distribution of {\fitrpkg} comes with one + definition, \texttt{jmpHookBlink.js}, which blinks the border + following the jump. + \item \texttt{overlayRestoreHook()} is an undefined JavaScript + function that is executed following the restored view action. + The document author needs to make a custom definition if + special effects are desired. The distribution of {\fitrpkg} + comes with one definition, \texttt{restoreHookBlink.js}, + which blinks the border following the restore action. +\end{itemize} +The preamble of this document says, +\begin{Verbatim}[xleftmargin=20pt] +\usepackage[js=restoreHookBlink,js=jmpHookBlink]{lmacs} +\end{Verbatim} +The \textsf{lmacs} package is a new package I made available to CTAN, its +a simple package that imports files with extensions of \texttt{.def}, \texttt{.cfg}, and +\texttt{.js}. We import \texttt{restoreHookBlink.js} and +\texttt{jmpHookBlink.js} using a key-value method, where the key is one of +the supported extensions; thus \texttt{js=restoreHookBlink} will import +the file texttt{restoreHookBlink.js} if it exists. By the way, another +nice feature of \textsf{lmacs} is that you can prefix an exclamation point +(!) to cancel out that import, for example, if we wanted to use \texttt{jmpHookBlink} +but not \texttt{restoreHookBlink} we say +\begin{Verbatim}[xleftmargin=20pt] +\usepackage[!js=restoreHookBlink,js=jmpHookBlink]{lmacs} +\end{Verbatim} + +\begin{example}\label{fx}\renewcommand{\overlayPresets}{\H{I}\BG{}\BC{blue}\S{D}}% +\textbf{Special Effects.} Jump to the +\jdRect*[allowFX,adddestw=10bp,adddesth=10bp]{{\fitrpkg} Package!} + +The verbatim listing is +\begin{Verbatim}[xleftmargin=20pt,numbers=left] +\renewcommand{\overlayPresets}{\H{I}\BG{}\BC{blue}\S{D}}% +... +Jump to the \jdRect*[allowFX,adddestw=10bp,adddesth=10bp]% + {{\fitrpkg} Package!} +\end{Verbatim} +We redefined the \cs{overlayPresets} command, choosing an initial border +of blue. In line~(4), I've used \texttt{allowFX}, this key does not +normally to appear in the option list, its default value is normally +\texttt{true}; however, for this document, the following definition was +made in the preamble +\begin{Verbatim}[xleftmargin=20pt] +\renewcommand\allowFXDefault{false} +\end{Verbatim} +This (re)definition of \cs{allowFXDefault} sets the default value of +\texttt{allowFX} to \texttt{false}. This was done so the special effects +JavaScript functions could be imported (using \texttt{lmacs}) but their +effects would not be seen, by default. To see their effect, we have to +explicitly put \texttt{allowFX} to \texttt{true}, which is what the single +key does. (Or, you can say \texttt{allowFX=true}, but that is five more key +presses.)\fitit +\end{example} + +Now, I simply must get back to my retirement. \dps + +\end{document} diff --git a/macros/latex/contrib/fitr/examples/Kutta.bb b/macros/latex/contrib/fitr/examples/Kutta.bb new file mode 100644 index 0000000000..52e9f93c6c --- /dev/null +++ b/macros/latex/contrib/fitr/examples/Kutta.bb @@ -0,0 +1,5 @@ +%%Title: C:/Users/D. P. Story/Desktop/examples/kutta.pdf +%%Creator: extractbb 20120420 +%%BoundingBox: 0 0 242 326 +%%CreationDate: Wed Jun 27 19:32:23 2012 + diff --git a/macros/latex/contrib/fitr/examples/Kutta.eps b/macros/latex/contrib/fitr/examples/Kutta.eps Binary files differnew file mode 100644 index 0000000000..8ad5349e64 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/Kutta.eps diff --git a/macros/latex/contrib/fitr/examples/Kutta.jpeg b/macros/latex/contrib/fitr/examples/Kutta.jpeg Binary files differnew file mode 100644 index 0000000000..d847cb2a7e --- /dev/null +++ b/macros/latex/contrib/fitr/examples/Kutta.jpeg diff --git a/macros/latex/contrib/fitr/examples/Kutta.pdf b/macros/latex/contrib/fitr/examples/Kutta.pdf Binary files differnew file mode 100644 index 0000000000..e737d265d0 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/Kutta.pdf diff --git a/macros/latex/contrib/fitr/examples/Kutta.xbb b/macros/latex/contrib/fitr/examples/Kutta.xbb new file mode 100644 index 0000000000..f8d9a29fb9 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/Kutta.xbb @@ -0,0 +1,6 @@ +%%Title: C:/Users/D. P. Story/Desktop/examples/Kutta.jpeg +%%Creator: extractbb 20120420 +%%BoundingBox: 0 0 242 326 +%%HiResBoundingBox: 0.000000 0.000000 242.000000 326.000000 +%%CreationDate: Wed Jun 27 15:21:08 2012 + diff --git a/macros/latex/contrib/fitr/examples/fitr_demo.pdf b/macros/latex/contrib/fitr/examples/fitr_demo.pdf Binary files differnew file mode 100644 index 0000000000..9e43557892 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/fitr_demo.pdf diff --git a/macros/latex/contrib/fitr/examples/fitr_demo.tex b/macros/latex/contrib/fitr/examples/fitr_demo.tex new file mode 100644 index 0000000000..7fe7536f40 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/fitr_demo.tex @@ -0,0 +1,106 @@ +% +% This file works for Adobe Distiller as the PDF creator, with drivers dvips or dvipsone. +% It also works for pdftex (and luatex), dvipdfm, dvipdfmx, and xetex. +% +\documentclass[11pt]{article} +\usepackage{amsmath} +\usepackage[forcolorpaper,pro]{web} +\usepackage{eforms} +\usepackage[!preview,!viewMagWin]{fitr} +\usepackage[js=restoreHookBlink,js=jmpHookBlink]{lmacs} +\usepackage{graphicx} + +\DeclareDocInfo +{% + title={Jumping to a Rectangular Region}, + author={D. P. Story}, + university=My University, + talkdate={Dec.\ 17, \the\year}, + subject={Demo file to test the FitR view destination of PDF}, + keywords={LaTeX, PDF, Acrobat, JavaScript}, + university={% + Acro\!\TeX.Net\\ + NORTHWEST FLORIDA STATE COLLEGE\\ + Department of Mathematics}, + email={dpstory@acrotex.net}, + version={1.0}, + copyrightyears={2012} +} +\nocopyright +\norevisionLabel + +\selectColors{linkColor=blue} + +\parindent0pt \parskip6pt \pagestyle{empty} + +% \renewcommand{\overlayPresets}{\H{I}\S{D}\BG{}\BC{blue}} +% \renewcommand{\allowFXDefault}{false} + +\begin{document} +\begin{center}\sffamily\bfseries\Large\color{blue} + Jumping to a Rectangular Region\\[1ex]\normalsize\normalcolor + Dr. D. P. Story, \href{http://www.acrotex.net}{Acro\!\TeX.NeT} +\end{center} + +\textbf{Introduction.} This document demonstrates a technique designed to +help people with low vision read material by providing them with a +convenient way to magnify specific regions of the document. This is +especially useful for reading technical material such as mathematics, as +is demonstrated here. + +\textbf{Instructions:} Click on any of the mathematics to magnify a region +around it, the border will blink briefly to focus your attention on it. +To restore the previous view, click on the region again, +the formula is briefly highlighted by a blinking border so +can quickly find your place in the document. + + +\textbf{Sample Mathematical Text.} Consider the problem of numerically +solving the first order differential equation +\jdRect*[adddestw=60,adddesth=20]{$y'=f(t,y)$} on +\jdRect*[adddestw=1in,adddesth=30]{$[t_{start}, t_{end}]$}. Suppose we +want to classify third order \textsf{Runge-Kutta} type methods. Start with +\begin{align*} +\jdRect[height=1.3in,width=2.6in,lift=16pt,shift=-15pt,adddestw=10,adddesth=10] % +K_1 &= hf(t_n, y_n)\\ +K_2 &= hf(t_n +r h, y_n+aK_1)\\ +K_3 &= hf(t_n +s h, y_n+bK_1+cK_2)\\ +K &= w_1 K_1+ w_2 K_2+ w_3 K_3\\ +y_{n+1} &= y_n+K +\end{align*} +Find the system of equations satisfied by +\jdRect*[adddestw=10,adddesth=10]{$r,s, a, b, c, w_1, w_2, w_3$} +that will make the above algorithm a third order method. + +\textbf{Inline links.} Links can be provided within the text to jump to a +magnified region that needs to be inspected more closely. The links below +are different from the ones above. After jumping to a magnified rectangle, +restore the preview view by clicking on the rectangle. + +\def\RungePic{\includegraphics[width=\marginparwidth]{runge}} +\def\KuttaPic{\includegraphics[width=\marginparwidth]{Kutta}} +\def\jrOpts#1#2{link=#1,dest=#2} + +\textbf{\jdRect*[nodest,\jrOpts{jmp}{rungePic},adddestw=10,adddesth=10]{Carl Runge}}% +\marginpar{\jdRect*[\jrOpts{restore}{rungePic},adddestw=\marginparsep, +adddesth=\marginparpush]{\parbox[b]{\marginparwidth}{\RungePic\\ +\normalcolor\centering\footnotesize\textsf{Carl Runge}}}} (1867-1944) +was the third of four sons from a well-to-do German merchant family. He +is remembered for his \textsf{Runge-Kutta} method for solving +differential equations. + +\textbf{\jdRect*[nodest,\jrOpts{jmp}{KuttaPic}]{Martin Kutta}}% +\marginpar{\jdRect*[\jrOpts{restore}{KuttaPic},adddestw=\marginparsep, +adddesth=\marginparpush]{\parbox[b]{\marginparwidth}{\KuttaPic\\ +\normalcolor\centering\footnotesize\textsf{Martin Kutta}}}} (1867-1944) +extended the Runge's method of solving ordinary differential equations. He +is also known for his work on airfoils. + +% Again, don't forget to press +%\textbf{Alt+Left Arrow} to return to the view you had before you clicked +%on the link. + +\begin{flushright} +This work was motivated by Mohsen M. +\end{flushright} +\end{document} diff --git a/macros/latex/contrib/fitr/examples/fitr_minimal.tex b/macros/latex/contrib/fitr/examples/fitr_minimal.tex new file mode 100644 index 0000000000..160f38fa6d --- /dev/null +++ b/macros/latex/contrib/fitr/examples/fitr_minimal.tex @@ -0,0 +1,92 @@ +% +% This file works for Adobe Distiller as the PDF creator, with drivers dvips or dvipsone. +% It also works for pdftex (and luatex), dvipdfm, dvipdfmx, and xetex. +% +\documentclass[11pt]{article} +\usepackage{amsmath} +\usepackage[dvipsone,!preview,!viewMagWin]{fitr} +\usepackage[js=restoreHookBlink,js=jmpHookBlink]{lmacs} +\usepackage{graphicx} + +\hypersetup +{% + pdftitle={Jumping to a Rectangular Region}, + pdfauthor={D. P. Story}, + pdfsubject={Demo file to test the FitR view destination of PDF}, + pdfkeywords={LaTeX, PDF, Acrobat, JavaScript} +} + +\parindent0pt \parskip6pt \pagestyle{empty} + +% \renewcommand{\overlayPresets}{\H{I}\S{D}\BG{}\BC{blue}} +% \renewcommand{\allowFXDefault}{false} + +\begin{document} + +\begin{center}\sffamily\bfseries\Large + Jumping to a Rectangular Region\\[1ex]\normalsize\normalcolor + Dr. D. P. Story, \href{http://www.acrotex.net}{Acro\!\TeX.NeT} +\end{center} + +\textbf{Introduction.} This document demonstrates a technique designed to +help people with low vision read material by providing them with a +convenient way to magnify specific regions of the document. This is +especially useful for reading technical material such as mathematics, as +is demonstrated here. + +\textbf{Instructions:} Click on any of the mathematics to magnify a region +around it, the border will blink briefly to focus your attention on it. +To restore the previous view, click on the region again, +the formula is briefly highlighted by a blinking border so +can quickly find your place in the document. + + +\textbf{Sample Mathematical Text.} Consider the problem of numerically +solving the first order differential equation +\jdRect*[adddestw=60,adddesth=20]{$y'=f(t,y)$} on +\jdRect*[adddestw=1in,adddesth=30]{$[t_{start}, t_{end}]$}. Suppose we +want to classify third order \textsf{Runge-Kutta} type methods. Start with +\begin{align*} +\jdRect[height=1.3in,width=2.6in,lift=16pt,shift=-15pt,adddestw=10,adddesth=10] % +K_1 &= hf(t_n, y_n)\\ +K_2 &= hf(t_n +r h, y_n+aK_1)\\ +K_3 &= hf(t_n +s h, y_n+bK_1+cK_2)\\ +K &= w_1 K_1+ w_2 K_2+ w_3 K_3\\ +y_{n+1} &= y_n+K +\end{align*} +Find the system of equations satisfied by +\jdRect*[adddestw=10,adddesth=10]{$r,s, a, b, c, w_1, w_2, w_3$} +that will make the above algorithm a third order method. + +\textbf{Inline links.} Links can be provided within the text to jump to a +magnified region that needs to be inspected more closely. The links below +are different from the ones above. After jumping to a magnified rectangle, +restore the preview view by clicking on the rectangle. + +\def\RungePic{\includegraphics[width=\marginparwidth]{runge}} +\def\KuttaPic{\includegraphics[width=\marginparwidth]{Kutta}} +\def\jrOpts#1#2{link=#1,dest=#2} + +\textbf{\jdRect*[nodest,\jrOpts{jmp}{rungePic},adddestw=10,adddesth=10]{Carl Runge}}% +\marginpar{\jdRect*[\jrOpts{restore}{rungePic},adddestw=\marginparsep, +adddesth=\marginparpush]{\parbox[b]{\marginparwidth}{\RungePic\\ +\normalcolor\centering\footnotesize\textsf{Carl Runge}}}} (1867-1944) +was the third of four sons from a well-to-do German merchant family. He +is remembered for his \textsf{Runge-Kutta} method for solving +differential equations. + +\textbf{\jdRect*[nodest,\jrOpts{jmp}{KuttaPic}]{Martin Kutta}}% +\marginpar{\jdRect*[\jrOpts{restore}{KuttaPic},adddestw=\marginparsep, +adddesth=\marginparpush]{\parbox[b]{\marginparwidth}{\KuttaPic\\ +\normalcolor\centering\footnotesize\textsf{Martin Kutta}}}} (1867-1944) +extended the Runge's method of solving ordinary differential equations. He +is also known for his work on airfoils. + +% Again, don't forget to press +%\textbf{Alt+Left Arrow} to return to the view you had before you clicked +%on the link. + +\begin{flushright} +This work was motivated by Mohsen M. +\end{flushright} +\end{document} diff --git a/macros/latex/contrib/fitr/examples/jmpHookBlink.js b/macros/latex/contrib/fitr/examples/jmpHookBlink.js new file mode 100644 index 0000000000..c6ea043e77 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/jmpHookBlink.js @@ -0,0 +1,41 @@ +% +% This script hooks into the DLJS of fitr to blink the field +% border when the user clicks in it. Length of the blink +% is 1250 milli-seconds. +% +\begin{insDLJS}[overlayJmpHook]{jfitr}{Blink border after jump} +function overlayJmpHook(event) { + toggleBC.field=event.target; + toggleBC.field=event.target; + toggleBC.startColor=event.target.strokeColor; + toggleBC.altColor=(color.equal(toggleBC.startColor,color.transparent))?% +color.red:color.transparent; + oSIJ=app.setInterval("toggleBC();",250); + oTOJ=app.setTimeOut("app.clearInterval(oSIJ); resetBC();",1250); +} +if (typeof toggleBC != "function" ) { + function toggleBC() { + var oField=toggleBC.field; + oField.strokeColor=% + (color.equal(oField.strokeColor,toggleBC.startColor))?% +toggleBC.altColor:toggleBC.startColor; + } + function resetBC() { + toggleBC.field.strokeColor=toggleBC.startColor; + } +} +\end{insDLJS} +\endinput + +function toggleBC() { + var oField=toggleBC.field; + oField.strokeColor=% +(color.equal(oField.strokeColor,toggleBC.startColor))?% +toggleBC.altColor:toggleBC.startColor; +} + +%function toggleBC() { +% var oField=toggleBC.field; +% oField.strokeColor=% +%(color.equal(oField.strokeColor,color.transparent))?color.red:color.transparent; +%} diff --git a/macros/latex/contrib/fitr/examples/restoreHookBlink.js b/macros/latex/contrib/fitr/examples/restoreHookBlink.js new file mode 100644 index 0000000000..77f6077ee4 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/restoreHookBlink.js @@ -0,0 +1,33 @@ +% +% This script hooks into the DLJS of fitr to blink the field +% border when the user clicks in it. Length of the blink +% is 1250 milli-seconds. +% +\begin{insDLJS}[overlayRestoreHook]{rfitr}{Blink border on restore} +function overlayRestoreHook(event,bRestore) { + if (!bRestore) return; + toggleBC.field=event.target; + toggleBC.startColor=event.target.strokeColor; + toggleBC.altColor=(color.equal(toggleBC.startColor,color.transparent))?% +color.red:color.transparent; + oSIR=app.setInterval("toggleBC();",250); + oTOR=app.setTimeOut("app.clearInterval(oSIR); resetBC();",1250); +} +if (typeof toggleBC != "function" ) { + function toggleBC() { + var oField=toggleBC.field; + oField.strokeColor=% + (color.equal(oField.strokeColor,toggleBC.startColor))?% +toggleBC.altColor:toggleBC.startColor; + } + function resetBC() { + toggleBC.field.strokeColor=toggleBC.startColor; + } +} +\end{insDLJS} +\endinput +function toggleBC() { + var oField=toggleBC.field; + oField.strokeColor=% +(color.equal(oField.strokeColor,color.transparent))?color.red:color.transparent; +} diff --git a/macros/latex/contrib/fitr/examples/runge.bb b/macros/latex/contrib/fitr/examples/runge.bb new file mode 100644 index 0000000000..fc1a526a84 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/runge.bb @@ -0,0 +1,5 @@ +%%Title: C:/Users/D. P. Story/Desktop/examples/runge.pdf +%%Creator: extractbb 20120420 +%%BoundingBox: 0 0 269 326 +%%CreationDate: Wed Jun 27 19:32:48 2012 + diff --git a/macros/latex/contrib/fitr/examples/runge.eps b/macros/latex/contrib/fitr/examples/runge.eps Binary files differnew file mode 100644 index 0000000000..283816eabd --- /dev/null +++ b/macros/latex/contrib/fitr/examples/runge.eps diff --git a/macros/latex/contrib/fitr/examples/runge.jpg b/macros/latex/contrib/fitr/examples/runge.jpg Binary files differnew file mode 100644 index 0000000000..db05c74bf0 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/runge.jpg diff --git a/macros/latex/contrib/fitr/examples/runge.pdf b/macros/latex/contrib/fitr/examples/runge.pdf Binary files differnew file mode 100644 index 0000000000..85ee459f91 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/runge.pdf diff --git a/macros/latex/contrib/fitr/examples/runge.xbb b/macros/latex/contrib/fitr/examples/runge.xbb new file mode 100644 index 0000000000..6475eae1e0 --- /dev/null +++ b/macros/latex/contrib/fitr/examples/runge.xbb @@ -0,0 +1,6 @@ +%%Title: C:/Users/D. P. Story/Desktop/examples/runge.jpg +%%Creator: extractbb 20120420 +%%BoundingBox: 0 0 269 326 +%%HiResBoundingBox: 0.000000 0.000000 268.800000 326.400000 +%%CreationDate: Wed Jun 27 15:21:16 2012 + diff --git a/macros/latex/contrib/fitr/fitr.dtx b/macros/latex/contrib/fitr/fitr.dtx new file mode 100644 index 0000000000..eabd27e925 --- /dev/null +++ b/macros/latex/contrib/fitr/fitr.dtx @@ -0,0 +1,790 @@ +%\iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% fitr.sty package, 2016-04-04 %% +%% Copyright (C) 2012--2016 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%</copyright> +%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01] +%<package>\ProvidesPackage{fitr} +%<package> [2016/04/09 v1.2e Support for FitR destinations (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex]{hyperref} +\usepackage{fancyvrb,array,calc} +%\pdfstringdefDisableCommands{\let\\\textbackslash} +%\EnableCrossrefs \CodelineIndex +\RecordChanges +\bgroup\ttfamily +\gdef\brpr#1{\char123\relax#1\char125\relax}\egroup +\def\ameta#1{\ensuremath{\langle\textsl{\texttt{#1}}\rangle}} +\def\meta#1{\textsl{\texttt{#1}}} +\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}} +\def\cs#1{\texttt{\bslash#1}} +\DeclareRobustCommand{\tmspace}[3]{% + \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} +\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} +\let\thinspace\, +\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} +\let\negthinspace\! +\renewcommand{\:}{\tmspace+\medmuskip{.2222em}} +\let\medspace\: +\newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} +\renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} +\let\thickspace\; +\newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} +\makeatletter +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\renewenvironment{quote}[1][] + {\def\@rgi{#1}\ifx\@rgi\@empty + \let\rghtm\@empty\else\def\rghtm{\rightmargin\leftmargin}\fi + \list{}{\rghtm} %{\rightmargin\leftmargin}% + \item\relax} + {\endlist} +\makeatother +\begin{document} +\def\CMD#1{\textbackslash#1} + \GetFileInfo{fitr.sty} + \title{\textsf{fitr}: Creating \textsf{FitR} Destinations} + \author{D. P. Story\\ + Email: \texttt{dpstory@acrotex.net}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \renewenvironment{theglossary}{% + \let\efill\relax + \begin{itemize}}{\end{itemize}} + \value{GlossaryColumns}=1 + \DocInput{fitr.dtx} + \PrintIndex +\end{document} +%</driver> +% \fi +% \MakeShortVerb{|} +% \StopEventually{} +% +% \DoNotIndex{\def,\edef,\gdef,\xdef,\global,\long,\let} +% \DoNotIndex{\expandafter,\string,\the,\ifx,\else,\fi} +% \DoNotIndex{\csname,\endcsname,\relax,\begingroup,\endgroup} +% \DoNotIndex{\DeclareTextCommand,\DeclareTextCompositeCommand} +% \DoNotIndex{\space,\@empty,\special} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% +% \paragraph*{Introduction.} +% +% This package supports \textsf{dvips} and \textsf{dvipsone} utilities, +% and assumes the PDF creator is \textbf{Adobe Distiller}. It also supports +% the \textsf{pdflatex} (and lualatex) executable through the \texttt{pdftex} option; +% the options \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex} support the +% corresponding executables. +% +% When using a dvi-ps-pdf work flow (with Distiller as the PDF creator), the +% package uses the \textbf{pdfmark} for the \textsf{FitR} view-type destination: +%\begin{verbatim} +% [ /Dest/<name>/View [ /FitR left bottom right top ]/DEST pdfmark +%\end{verbatim} +% For the \texttt{pdftex} option, we use \cs{pdfdest} a primitive of +% that utility: +%\begin{verbatim} +% \pdfdest name {<name>} fitr +% width <width> +% height <height> +% depth <depth> +%\end{verbatim} +% For the \texttt{dvipdfm}, \texttt{dvipdfmx}, and \texttt{xetex} options, +% the problem of computing the \textsf{FitR} rectangle is a little trickier. +%\medskip\noindent +%The \textsl{PDF Reference} describes \textsf{FitR} as, +%\begin{quote} +% Display the page designated by page, with its contents +% magnified just enough to fit the rectangle specified by the +% coordinates \textsl{left}, \textsl{bottom}, \textsl{right}, and \textsl{top} entirely within the +% window both horizontally and vertically. +%\end{quote} +% This type of destination allows for the creation of a link or form button +% to zoom in on a rectangular region. +% +% \section{Options and Required Packages} +% \begin{macrocode} +\RequirePackage{xkeyval} +\RequirePackage{ifpdf}[2006/02/20] +\RequirePackage{ifxetex}[2006/08/21] +% \end{macrocode} +% \paragraph*{Driver options.} Three options, \DescribeMacro{dvips, dvipsone}\texttt{dvips} (the default) +% and \texttt{dvipsone}, both of which require \textbf{Adobe Distiller} +% as the PDF creator; the \DescribeMacro{pdftex}\texttt{pdftex} allows for the same functionality +% for the \textsf{pdflatex} executable. We also support \DescribeMacro{dvipdfm,dvipdfmx,xetex}\texttt{dvipdfm} +% and its extensions, \texttt{dvipdfmx} and \texttt{xetex}. +% +% \paragraph*{Preview options.} The \DescribeMacro{preview}\texttt{preview} +% option is a carry over from \textsf{eforms}. When selected, all form fields are outlined; useful when +% setting the location of fields in a dvi previewer. The other option is \texttt{viewMagWin} +% \DescribeMacro{viewMagWin} will show the viewing windows surrounding the target. This is the rectangle +% that will be jumped to. Use this option to adjust the size of the window to your needs. +% When either of the last two options has an exclamation point prior, that means to +% turn off the switch. You can conveniently use \texttt{viewMagWin} to see the viewing window, +% then change it to \DescribeMacro{!viewMagWin}\texttt{!viewMagWin} to remove the visible window. Cool. +% Similarly, you can turn off \texttt{preview} using \DescribeMacro{!preview}\texttt{!preview}. +% \begin{macrocode} +% \end{macrocode} +% We create the \cs{ifpreview} and \cs{ifviewMagWin}, and declare the options. +% \begin{macrocode} +\@ifundefined{ifpreview}{\newif\ifpreview \previewfalse}{} +\@ifundefined{ifviewMagWin}{\newif\ifviewMagWin \viewMagWinfalse}{} +\let\fitr@driver\@empty +\DeclareOptionX{pdftex}{\gdef\fitr@driver{pdftex}% + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@pdftex@driver{pdftex} +% \end{macrocode} +% Distiller based drivers. +% \begin{macrocode} +\DeclareOptionX{dvips}{\gdef\fitr@driver{dvips}% + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvips@driver{dvips} +\DeclareOptionX{dvipsone}{\gdef\fitr@driver{dvipsone}% + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvipsone@driver{dvipsone} +% \end{macrocode} +% \textsf{dvipdfm} and its variants. +% \begin{macrocode} +\newif \if@fitr@dvipdfm \@fitr@dvipdfmfalse +\DeclareOptionX{dvipdfm}{\gdef\fitr@driver{dvipdfm}% + \@fitr@dvipdfmtrue + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvipdfm@driver{dvipdfm} +\DeclareOptionX{dvipdfmx}{\gdef\fitr@driver{dvipdfmx}% + \@fitr@dvipdfmtrue + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@dvipdfmx@driver{dvipdfmx} +\DeclareOptionX{xetex}{\gdef\fitr@driver{xetex}% + \@fitr@dvipdfmtrue + \PassOptionsToPackage{\fitr@driver}{hyperref}% + \PassOptionsToPackage{\fitr@driver}{eforms}% +} +\def\fitr@xetex@driver{xetex} +% \end{macrocode} +% \begin{macrocode} +\DeclareOptionX{preview}{\previewtrue} +\DeclareOptionX{!preview}{\previewfalse} +\DeclareOptionX{viewMagWin}{\viewMagWintrue} +\DeclareOptionX{!viewMagWin}{\viewMagWinfalse} +% \end{macrocode} +% Before processing options, try for automatic driver detection. +% \begin{macrocode} +\@ifpackageloaded{web}{% + \ExecuteOptionsX{\eq@driver@name}% +}{% + \ifpdf\ExecuteOptionsX{pdftex}\else + \ifxetex\ExecuteOptionsX{xetex}\fi\fi +} +% \end{macrocode} +% Process the options +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{xcolor} +\ifx\fitr@driver\@empty + \def\fitr@driver{dvips} + \def\fitr@loadPkgs{% + \RequirePackage[dvips]{hyperref} + \RequirePackage[dvips]{eforms}}% +\else + \def\fitr@loadPkgs{% + \RequirePackage{hyperref} + \RequirePackage{eforms}[2016/04/05]} +\fi +\fitr@loadPkgs +% \end{macrocode} +% Minimal packages \textsf{calc} and \textsf{eforms} (which inputs \textsf{hyperref}). +% \begin{macrocode} +\RequirePackage{calc} +% \end{macrocode} +% We also require \textsf{collectbox}, a cool way of collecting an argument which enables +% the use of verbatim text. Written by Martin Scharrer. +% \begin{macrocode} +\RequirePackage{collectbox} +% \end{macrocode} +% \section{The Main Code} +% Some scratch counters, lengths, boxes. +% \begin{macrocode} +\newcounter{magCnt} +\newbox\fitr@bbox +\newcount\fitr@height \newcount\fitr@width \newcount\fitr@depth +\newlength\fitr@length +% \end{macrocode} +% \begin{macro}{\get@fitr@dimen} +% \cs{get@fitr@dimen}\verb!{!\meta{content}\verb!}!: this command encloses \meta{content} +% in the box register \cmd{\fitr@bbox} (an \cs{hbox}) and transfers +% dimension info to the count registers \cmd{\fitr@height}, +% \cmd{\fitr@width}, and \cmd{\fitr@depth}, To typeset \meta{content} you must +% \cmd{\unhbox}\cmd{\fitr@bbox}. +% \begin{macrocode} +\def\get@fitr@dimen#1{% + \setbox\fitr@bbox=\hbox{#1}% + \fitr@height=\ht\fitr@bbox + \xdef\fitr@height@l{\the\ht\fitr@bbox}% + \fitr@width=\wd\fitr@bbox + \xdef\fitr@width@l{\the\wd\fitr@bbox}% + \fitr@depth=\dp\fitr@bbox + \xdef\fitr@depth@l{\the\dp\fitr@bbox}% + \setlength\fitr@length{\ht\fitr@bbox+\dp\fitr@bbox}% + \edef\fitr@@height{\the\fitr@length}% +} +% \end{macrocode} +% \end{macro} +% The following commands are some PostScript for the \textsf{dvips} executable. +% +% \paragraph*{dvips.} +% Uses \cmd{\fitr@bbox}; \texttt{\#1} is amount to widen box; \texttt{\#2} amount to heighten box. +% \begin{macrocode} +\def\fitr@urxury@fixup#1#2#3{} +\ifx\fitr@driver\fitr@dvips@driver +\headerps@out{/TeXtoPDF {65536 div DVImag mul} def % sp to pts +/SPtoDvips{TeXtoPDF PDFToDvips} def} % dp to dots +\def\FitRbboxB#1#2{% Uses \fitr@bbox + currentpoint 2 copy DvipsToPDF \the\fitr@depth\space TeXtoPDF add + neg vsize add 72 sub #2\space sub exch % y1 + DvipsToPDF 72 add #1\space sub exch % x1 + 4 2 roll exch DvipsToPDF \the\fitr@width\space + TeXtoPDF add 72 add #1\space add exch % x2 + DvipsToPDF \the\fitr@height \space TeXtoPDF sub + neg vsize add 72 sub #2\space add} % y2 +\else\ifx\fitr@driver\fitr@dvipsone@driver +% \end{macrocode} +% \paragraph*{dvipsone.} Uses \cmd{\fitr@bbox}; \texttt{\#1} is amount to widen box; \texttt{\#2} amount to heighten box. +% \begin{macrocode} +\special{!/TeXtoPDF {65536 div mag 1000 div mul} def +/PDFtoTeX {65536 mul mag 1000 div div} def} +\def\FitRbboxB#1#2{% + currentpoint 2 copy \the\fitr@depth\space add DvipsToPDF + neg PageHeight add 72 sub #2\space sub % y1 + exch DvipsToPDF 72 add #1\space sub exch % x1 + 4 2 roll exch \the\fitr@width\space add + DvipsToPDF 72 add #1\space add exch % x2 + \the\fitr@height\space sub DvipsToPDF neg + PageHeight add 72 sub #2\space add} % y2 +\else\ifx\fitr@driver\fitr@pdftex@driver +% \end{macrocode} +% \paragraph*{pdftex.} +% Uses \cmd{\fitr@bbox}; \texttt{\#1} is amount to widen box; +% \texttt{\#2} amount to heighten box. +% +% This version of \cs{FitRbbox} expands the bounding rectangle to +% the viewing window by increasing the dimensions of width, height +% and depth. It saves these values in the macros +% \cs{fitr@pdftex@view@width\string|height\string|depth}. +% \begin{macrocode} +\def\FitRbboxB#1#2{% + \fitr@length=#1bp + \fitr@length=2\fitr@length + \advance\fitr@length\wd\fitr@bbox + \edef\fitr@pdftex@view@width{\the\fitr@length}% + \fitr@length=#2bp + \advance\fitr@length\ht\fitr@bbox + \edef\fitr@pdftex@view@height{\the\fitr@length}% + \fitr@length=#2bp + \advance\fitr@length\dp\fitr@bbox + \edef\fitr@pdftex@view@depth{\the\fitr@length}% +} +\else\if@fitr@dvipdfm +% \end{macrocode} +% \paragraph*{dvipdfm/dvipdfmx/xetex.} The primitive \verb!\special{pdf: dest (name)...}! is used +% along with the primitive variables \texttt{@xpos} and \texttt{@ypos}. +% \begin{macrocode} +\def\FitRbboxB#1#2#3{% + \smash{\raisebox{-\fitr@depth@l-#2bp}% + {\makebox[0pt][l]{\hspace*{-#1bp}% +% \end{macrocode} +% The values of \texttt{@xpos} and \texttt{@ypos} correspond to the coordinates +% of the lower left corner. The values of \texttt{@urx\#3} and \texttt{@ury\#3} +% are calculated in \cs{fitr@urxury@fixup} as the coordinates of the upper right +% corner. +% \begin{macrocode} + \@pdfm@mark{dest (#3) % + [ @thispage /FitR @xpos @ypos @urx#3\space @ury#3\space ]}}}}% +} +% \end{macrocode} +% \cs{fitr@urxury@fixup} is placed just after \cs{fitr@bbox}. +% \begin{macrocode} +\def\fitr@urxury@fixup#1#2#3{% + \smash{\raisebox{\fitr@height@l+#2bp}% + {\makebox[0pt][l]{\hspace*{#1bp}% +% \end{macrocode} +% We raise up to the upper right corner of the content box and define +% \texttt{@urx\#3} and \texttt{@ury\#3} as the current values of +% \texttt{@xpos} and \texttt{@ypos}, +% \begin{macrocode} + \@pdfm@mark{obj @urx#3\space @xpos}% + \@pdfm@mark{obj @ury#3\space @ypos}}}}% +} +\fi\fi\fi\fi +% \end{macrocode} +% We use a short macro from \textsf{graphics} package. +% We do not require the \textsf{graphics} command +% so we redefine it under a different name. +% \begin{macrocode} +\def\fitr@defaultbp#1#2{% + \afterassignment\fitr@def@bp\dimen@#2bp\relax{#1}{#2}} +\def\fitr@def@bp#1\relax#2#3{% + \if!#1!% + \def#2{#3}% + \else + \dimen@.99626\dimen@ + \edef#2{\strip@pt\dimen@}% + \fi} +% \end{macrocode} +% The major command of this package is \cs{jdRect}. Its second required argument +% has several key-value pairs that are recognized. +% Options for the \cs{jdRect} command. +% +% \medskip\noindent\DescribeMacro{lift} is the amount of lift (performed by \cs{raisebox}. The vlue +% can be a positive or negative length. Positive to translate upward, negative to translate downward. +% The default is \texttt{0pt}. +% \begin{macrocode} +\define@key{fitr}{lift}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@lift{\fitr@temp@length}} +\def\fitr@@lift{0pt} +% \end{macrocode} +% \DescribeMacro{shift} the amount of horizontal shift, positive to the right, negative to the left. +% The default is \texttt{0pt} +% \begin{macrocode} +\define@key{fitr}{shift}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@shift{\fitr@temp@length}} +\def\fitr@@shift{0pt} +% \end{macrocode} +% \DescribeMacro{width}\DescribeMacro{height} are the dimensions of the bounding box +% for the button/view rectangle. These dimensions are ignored when the first optional +% parameter of \cmd{\jdRect} is nonempty. +% \begin{macrocode} +\define@key{fitr}{width}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@width{\fitr@temp@length}} +\def\fitr@@width{0pt} +\define@key{fitr}{height}[0pt]{{\setlength\@tempdima{#1}% + \xdef\fitr@temp@length{\the\@tempdima}}% + \edef\fitr@@height{\fitr@temp@length}} +\def\fitr@@height{0pt} +% \end{macrocode} +% \DescribeMacro{ref} is the reference point. Values are \texttt{t} (the default), +% \texttt{c} center, and \texttt{b} bottom. When the optional first parameter of +% \cmd{\jdRect} is nonempty, the default is \texttt{b}. +% \begin{macrocode} +\define@choicekey+{fitr}{ref}[\val\nr]{t,c,b}[t]% + {\edef\fitr@@refPt{\val}}{} +\def\fitr@@refPt{t} +% \end{macrocode} +% \DescribeMacro{adddestw}\DescribeMacro{adddesth} add additional length around +% the (internal) box. This larger rectangle is the view window. +% \begin{macrocode} +\define@key{fitr}{adddestw}[0]{% + \fitr@defaultbp{\fitr@@adddestw}{#1}} +\def\fitr@@adddestw{0} +\define@key{fitr}{adddesth}[0]{% + \fitr@defaultbp{\fitr@@adddesth}{#1}} +\def\fitr@@adddesth{0} +% \end{macrocode} +% \DescribeMacro{button} is a Boolean. If \texttt{true} (the default), \cmd{\jdRect} +% creates a push button around the content. When the user pushes the button, the viewer +% zooms in to the view window. Clicking again restores the previous view. When \texttt{button} +% is \texttt{false}, the button is not created, but the viewing window is. You can then jump to the +% viewing window with a separate link or button. +% \begin{macrocode} +\define@boolkey{fitr}{button}[true]{} +\KV@fitr@buttontrue +% \end{macrocode} +% \DescribeMacro{link} is an key, which if taken, a link rather than a push button, +% is created. The \texttt{link} key takes one of two values: \texttt{jmp}, \texttt{restore}. +% \begin{itemize} +% \item When \texttt{link=jmp}, a link is created that jumps to the destination determined by +% \texttt{dest}. This value is designed for external links for jumping to a rectangular region +% Use the key \texttt{nodest} to keep \cs{jdRect} from creating a destination at the link location. +% \item When \texttt{link=restore}, again, a link is created around the content, a restore last view +% action is associated with the link; clicking on it jumps back to the view at the time you jumped. +% \end{itemize} +% \begin{macrocode} +\define@choicekey+{fitr}{link}[\val\nr]{jmp,restore}[] + {\edef\fitr@@link{\nr}}{} +\let\fitr@@link\@empty +% \end{macrocode} +% \DescribeMacro{nodest}\texttt{nodest} is a Boolean, which if \texttt{true}, +% causes \cs{jdRect} not to generate a destination at the current link (or button). +% \begin{macrocode} +\define@boolkey{fitr}{nodest}[true]{} +\KV@fitr@nodestfalse +% \end{macrocode} +% \DescribeMacro{dest} When \texttt{button=true} (the default), the name of the destination +% is automatically generated, internally. When \texttt{button=false}, you need to specify +% a destination to reference in a separate link or push button. +% \begin{macrocode} +\define@key{fitr}{dest}[]{\def\fitr@@dest{#1}} +\let\fitr@@dest\@empty +% \end{macrocode} +% \begin{macrocode} +\define@choicekey+{fitr}{allowFX}[\val\nr]{true,false}[true]% + {\edef\fitr@allowFX{\val}}{} +\def\allowFXDefault{true} +\let\fitr@allowFX\@empty +% \end{macrocode} +% \paragraph{The main command.} +% \DescribeMacro{\jdRect} \cs{jdRect} (optionally) \underbar{j}umps to and/or sets +% a \underbar{d}estination of a \textsf{Fit\underbar{R\normalfont ect}}angle.\footnote{I had some problems naming this command.} +% This command is multi-functional. +% This is the default behavior (\texttt{button=true}). The command creates two +% rectangular regions (which can be viewed using the \texttt{preview} and \texttt{viewMagWin}). +% \begin{center}\setlength\fboxsep{0pt} +% \fbox{\parbox[c][.9in]{2.4in} +% {\vfill\hfil\fbox{\parbox[c][.5in]{2in}{\vfill\hfill}}\hfil\vfill}} +% \end{center} +% The inner-box represents the bounding rectangle of the push button (or link) that is created +% when \texttt{button=true} (or \texttt{link=jmp\string|restore}). The outer rectangle is the \emph{view window}, the window +% that is magnified to (the dimensions of this rectangle set by the four \textsf{FitR} +% parameters. Normally, the inner and outer rectangles are the same, unless the author +% specifies values of \texttt{adddestw} and \texttt{adddesth}. The picture above is that +% can be produced by setting +%\begin{verbatim} +% width=2in,height=.5in,adddestw=.2in,adddesth=.2in +%\end{verbatim} +% The inner rectangle may be seen by using the option \texttt{preview}, the outer once +% can be see by using the option \texttt{viewMagWin}. +% +% Now if \texttt{button=false}, \cs{jdRect} only sets the destination; +% it does not create the inner push button. A separate link or push button +% needs to be created to jump to the view window. +% +%\medskip\noindent Syntax for \cs{jdRect} has two forms: +%\begin{quote} +% \cs{jdRect[\meta{key-values}]} +%\end{quote} +% The above version is used to overlay a region with a button and view window. +% No content is specified, but is defined by specifying the \texttt{width} and \texttt{height}; +% it can be positioned using \texttt{shift} and \texttt{lift}. +% +% There is a \texttt{*}-version as well: +%\begin{quote} +% \cs{jdRect*[\meta{key-values}]}\verb!{!\meta{content}\verb!}! +%\end{quote} +% The second parameter \meta{content} is required when the \texttt{*} is present. +% This version is meant to enclose \meta{content} within the button and view window. +% \texttt{width} and \texttt{height} are ignored, but \texttt{shift} and \texttt{lift} are obeyed (though +% you may \texttt{shift} or \texttt{lift} the button/view window away from the content). +% \begin{macrocode} +\newcommand{\jdRect}{\begingroup + \@ifstar{\let\fitr@istar=1\set@rectjd}% + {\let\fitr@istar=0\set@rectjd}} +% \end{macrocode} +% For links, we use the link color of \textsf{hyperref}. The definition of +% \cmd{\ef@colorthislink} is in \textsf{eforms}. +% \begin{macrocode} +\@eqlinktxtcolor{\@linkcolor} +\newcommand{\fitr@bcode}{\ef@colorthislink}% +% \end{macrocode} +% Second stage in the expansion of \cmd{\jdRect}. +% \begin{macrocode} +\newcommand{\set@rectjd}[1][]{\def\fitr@jdrect@argi{#1}% +% \end{macrocode} +% We process the key-values before gathering the \cs{collectbox} +% so we can insert the link color, if this is a link! +% \begin{macrocode} + \edef\temp@exp{\noexpand\setkeys{fitr}{#1}}\temp@exp + \ifx\fitr@@link\@empty\let\fitr@bcode\relax\fi +% \end{macrocode} +% If this is \cs{jdRect*}, we collect the second argument using +% \cs{collectbox}, and move on to \cs{set@@rectjd}. +% \begin{macrocode} + \if\fitr@istar1% + \def\fitr@next{\collectbox[\fitr@bcode]{\set@@rectjd}}\else +% \end{macrocode} +% Otherwise, we just move on to \cs{set@@rectjd}. +% \begin{macrocode} + \def\fitr@next{\set@@rectjd}\fi\fitr@next +} +% \end{macrocode} +% The third and final stage in the expansion of \cs{jdRect} +% \begin{macrocode} +\def\set@@rectjd{% + \stepcounter{magCnt}\def\fitr@setBL{0pt}% + \ifx\fitr@@dest\@empty + \def\fitr@namedDest{fitrDestn\the\value{magCnt}}\else + \edef\fitr@namedDest{\fitr@@dest}\fi + \if\fitr@istar1\def\fitr@@refPt{b}\fi +% \end{macrocode} +% If the user specifies the \texttt{link} option, we cancel the \texttt{button} option. +% \begin{macrocode} + \ifx\fitr@@link\@empty\else\KV@fitr@buttonfalse\fi +% \end{macrocode} +% If content is explicitly passed in the optional second parameter +% we put it in a box and take its measurements. We'll insert the content +% instead of an empty filled \cs{parbox}. +% \begin{macrocode} + \if\fitr@istar1% + \edef\fitr@@width{\the\wd\collectedbox}% + \edef\fitr@setBL{\the\dp\collectedbox}% + \setlength{\fitr@length}{\ht\collectedbox+\dp\collectedbox}% + \edef\fitr@@height{\the\fitr@length}% + \fi +% \end{macrocode} +% Now, we fit the content into \cs{fitr@bbox} using \cs{get@fitr@dimen}. +% \begin{macrocode} + \ifx\fitr@@link\@empty + \ifKV@fitr@button\let\fitr@FLB@ction\fitr@OverlayJmpBtn\else +% \end{macrocode} +% \cs{Bbox} is defined in \textsf{eforms}. +% \begin{macrocode} + \@ifundefined{ef@Bbox}{\let\fitr@FLB@ction\Bbox}% + {\let\fitr@FLB@ction\ef@Bbox}\fi + \else\def\fitr@FLB@ction{\hfill\vfill\@gobbletwo}\fi +% \end{macrocode} +% And overlay the button/link/box +% \begin{macrocode} + \get@fitr@dimen{% + \parbox[\fitr@@refPt][\fitr@@height]{\fitr@@width}% + {\kern0pt\fitr@FLB@ction{\fitr@@width}{\fitr@@height}\kern0pt}% + }% +% \end{macrocode} +% Now place the button/box according to the user's options. +% \begin{macrocode} + \makebox[0pt][l]{\hspace*{\fitr@@shift}\smash{% + \raisebox{\fitr@@lift-\fitr@setBL}{% + \ifKV@fitr@nodest\else\setFitRDest{\fitr@@adddestw}% + {\fitr@@adddesth}{\fitr@namedDest}\fi + \unhbox\fitr@bbox\ifKV@fitr@nodest\else\fitr@urxury@fixup + {\fitr@@adddestw}{\fitr@@adddesth}{\fitr@namedDest}\fi + }}}% + \setlength{\fboxsep}{0pt}% +% \end{macrocode} +% We attempt to represent the bounding box of the view window. +% We display the bounding view window only if the \texttt{nodest} +% option was not taken, and the \cs{ifviewMagWin} is true. +% \begin{macrocode} + \ifKV@fitr@nodest\else\ifviewMagWin + \fitr@length=\fitr@@adddestw bp + \fitr@length=2\fitr@length + \addtolength{\fitr@length}{\fitr@@width}% + \edef\fitr@@width{\the\fitr@length}% + \fitr@length=\fitr@@adddesth bp + \fitr@length=2\fitr@length + \addtolength{\fitr@length}{\fitr@@height}% + \edef\fitr@@height{\the\fitr@length}% + \setlength\fitr@length{-\fitr@@adddestw bp}% + \addtolength\fitr@length{\fitr@@shift}% + \makebox[0pt][l]{\hspace*{\fitr@length}\smash{% + \setlength\fitr@length{\fitr@@lift-\fitr@setBL}% + \if\fitr@@refPt b% + \addtolength\fitr@length{-\fitr@@adddesth bp}\else + \if\fitr@@refPt t% + \addtolength\fitr@length{\fitr@@adddesth bp}% + \fi\fi + \raisebox{\fitr@length}% + {\fbox{\parbox[\fitr@@refPt][\fitr@@height]% + {\fitr@@width}{\kern0pt\hfill\vfill\kern0pt}}}}% + }% + \fi\fi +% \end{macrocode} +% If the user passes content through the optional first parameter, we +% typeset it to the right of the material above (which did not change +% the position of the current point. +% \begin{macrocode} + \if\fitr@@link0\let\fitr@FLB@ction\fitr@OverlayJmpLnk\else + \if\fitr@@link1\let\fitr@FLB@ction\fitr@OverlayRestoreLnk\else + \let\fitr@FLB@ction\relax\let\fitr@bcode\relax\fi\fi + \if\fitr@istar1\gdef\fitr@next{\fitr@FLB@ction{\BOXCONTENT}}\else + \let\fitr@next\relax\fi\fitr@next + \endgroup} +% \end{macrocode} +% The code for the \textbf{\textsf{FitR}} destination. +% \begin{macrocode} +\def\setFitRDest#1#2#3{% + \if@fitr@dvipdfm + \FitRbboxB{#1}{#2}{#3}% + \else + \ifx\fitr@driver\fitr@pdftex@driver + \FitRbboxB{#1}{#2}% +% \end{macrocode} +% We shift the rectangle \texttt{\#1bp} to the left without changing +% the current point. Then use the \textsf{pdftex} primitive \cs{pdfdest}. +% \begin{macrocode} + \makebox[0pt][l]{\hspace*{-#1bp}% + \pdfdest name {#3} fitr + width \fitr@pdftex@view@width\space + height \fitr@pdftex@view@height\space + depth \fitr@pdftex@view@depth\space + }% +% \end{macrocode} +% The \textbf{PostScript} code for the \textbf{\textsf{FitR}} destination, for the +% case of \texttt{dvips} and \texttt{dvipsone}. +% \begin{macrocode} + \else\literalps@out{% + [ /Dest/#3/View [ /FitR \FitRbboxB{#1}{#2} ]/DEST pdfmark}% + \fi\fi +} +% \end{macrocode} +% \paragraph*{Form fields.} The \textsf{eforms} package allows for what is +% called presets. We gather some useful options in one group, and pass them +% all together. \DescribeMacro{\overlayPresets}\cmd{\overlayPresets} sets +% some defaults for the push button that surrounding the content. +% \begin{macrocode} +\newcommand{\overlayPresets}{\H{I}\BG{}\BC{}\S{S}} +% \end{macrocode} +% The \cs{fitr@OverlayJmpBtn} is a \cs{pushButton} that is used internally. +% It calls document JavaScript \texttt{overlayJmpBtnAction()} for a mouse +% up action. +% \begin{macrocode} +\def\fitr@OverlayJmpBtn#1#2{% + \ifx\fitr@allowFX\@empty + \def\allowFXcode{bAllowFX=\allowFXDefault}\else + \def\allowFXcode{bAllowFX=\fitr@allowFX}\fi + \pushButton[\presets{\overlayPresets}\F{-\FPrint}\autoCenter{n} + \A{\JS{\allowFXcode;\r overlayJmpBtnAction(% +event,"\fitr@namedDest","\fitr@namedDest");}}]{\fitr@namedDest}{#1}{#2}} +% \end{macrocode} +% \begin{macrocode} + +\ifHy@colorlinks\def\overlayJmpLnkPresets{}\else + \def\overlayJmpLnkPresets{\Color{\@linkcolor}\W{1}} +\fi +%\def\overlayJmpLnkPresets{\Color{\@linkcolor}\W{1}}\fi +\def\fitr@OverlayJmpLnk#1{\setLink[% + \presets{\overlayJmpLnkPresets} + \A{\JS{overlayJmpLnkAction("\fitr@namedDest");}}]{#1}} +\def\fitr@OverlayRestoreLnk#1{\setLink[% + \presets{\overlayJmpLnkPresets} + \A{\JS{overlayRestoreLnkAction("\fitr@namedDest");}}]{#1}} +% \end{macrocode} +% +% \section{Document JavaScript} +% The document JavaScript for \textsf{fitr}. +% \begin{macrocode} +\begin{insDLJS}[_fitrLoaded]{fitr}{JS for the fitr Package} +var _fitrLoaded=true; +var restoreViewState; +var savedRestore=false; +var aSavedRestore=new Array(); +var bAllowFX=true; +% \end{macrocode} +% This is the function that the hidden overlayed button calls when the +% user clicks on it. +% \begin{macrocode} +function overlayJmpBtnAction(event,fname,dname) { + if (event.shift) shiftRestoreView(fname,dname); + else jumpToDest(fname,dname); +} +function shiftRestoreView(fname,dname) { + var bRestore=restoreView(fname,dname); +% \end{macrocode} +% \DescribeMacro{overlayRestoreHook} is a undefined function that the document +% author can define to create additional code that s/he want executed following +% the restore. +% \begin{macrocode} + if (bAllowFX) + try { overlayRestoreHook(event,bRestore); } catch(e) {} +} +% \end{macrocode} +% When the user clicks on the overlay button, \texttt{overlayJmpBtnAction()} +% calls \texttt{jumpToDest}. The function stores the current state before +% jumping. +% \begin{macrocode} +function jumpToDest(fname,dname) { + if ( typeof aSavedRestore[fname]=="undefined") + aSavedRestore[fname]=[false,{}]; + else { +% \end{macrocode} +% If \texttt{aSavedRestore[fname][0]} is true, that means we have zoomed +% into the expression, but have not zoomed out again. We'll go ahead and zoom out +% by calling \texttt{shiftRestoreView()}, which does just that. +% \begin{macrocode} + if (aSavedRestore[fname][0]) { + shiftRestoreView(fname,dname) +% \end{macrocode} +% When restoring, we return from this call; we don't want to +% jump to the destination, which is executed later. +% \begin{macrocode} + return; + } + } + if (!aSavedRestore[fname][0]){ + aSavedRestore[fname][1]=this.viewState; + aSavedRestore[fname][0]=true; + } +% \end{macrocode} +% Jump to the named destination. +% \begin{macrocode} + this.gotoNamedDest(dname); +% \end{macrocode} +% \DescribeMacro{overlayJmpHook} is a undefined function that the document +% author can define to create additional code that s/he want executed following +% the jump. +% \begin{macrocode} + if (bAllowFX) try { overlayJmpHook(event); } catch(e) {} +} +% \end{macrocode} +% When the user shift-clicks on the overlay button, \texttt{overlayJmpBtnAction()} +% calls \texttt{restoreView}. This function restores the view before the user +% magnified the view. +% \begin{macrocode} +function restoreView(fname,dname) { + if ( typeof aSavedRestore[fname]=="undefined") + aSavedRestore[fname]=[false,{}]; + if ( aSavedRestore[fname][0]){ + this.viewState=aSavedRestore[fname][1]; + aSavedRestore[fname][0]=false; + return true; + } + else return false; +} +% \end{macrocode} +% \texttt{overlayJmpLnkAction()} is used when the \texttt{link=jmp} key-value pair is +% specified. A link does not have a name, so we don't use an array of +% stored view state as we do for push buttons. We use a single variable +% for all links. +% \begin{macrocode} +function overlayJmpLnkAction(dname) { + if (!savedRestore){ + restoreViewState=this.viewState; + savedRestore=true; + } + this.gotoNamedDest(dname); +} +% \end{macrocode} +% \texttt{overlayRestoreLnkAction()} is used when the \texttt{link=restore} key-value pair is +% specified. We restore the previously saved view state. +% \begin{macrocode} +function overlayRestoreLnkAction(dname) { + if (savedRestore){ + this.viewState=restoreViewState; + savedRestore=false; + } +} +\end{insDLJS} +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +%\Finale +\endinput diff --git a/macros/latex/contrib/fitr/fitr.ins b/macros/latex/contrib/fitr/fitr.ins new file mode 100644 index 0000000000..5fb5a22205 --- /dev/null +++ b/macros/latex/contrib/fitr/fitr.ins @@ -0,0 +1,61 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2012 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2016/04/04} +\def\batchfile{fitr.ins} + +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble + +\generate +{% + \file{fitr.sty}{\from{fitr.dtx}{copyright,package}} +} + + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput |