From fbc73b62c78b771a4d7064eb308e1feaac2cd046 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 11 Jun 2018 12:38:32 +0900 Subject: add aeb-mobile --- texmf-dist/source/latex/aeb-mobile/aeb_mobile.dtx | 341 +++++++++++++++++++++ texmf-dist/source/latex/aeb-mobile/aeb_mobile.ins | 62 ++++ .../source/latex/aeb-mobile/doc/aebmobile_man.tex | 324 ++++++++++++++++++++ texmf-dist/source/latex/aeb-mobile/spdef.dtx | 222 ++++++++++++++ 4 files changed, 949 insertions(+) create mode 100644 texmf-dist/source/latex/aeb-mobile/aeb_mobile.dtx create mode 100644 texmf-dist/source/latex/aeb-mobile/aeb_mobile.ins create mode 100644 texmf-dist/source/latex/aeb-mobile/doc/aebmobile_man.tex create mode 100644 texmf-dist/source/latex/aeb-mobile/spdef.dtx (limited to 'texmf-dist/source') diff --git a/texmf-dist/source/latex/aeb-mobile/aeb_mobile.dtx b/texmf-dist/source/latex/aeb-mobile/aeb_mobile.dtx new file mode 100644 index 00000000..8741a1ac --- /dev/null +++ b/texmf-dist/source/latex/aeb-mobile/aeb_mobile.dtx @@ -0,0 +1,341 @@ +%\iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% aeb_mobile.sty package %% +%% Copyright (C) 2012-2018 %% +%% dpstory@acrotex.net %% +%% %% +%% 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e}[1997/12/01] +%\ProvidesPackage{aeb_mobile} +% [2018/04/26 v1.4 aeb\_mobile: Formatting for mobile devices (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex=false]{hyperref} +%\pdfstringdefDisableCommands{\let\\\textbackslash} +%\EnableCrossrefs \CodelineIndex +\OnlyDescription % comment out for implementation details +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\InputIfFileExists{aebdocfmt.def}{\PackageInfo{web}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax + \PackageInfo{web}{aebdocfmt.def cannot be found}} +\begin{document} +\def\CMD#1{\textbackslash#1} +\let\pkg\textsf +\let\opt\texttt +\addtolength{\marginparwidth}{3pt} + \GetFileInfo{aeb_mobile.sty} + \title{\texorpdfstring{\protect\pkg{aeb\_mobile}}{aeb_mobile}: Formatting for mobile devices} + \author{D. P. Story\\ + Email: \texttt{dpstory@acrotex.net}} + \date{processed \today} + \maketitle + \tableofcontents + \DocInput{aeb_mobile.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute + \texttt{makeindex -s gind.ist -o aeb\_mobile.ind aeb\_mobile.idx} on the command line and recompile + \texttt{aeb\_mobile.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute + \texttt{makeindex -s gglo.ist -o aeb\_mobile.gls aeb\_mobile.glo} on the command line and recompile + \texttt{aeb\_mobile.dtx}.} +\end{document} +% +% \fi +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{web}{Inputting aebdonotindex.def}} +% {\PackageInfo{web}{cannot find aebdonotindex.def}} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% If \cs{ifsmartphone} is undefined, we do nothing; otherwise, if \texttt{true} +% we load the package, if \texttt{false} we end the package. With this, we don't +% need to surround the \textsf{aeb\_mobile} package with \cs{ifsmartphone}\dots\cs{fi}. +%\changes{v1.1}{2012/06/26}{Added a check for \cs{ifsmartphone}} +% \begin{macrocode} +\@ifundefined{ifsmartphone}{\newif\ifsmartphone\smartphonetrue}{} +% \end{macrocode} +% \section{Introduction} +%This is a simple package designed to format a document for a smart phone. +%When the option \texttt{smartphone} is taken a page $4\times8$ inches is +%created. Other definitions are made, as explained below. +% +% \begin{macrocode} +% +%<*altpkgname> +% \end{macrocode} +% +% \section{Alternate package name: \texorpdfstring{\protect\pkg{aeb-mobile}}{aeb-mobile}} +% CTAN lists this package (\pkg{aeb\_mobile}) as \pkg{aeb-mobile}, so we'll create +% a dummy package by that name. +% \changes{v1.3}{2018/04/26}{Added dummy package \string\pkg{aeb-mobile}} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{aeb-mobile} + [2018/04/26 v1.0 aeb-mobile Alt-name (dps)] +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{aeb_mobile}} +\ProcessOptions +\RequirePackage{aeb_mobile} +% \end{macrocode} +% \begin{macrocode} +% +%<*package> +% \end{macrocode} +% \section{The code} +% In this main body of the package, we set page dimensions, the inital +% view of the PDF, define a title page, define links and the JavaScript +% they use. +% \subsection{Set Package Options} +% \begin{macro}{smartphone} +% First, we get the options.For the \texttt{smartphone} +% option we have an $4\times8$ inch page, with narrow side margins. +% \begin{macrocode} +\DeclareOption{smartphone}{\ifsmartphone\AtEndOfPackage{% + \web@MargScrDimOpts{.25in}{.25in}{24pt}{.25in}{8in}{4in}}\fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{nomaketitle} +% The package makes a redefinition of \cs{makeinlinetitle} (originally defined +% in the web package. Using this option, the redefinition is skipped. +% \begin{macrocode} +\newif\ifmob@maketitledefn \mob@maketitledefntrue +\DeclareOption{nomaketitle}{\mob@maketitledefnfalse} +% \end{macrocode} +% \end{macro} +% \begin{macro}{useforms} +% By default, links are created to \textsf{Print} the file and \textsf{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.) +% \begin{macrocode} +\newif\ifmob@useforms \mob@useformsfalse +\DeclareOption{useforms}{\mob@useformstrue} +% \end{macrocode} +% \end{macro} +% \begin{macro}{scalefigures} +% An option suggested by Mathias M. When this option is taken, graphic images +% are scaled according to an algorithm. See the description above the definition +% of \cs{mob@adjwidth}. The commands \DescribeMacro{\scalefiguresOn}\cmd{\scalefiguresOn} +% and \DescribeMacro{\scalefiguresOff}\cmd{\scalefiguresOff} are a convenient way to +% turn the scaling of figures on and off. +% \changes{v1.2}{2012/06/28}{Added \texttt{scalefigures} and \texttt{!scalefigures}} +% \begin{macrocode} +\newif\ifmobscalefigures\mobscalefiguresfalse +\newcommand{\scalefiguresOn}{\mobscalefigurestrue} +\newcommand{\scalefiguresOff}{\mobscalefiguresfalse} +\DeclareOption{scalefigures}{\mobscalefigurestrue} +\DeclareOption{!scalefigures}{\mobscalefiguresfalse} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% \textbf{Early Stop.} If \cs{ifsmartphone} is false, we stop here. +%\changes{v1.1}{2012/06/26}{added early \cs{endinput}} +% \begin{macrocode} +\ifsmartphone\else\expandafter\endinput\fi +% \end{macrocode} +% We require the \textsf{web} package to set the dimensions of the page, above, +% and the \textsf{eforms} package to set links, defined below. +% \begin{macrocode} +\RequirePackage{web} +\RequirePackage{eforms} +% \end{macrocode} +% \subsection{Set initial view} +% There seems to be a slight conflict between \textsf{aeb\_pro} and \textsf{hyperref} +% when it comes to setting some of the preferences. If \textsf{aeb\_pro} is +% loaded, we'll use \textsf{aeb\_pro}, otherwise, we use \textsf{hyperref}. +% \begin{macrocode} +\@ifpackageloaded{aeb_pro}{% + \DeclareInitView{% + layoutmag={pagelayout=TwoColumnLeft,mag=FitWidth}, + windowoptions=showtitle}}{% + \hypersetup{pdfdisplaydoctitle=true,% + pdfstartview=FitH -32768,pdfpagelayout=TwoColumnLeft}} +% \end{macrocode} +% \subsection{A title page} +% \DescribeMacro{\makeinlinetitle}The web defines +% \cs{makeinlinetitle}, we'll redefine it here +% for our convenience. +% \begin{macrocode} +\ifmob@maketitledefn +\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 +} +\fi +% \end{macrocode} +% \subsection{Redefinitions of {\LaTeX} commands} +% We redefine \cs{paragraph} and a key-value of \cs{includegraphics} +% \begin{macrocode} +\renewcommand{\paragraph}{\edef\mob@partpgraphexp{\noexpand + \@startsection{paragraph}{4}{0pt}% + {\ifdim\parskip=0pt12pt\else0pt\fi}}% + \mob@partpgraphexp{-3pt}{\bfseries}} +% \end{macrocode} +% This is an implementation of an idea proposed by Mathias M. He notes that +% a figure that looks fine when the document is compiled for paper, is too small +% when compiled for the smartphone. So, he proposes to double the width of the +% image up to a maximum width of \cs{textwidth}. My implementation is to redefine +% the key-value command for \cs{includegraphics} from \textsf{graphicx}, to intercept the declared width, +% and modify its value according to the above description. +%\changes{v1.1}{2012/06/26}{Added the \cs{mob@adjwidth} command to adjust the width +% of a graphic} +% +% The scaling of figures can be turned on and off by setting the switch +% \cs{ifmobscalefigures}, as appropriate. +% \changes{v1.2}{2012/06/28}{Added conditional \cs{ifmobscalefigures}} +% \begin{macrocode} +\def\mob@adjwidth#1{\ifmobscalefigures{\dimen0=#1 + \dimen0=2\dimen0\relax + \xdef\mob@djwidth{\expandafter\the + \ifdim\dimen0<\textwidth + \dimen0 \else\textwidth\fi}% + }\else\gdef\mob@djwidth{#1}\fi +} +% \end{macrocode} +% We intercept the width parameter, pass it to \cs{mob@adjwidth}, then +% use the result to define the graphicx command \cs{Gin@ewidth}. +% \begin{macrocode} +\@ifpackageloaded{graphicx}{% + \define@key{Gin}{width}{\mob@adjwidth{#1}% + \edef\Gin@ewidth{\mob@djwidth}}% +}{} +% \end{macrocode} +% \subsection{Some JavaScript} +% We define two functions: (1) \texttt{\_printIt()} prints +% the current document using the default printer in two columns; +% (2) \texttt{\_toggleViews()} toggles the view between single column +% and two columns. In both case we use fit width zoom type. +% \begin{macrocode} +\begin{insDLJS}[_mobileJS]{mobile}{JS supporting mobile formatting} +var _mobileJS=true +function _printIt(){ + var pp=this.getPrintParams(); + pp.pageHandling=pp.constants.handling.nUp; + pp.nUpPageOrder=pp.constants.nUpPageOrders.Horizontal; + pp.nUpNumPagesH=2; + pp.nUpPageBorder=false; + pp.nUpAutoRotate=false; + this.print(pp); +} +function _toggleViews() { + this.zoomType=zoomtype.fitW; + this.layout=(this.layout!="TwoColumnLeft")?% +"TwoColumnLeft":"OneColumn"; +} +\end{insDLJS} +% \end{macrocode} +% \subsection{Links in running header} +% \DescribeMacro{\mobPrint}\cs{mobPrint} sets the text of the print link +% and the button caption if its a push button. +% \DescribeMacro{\mobToggleCols} \cs{mobToggleCols} sets +% the text for the toggle link and the button caption if its a push +% button. \DescribeMacro{\mobPrintTip}\cs{mobPrintTip} is the tool tip +% when there's a button for the print; while \DescribeMacro{\mobToggleColsTip} +% \cs{mobToggleColsTip} does the same for the toggle button. +% \begin{macrocode} +\newcommand{\mobPrint}[1]{\def\mob@print{#1}} +\mobPrint{Print} +\newcommand{\mobPrintTip}{Click to print this document in two-column + format, recommended.} +\newcommand{\mobToggleCols}[1]{\def\mob@toggleCols{#1}} +\mobToggleCols{Toggle Cols} +\newcommand{\mobToggleColsTip}{Click to toggle between single-column + and two-column page layouts.} +% \end{macrocode} +% \paragraph*{German language.} The following are redefinitions supplied +% by a user in the German language. +%\begin{verbatim} +%\mobPrint{Drucken} +%\renewcommand{\mobPrintTip}{Zum Drucken des Dokumentes hier klicken +% (zweispaltige Ansicht empfehlenswert).} +%\mobToggleCols{Spaltenansicht umschalten} +%\renewcommand{\mobToggleColsTip}{Zum Umschalten der Spaltenansicht +% (einspaltig oder zweispaltig) hier klicken.} +%\end{verbatim} +% \DescribeMacro{\mobFormPresets}\cs{mobFormPresets} is used to set +% the appearance of the buttons when the \texttt{useforms} option is taken. +% \begin{macrocode} +\newcommand{\mobFormPresets}[1]{% + \def\mob@FormPresets{#1}} +\mobFormPresets{\S{S}\BC{}\textSize{8}\autoCenter{n}} +% \end{macrocode} +% \DescribeMacro{\mobPrintIt}\DescribeMacro{\mobTwoCols} The commands +% \cs{mobPrintIt} sets the print link, while \cs{mobTwoCols} +% does the some for toggling. Each call their respective +% document level JS. They each have one optional parameter +% that is use to modify its appearance. +% \begin{macrocode} +\newcommand{\mobPrintIt}[1][]{% + \ifmob@useforms + {\footnotesize\def\ef@btnspcr{}% + \settoheight{\@tempdima}{\strut}% + \settodepth{\@tempdimb}{\strut}% + \addtolength{\@tempdima}{\@tempdimb}% + \raisebox{-\@tempdimb}{\pushButton[#1\F{-\FPrint} + \TU{\mobPrintTip} + \presets{\mob@FormPresets}% + \CA{\mob@print}\A{\JS{_printIt();}}% + ]{mobPrintIt}{}{\@tempdima}}}\else + \setLink[#1\A{\JS{_printIt();}}]{\mob@print}\fi +} +% \end{macrocode} +% \begin{macrocode} +\newcommand{\mobTwoCols}[1][]{% + \ifmob@useforms + {\footnotesize\def\ef@btnspcr{}% + \settoheight{\@tempdima}{\strut}% + \settodepth{\@tempdimb}{\strut}% + \addtolength{\@tempdima}{\@tempdimb}% + \raisebox{-\@tempdimb}{\pushButton[#1\F{-\FPrint} + \TU{\mobToggleColsTip}\presets{\mob@FormPresets}% + \CA{\mob@toggleCols}\A{\JS{_toggleViews();}}% + ]{mobToggleCols}{}{\@tempdima}}}\else + \setLink[#1\A{\JS{_toggleViews();}}]{\mob@toggleCols}\fi +} +% \end{macrocode} +% Here, we set the left header. If you want to change the +% appearance of the links, you need to execute this next +% line in the preamble with the optional parameter to change +% the appearances. This assumes the document is using +% the page style \texttt{webheadings}, as defined in \textsf{web}. +% \begin{macrocode} +\lheader{\mobPrintIt\relax\ifmob@useforms\kern3bp + \else\,/\,\fi\mobTwoCols\relax} +% \end{macrocode} +% \subsection{Add a page if odd} +% \DescribeMacro{\generateEvenPage} adds one more page +% to make an even number of pages. May be redefined as needed. +% \begin{macrocode} +\newcommand{\generateEvenPage}{\ifodd\value{page}\else + \newpage\lheader{}\null\fi} +\AtEndDocument{\generateEvenPage} +% +% \end{macrocode} +\endinput + +% iPad +% Landscape +% w: 7.75in +% h: 5.8in diff --git a/texmf-dist/source/latex/aeb-mobile/aeb_mobile.ins b/texmf-dist/source/latex/aeb-mobile/aeb_mobile.ins new file mode 100644 index 00000000..4cd143a4 --- /dev/null +++ b/texmf-dist/source/latex/aeb-mobile/aeb_mobile.ins @@ -0,0 +1,62 @@ +%% +%% 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{2018/04/26} +\def\batchfile{aeb_mobile.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{aeb_mobile.sty}{\from{aeb_mobile.dtx}{copyright,package}} + \file{aeb-mobile.sty}{\from{aeb_mobile.dtx}{copyright,altpkgname}} + \file{spdef.sty}{\from{spdef.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 diff --git a/texmf-dist/source/latex/aeb-mobile/doc/aebmobile_man.tex b/texmf-dist/source/latex/aeb-mobile/doc/aebmobile_man.tex new file mode 100644 index 00000000..b36bd955 --- /dev/null +++ b/texmf-dist/source/latex/aeb-mobile/doc/aebmobile_man.tex @@ -0,0 +1,324 @@ +% 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} diff --git a/texmf-dist/source/latex/aeb-mobile/spdef.dtx b/texmf-dist/source/latex/aeb-mobile/spdef.dtx new file mode 100644 index 00000000..1ea49d55 --- /dev/null +++ b/texmf-dist/source/latex/aeb-mobile/spdef.dtx @@ -0,0 +1,222 @@ +% \iffalse meta-comment +%<*internal> +\iffalse +% +%<*internal> +\fi +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +% +%<*install> +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +\endpreamble +\ifx\fmtname\nameofplainTeX +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{copyright,package}} +} +\fi +% +%\endbatchfile +%<*internal> +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile\else + \expandafter\endgroup\fi +% +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% spdef.sty package, 2012-01-22 %% +%% Copyright (C) 2012 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{spdef} +% [2012/08/20 v1.2 Defines a switch for smartphone] +%<*driver> +\documentclass{ltxdoc} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +% +% \fi +% +%\GetFileInfo{\jobname.sty} +% +%\title{The \textsf{spdef} Package} +%\author{D. P. Story} +%\date{Released \today} +% +%\maketitle +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \textbf{Description and Usage.} This is a short package to create the +% \cs{ifsmartphone} switch. The package is designed to be introduced early in the +% file, even before \cs{documentclass}. I use \cs{RequirePackage}, like so. +%\begin{verbatim} +% \RequirePackage[ph]{spdef} +% \documentclass[\ifsmartphone12pt\else10pt\fi]{article} +% \usepackage[fleqn]{amsmath} +% \usepackage[pdf,myconfigi,nopoints,answerkey]{eqexam} +%\ifsmartphone +% \usepackage[smartphone,nomaketitle,useforms]{aeb_mobile} +%\fi +%\end{verbatim} +% When you use \cs{usepackage}, there is an error which says no class file has been +% used, but apparently it is file to have \cs{RequirePackage} before a class file; +% consequently, it can be used to adjust the point size of the document. +% +% Version 1.2 of \textsf{aeb\_mobile} works better with \textsf{spdef}. Now if +% \cs{ifsmartphone} is false, \textsf{aeb\_mobile} does an early exit; consequently, +% surrounding it with the construct \cs{ifsmartphone}\dots\cs{fi} is no longer needed: +%\begin{verbatim} +% \RequirePackage[ph]{spdef} +% \documentclass[\ifsmartphone12pt\else10pt\fi]{article} +% \usepackage[fleqn]{amsmath} +% \usepackage[pdf,myconfigi,nopoints,answerkey]{eqexam} +% \usepackage[smartphone,nomaketitle,useforms]{aeb_mobile} +%\end{verbatim} +% See Section~\ref{phOpts} for more details and additional options. +% +% Another feature of this package is the automatic creation of Boolean switches. If you say +%\begin{verbatim} +% \RequirePackage[use=myswitch]{spdef} +%\end{verbatim} +%a new switch \cs{ifmyswitch} is created and given a value of true. If you say +%\begin{verbatim} +% \RequirePackage[!use=myswitch]{spdef} +%\end{verbatim} +%a new switch \cs{ifmyswitch} is created and given a value of false. See +% Section~\ref{s:onthefly} for more details. +% +% Of course, if you do not need to introduce \textsf{spdef} before the +% class in included, you can use the standard \cs{usepackage} command. +% +% \section{The Code} +% We begin by requiring \texttt{kvoptions}, this package does not test the the presence +% of a class file, so we can use it. It allows us to define key-values as options of the +% package. +% \begin{macrocode} +\RequirePackage{kvoptions}[2009/07/21] +% \end{macrocode} +% The package is primarily intended for use with the \textsf{aeb\_mobile} +% package, for formatting document for the \textsf{smartphone}, but I've since developed +% other applications of a package that is introduced early, see the definition +% of the \texttt{use} key. +% \begin{macrocode} +\newif\ifsmartphone \smartphonefalse +% \end{macrocode} +% \section{\textsf{smartphone} options}\label{phOpts} +% We offer two options \texttt{ph} and \texttt{pa}, additional options for other devices may be +% defined. +%\begin{itemize} +% \item \texttt{ph} sets the \cs{ifsmartphone} switch to true. The name \texttt{ph} +% stands for \underbar{ph}one. +% \item \texttt{pa} sets the \cs{ifsmartphone} switch to false. +% The name of the option, \texttt{pa}, stands for \underbar{pa}per. +%\end{itemize} +% \begin{macro}{ph} +% Option for phone: sets the switch \cs{ifsmartphone} to \texttt{true}. +% \begin{macro}{pa} +% Option for paper: sets the switch \cs{ifsmartphone} to \texttt{false}. +% \begin{macrocode} +\DeclareVoidOption{ph}{\smartphonetrue} +\DeclareVoidOption{pa}{\smartphonefalse} +% \end{macrocode} +% It's easy enough, lets do negatives of the two option above. \DescribeMacro{!ph}\texttt{!ph} +% is the same as \texttt{pa} and \DescribeMacro{!pa}\texttt{!pa} is the same as \texttt{ph}. +% \begin{macrocode} +\DeclareVoidOption{!ph}{\smartphonefalse} +\DeclareVoidOption{!pa}{\smartphonetrue} +% \end{macrocode} +% +% \section{Defining Boolean switches on the fly}\label{s:onthefly} +% Based on my own work, I've added in two more options \texttt{use} +% and \texttt{!use}. Suppose we want to create a switch, say \cs{ifforinstr}, +% we can say, +%\begin{verbatim} +% \usepackage[use=forinstr]{spdef} +%\end{verbatim} +% The \textsf{spdef} package would create a new Boolean \cs{ifforinstr} and assign it a +% value of \texttt{true}. If you want to compile the document with \cs{ifforinstr} having +% a value of \texttt{false}, we would modify the above options like so, +%\begin{verbatim} +% \usepackage[!use=forinstr]{spdef} +%\end{verbatim} +% \begin{macro}{use} +% The \texttt{use=} is a way to define/use a switch early in the +% compiling of the document, even before the document class is declared. +% The code below creates the switch +% \cs{if}, and sets it to \texttt{true}. The document that uses +% this switch should have this code in it: +%\begin{verbatim} +%\@ifundefined{if}{\newif\if\false}{} +%\end{verbatim} +% We can set this switch to \texttt{true} through the \textsf{spdef} package, otherwise, its +% value is \texttt{false}. +% \begin{macro}{!use} +% Given my last remarks on the \texttt{use} key, as a convenience, we declare the option \texttt{!use}. +% It does the same as \texttt{use}; it creates the switch but sets it to \texttt{false}. +% That way, you can say \texttt{use=useendnotes} and \cs{ifuseendnotes} is \texttt{true}, +% or, by prefixing \texttt{use} with an \texttt{!}, like so, \texttt{!use=useendnotes}, +% \textsf{spdef} defines/sets \cs{ifuseendnotes} to \texttt{false}. +% \begin{macrocode} +\define@key{spdef}{use}{\@ifundefined{#1}{% + \expandafter\newif\csname if#1\endcsname}{}\csname#1true\endcsname} +\define@key{spdef}{!use}{\@ifundefined{#1}{% + \expandafter\newif\csname if#1\endcsname}{}\csname#1false\endcsname} +% \end{macrocode} +% If the key is not used, back in the document that uses the switch, +%\begin{verbatim} +%\@ifundefined{if}{\newif\if\false}{} +%\end{verbatim} +% will set this value to \texttt{false}; in this case, you need to explicitly set +% the value of the switch yourself. +% \end{macro} +% \end{macro} +% \begin{macrocode} +\ProcessKeyvalOptions{spdef} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \DescribeMacro{\ifsp} \cmd{\ifsp}\meta{TRUE}\meta{FALSE} is a convenience command for the \cs{ifsmarphone} switch. It takes +% two arguments, the first one if the \cs{ifsmartphone} is true, the second one if not. +% \begin{macrocode} +\def\ifsp@default#1#2{\ifsmartphone + \expandafter\def\csname sp@next\endcsname{#1}\else + \expandafter\def\csname sp@next\endcsname{#2}\fi\sp@next} +\def\ifsp@expand#1#2{\ifsmartphone#1\else#2\fi} +\let\ifsp\ifsp@default +% \end{macrocode} +% \DescribeMacro{\expexe} is used to expand optional arguments that can be controlled +% using the switches defined by the \texttt{use} option. For example +%\begin{verbatim} +% \expexe{\usepackage[designiv\ifbw,forpaper\fi]{web}} +%\end{verbatim} +% A \cs{noexpand} is inserted before \texttt{\#1} and is intended to suppress the +% expansion of the \cs{usepackage} or \cs{documentclass}. +% \changes{v1.2}{2012/08/20}{Added \cs{expexe}} +% \begin{macrocode} +\newcommand{\expexe}[1]{\edef\sp@expexe{\noexpand#1}\sp@expexe} +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} +%\Finale -- cgit v1.2.3