% makeindex < aebpro_man.idx > aebpro_man.ind
\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage[
    web={centertitlepage,designv,forcolorpaper,tight,latextoc,pro},
    eforms,
%    linktoattachments,
%    attachments={../aeb_pro.dtx},
%    uselayers,
    aebxmp
]{aeb_pro}
\usepackage{graphicx,array}
%\usepackage{myriadpro}
\usepackage[altbullet]{lucidbry}

\usepackage{makeidx}
\makeindex
\usepackage{acroman}

\usepackage[active]{srcltx}

\urlstyle{rm}

%\def\tutpath{doc/tutorial}
%\def\tutpathi{tutorial}
\def\expath{../examples}

\DeclareDocInfo
{
    university={\AcroTeX.Net},
    title={The \textsf{aeb\_mobile} Package\texorpdfstring{\\}{: }%
        Formatting PDFs for the Smartphone},
    author={D. P. Story},
    email={dpstory@acrotex.net},
    subject=Documentation for the aeb\_mobile package,
    talksite={\url{www.acrotex.net}},
    version={2.3, 2018/04/26},
    Keywords={LaTeX,PDF,Smartphone,iPad,Adobe Acrobat},
    copyrightStatus=True,
    copyrightNotice={Copyright (C) \the\year, D. P. Story},
    copyrightInfoURL={http://www.acrotex.net}
}

\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}}

\def\ameta#1{$\langle\textit{\texttt{#1}}\rangle$}
\def\meta#1{\textit{\texttt{#1}}}
\let\pkg\textsf
\let\env\texttt
\let\opt\texttt
\let\app\textsf


\makeatletter
\renewcommand{\makeinlinetitle}
{%
    \begingroup\parskip0pt\parindent0pt
    \par\vspace*{6pt}
    \noindent\makebox[\linewidth][c]{\bfseries
    \color{\webuniversity@color}\webuniversity}\par\kern6pt\noindent
    \makebox[\linewidth][c]{\parbox[c]{.75\linewidth}{\centering
    \bfseries\color{\webtitle@color}\webtitle}}\par\kern12pt
    \noindent\parbox{\linewidth}{\scriptsize
        \web@copyright\space\the\year\hfill\thewebemail\\
        \@date\hfill\@ifundefined{aeb@talksite}{\webversion}
            {\ifx\aeb@talksite\@empty\webversion
              \else\aeb@talksite\fi}%
        }\par
    \noindent\makebox[\linewidth]{\rule{.67\linewidth}{.4pt}}%
    \par\endgroup
}
\makeatother

%\pagestyle{empty}
\parindent0pt
\parskip\medskipamount

\chngDocObjectTo{\newDO}{doc}
\begin{docassembly}
var titleOfManual="The aeb_mobile MANUAL";
var manualfilename="Manual_BG_Print_mobile.pdf";
var manualtemplate="Manual_BG_Green.pdf"; // Blue, Green, Brown
var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate;
var doc;
var buildIt=true;
if ( buildIt ) {
    console.println("Creating new " + manualfilename + " file.");
    doc = \appopenDoc({cPath: _pathToBlank, bHidden: true});
    var _path=this.path;
    var pos=_path.lastIndexOf("/");
    _path=_path.substring(0,pos)+"/"+manualfilename;
    \docSaveAs\newDO({ cPath: _path });
    doc.closeDoc();
    doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true});
    f=doc.getField("ManualTitle");
    f.value=titleOfManual;
    doc.flattenPages();
    \docSaveAs\newDO({ cPath: manualfilename });
    doc.closeDoc();
} else {
    console.println("Using the current "+ manualfilename + " file.");
}
var _path=this.path;
var pos=_path.lastIndexOf("/");
_path=_path.substring(0,pos)+"/"+manualfilename;
\addWatermarkFromFile({
    bOnTop:false,
    bOnPrint:false,
    cDIPath:_path
});
\executeSave();
\end{docassembly}

\begin{document}

\maketitle

\selectColors{linkColor=black}
\tableofcontents
\selectColors{linkColor=webgreen}

\section{Introduction}

This package, \pkg{aeb\_mobile}, is a simple application
of the \pkg{web} and \pkg{eforms} packages to format a {\PDF} for the
\textbf{smartphone}, such as my \textbf{Windows Phone}.

I've attempted to maximize the viewing and printing experience when the
PDF is viewed on the desktop/laptop and in a smart phone.

\section{Alternate package name: \texorpdfstring{\protect\pkg{aeb-mobile}}{aeb-mobile}}

This package is listed on CTAN as \pkg{aeb-mobile} (\href{https://www.ctan.org/pkg/aeb-mobile}{ctan.org/pkg/aeb-mobile}), even though there is no such package. Now, there
is a `dummy' package \pkg{aeb-mobile} that loads \pkg{aeb\_mobile} and passes all options to it.

\section{The Preamble and Package Options}

In the preamble, place the \textsf{aeb\_mobile} package like so
\begin{Verbatim}[xleftmargin=20pt,commandchars=!()]
\usepackage[!ameta(options)]{aeb_mobile}
\end{Verbatim}

At this writing, there are four options,
\begin{itemize}
\item \texttt{smartphone}: This option sets up a page size of $ 4\times8 $ inches.
Further options of this same type may appear in the future to support
other devices.
\item \texttt{nomaketitle}: The package makes a redefinition of
    \cs{makeinlinetitle} (originally defined in the {\Web} package. Using
    this option, the redefinition is skipped.

\item[] The following is an example of the redefinition of \cs{makeinlinetitle}

\makeinlinetitle

\item[] The horizontal rule is part of the redefinition, it separates the title
from the content on the \textbf{smartphone}. The information presented is
obtain from the various commands defined by {\Web}: \cs{university},
\cs{title}, \cs{email}, \cs{talksite}, etc.

\item \texttt{useforms}: By default, links are created to
    \textbf{Print} the file and \textbf{Toggle Cols}, if this option
    is used, form buttons are used instead. The form button will be
    set so that it is visible but does not print. (An advantage it has
    over links.)

    \item[] The \textbf{Print} link/button prints the document in two
    column format, remember, a page is only 4 inches wide, so two columns
    fit nicely on standard paper (letter size, for example).

    \item[] The \textbf{Toggle Cols} link/button toggles the page between
    two column format and single column format.

    \item[] The \textbf{Print} and \textbf{Toggle Cols} links/buttons work
    only when viewing the document with \textbf{Adobe Reader} on a computer; links
    and form fields are not supported by the \textbf{Adobe Reader app} on a
    smartphone.

\item \texttt{scalefigures} and \texttt{!scalefigures}:\footnote{This feature was suggested to me by Mathias M.}  When
\texttt{scalefigures} is taken, an image included using
\cs{includegraphics} (from \textsf{graphicx} package) is rescaled
according to an algorithm: The width (as specified by the \texttt{width} key of
\cs{includegraphics}) is doubled up to a maximum width
of \cs{textwidth}. The rescaling feature can be turned off conveniently by
specifying the option \texttt{!scalefigures}. The rescaling of figures can
be also turned off and on locally using \cs{scalefiguresOn} and
\cs{scalefiguresOff}. If either of these two commands are executed within
a group, their effects will be undone when the group is exited.
\end{itemize}

\section{Customizing Commands}

The package does not have many user commands, here, we present those
associated with the \textbf{Print} and \textbf{Toggle Cols}. (See the
\texttt{useforms} option above.)

\begin{itemize}
    \item \cs{mobPrint} sets the text of the \textbf{Print} link
        and the \textbf{Print} button caption if its a push button. The
        default is \verb!\mobPrint{Print}!.
    \item \cs{mobPrintTip} is the tool tip when there's a button for
    \textbf{Print}. The default is a command,
\begin{verbatim}
    \newcommand{\mobPrintTip}{Click to print this document
        in two-column format, recommended.}
\end{verbatim}
    \item \cs{mobToggleCols} sets the text for the toggle link and the
        toggle button caption if its a push button. The default is
        \verb!\mobToggleCols{Toggle Cols}!.
    \item \cs{mobToggleColsTip} is the tool tip for the toggle button.
    The default is a command,
\begin{verbatim}
    \newcommand{\mobToggleColsTip}{Click to toggle between
        single-column and two-column page layouts.}
\end{verbatim}
    \item \cs{mobFormPresets} is used to set the appearance of the
        form buttons for print and toggle. The default is
\begin{verbatim}
    \mobFormPresets{\S{S}\BC{}\textSize{8}\autoCenter{n}}
\end{verbatim}
The argument are key-values as defined by the \textsf{eforms} package.
\end{itemize}

\section{Early Exit}

The following
\begin{verbatim}
    \@ifundefined{ifsmartphone}{\newif\ifsmartphone\smartphonetrue}{}
\end{verbatim}
is inserted early in the code of \textsf{aeb\_mobile}. If
\cs{ifsmartphone} is not already defined, we define it and set it to true.

Later, just after \cs{ProcessOptions}, we have this code
\begin{verbatim}
    \ifsmartphone\else\expandafter\endinput\fi
\end{verbatim}
That is, if \cs{ifsmartphone} is false, the package input is ended. The
\cs{ifsmartphone} switch is defined in the companion package
\textsf{spdef}, described in the next section, and is used to prepare
documents,both for the smartphone \emph{and} for paper.

With these bits of code in place, the package need not be surrounded by
the \cs{if\-smart\-phone} switch,
\begin{verbatim}
    \ifsmartphone
    \usepackage[smartphone,useforms]{aeb_mobile}
    \fi
\end{verbatim}
Now, you need only say,
\begin{verbatim}
    \usepackage[smartphone,useforms]{aeb_mobile}
\end{verbatim}
If \cs{ifsmartphone} is true, the full package is input, if false, the
package is ended early.

This is useful in conjunction with the \textsf{spdef} package, see the next
section.



\section{Final comments, the \textsf{spdef} package}

I have begun to use the \textsf{aeb\_mobile} package in my current
class.\footnote{See
\url{http://faculty.nwfsc.edu/web/math/storyd/class/spr12/STA2023/}
for examples of \textbf{smartphone} documents; also see
\url{http://www.acrotex.net/blog/?p=766}}
For most publications (in PDF), I offer a standard paper sized document,
and a \textbf{smartphone} version. At the top of each document, I have
\begin{verbatim}
    \RequirePackage[ph]{spdef}

    \documentclass[\ifsmartphone11pt\else10pt\fi]{article}
    ..
    \usepackage[%
        web={tight,pro},eforms
    ]{aeb_pro}
    \ifsmartphone
    \usepackage[smartphone,useforms]{aeb_mobile}
    \fi
\end{verbatim}
The package \textsf{spdef} (\underbar{s}mart\underbar{p}hone \underbar{def}inition)
is a short package that defines the switch \cs{ifsmartphone}.\footnote{\cs{RequirePackage} is used
here because \cs{usepackage} cannnot be used until after a class document is input, where as
there is no such restriction on \cs{RequirePackage}.} The package
has two options \texttt{pa} (compile for paper, i.e. not for smartphone)
and \texttt{ph} (compile for smartphone, where \cs{ifsmartphone} has a
value of true). The \textsf{spdef} accompanies this distribution; see
\href{spdef.pdf}{spdef.pdf} for documentation.

The newest version of \textsf{aeb\_mobile} does not require the
\cs{ifsmartphone} switch. Now you can say,
\begin{verbatim}
    \RequirePackage[ph]{spdef}

    \documentclass[\ifsmartphone11pt\else10pt\fi]{article}
    ..
    \usepackage[%
        web={tight,pro},eforms
    ]{aeb_pro}
    \usepackage[smartphone,useforms]{aeb_mobile}
\end{verbatim}
If the \texttt{ph} option in \textsf{spdef} is changed to \texttt{pa}, the
file will be compiled for paper (early exit for \textsf{aeb\_mobile}).


Using the above scheme, I use the same source file for both documents
(paper and smartphone versions). Most recently, I've been using
the \textsf{eqexam} package to create dual purpose documents; see my
\href{http://faculty.nwfsc.edu/web/math/storyd/class/spr12/STA2023/}{Statistics class website}.

Now, I simply must get back to my retirement. \dps

\end{document}
