add an install.sh script and integrate texmf files

This commit is contained in:
2021-03-09 15:29:49 +01:00
parent 7e7a5dca5d
commit 0bd9247f10
11 changed files with 4524 additions and 116 deletions

View File

@@ -1,80 +1,31 @@
# Table of Contents
1. [Requirements](#requirements)
2. [Installation](#installation)
3. [Packages](#packages)
1. [Installation](#installation)
2. [Packages](#packages)
1. [Org](#org)
2. [Multiple cursors](#multiple-cursors)
3. [Other packages](#other-packages)
4. [Information](#information)
5. [Errors](#errors)
6. [TODOs](#todos)
3. [Information](#information)
4. [Errors](#errors)
5. [TODOs](#todos)
This is an ongoing evolution of Emacs configuration files, inspired by
a bunch of online resources.
<a id="requirements"></a>
# Requirements
external packages:
# fonts (opensans in latex article preamble)
yay -S ttf-inconsolata ttf-opensans
# spelling flyspell-buffer
yay -S aspell aspell-de aspell-en \
hunspell hunspell-de hunspell-en_US \
languagetool
# org-mode latex-mode ox-latex
yay -S biber bibtex2html texlive-bibtexextra texlive-core \
texlive-fontsextra texlive-formatsextra texlive-langgreek \
texlive-langjapanese texlive-latexextra texlive-pgf-pie \
texlive-pgfopts texlive-pictures texlive-pstricks \
texlive-publishers texlive-science texlive-slashbox
# ledger-mode
yay -S ledger
# python-mode
yay -S python-pylint
# emacs-application-famework EAF
yay -S --needed git nodejs aria2 libreoffice wmctrl xdotool jre-openjdk \
python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-qrcode \
python-feedparser python-dbus python-pyinotify python-markdown \
python-grip filebrowser-bin python-epc
# other
yay -S ditaa plantuml r
Optional package for EAF see in Installation.
<a id="installation"></a>
# Installation
Install into `~/.config/emacs` (must be empty)
Run one of the following install script commands.
git clone http://gogs.weseng.de/daniel/emacs.git ~/.config/emacs
curl sh -c "$(curl -fsSL http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
wget sh -c "$(wget -O- http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
fetch sh -c "$(fetch -o - http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
or copy all files of this directory into your ~/.config/emacs directory
- for Emacs version < 27 create symbolic link to the init file
- `ln -s ~/.config/emacs/init ~/.emacs` (or `~/.emacs.el`,
`~/.emacs.d/init.el`)
LaTeX sytling files: copy/merge the `texmf` directory into your home
directory `~/texmf`
optional for EAF
yay --editmenu -S mupdf python-pymupdf
edit `PGKBUILD` file for `python-pymupdf` to:
prepare() {
cd "${_name}-${pkgver}"
patch --forward --strip=1 --input="${HOME}/.config/emacs/scripts/fix-pymupdf-library-linking-for-arcolinux.patch"
}
Installation path is `~/.config/emacs`. See details and other
installed linux packages as requirements inside `sripts/install.sh`.
<a id="packages"></a>

View File

@@ -5,70 +5,20 @@
This is an ongoing evolution of Emacs configuration files, inspired by
a bunch of online resources.
* Requirements
:PROPERTIES:
:CUSTOM_ID: requirements
:END:
external packages:
#+begin_src shell
# fonts (opensans in latex article preamble)
yay -S ttf-inconsolata ttf-opensans
# spelling flyspell-buffer
yay -S aspell aspell-de aspell-en \
hunspell hunspell-de hunspell-en_US \
languagetool
# org-mode latex-mode ox-latex
yay -S biber bibtex2html texlive-bibtexextra texlive-core \
texlive-fontsextra texlive-formatsextra texlive-langgreek \
texlive-langjapanese texlive-latexextra texlive-pgf-pie \
texlive-pgfopts texlive-pictures texlive-pstricks \
texlive-publishers texlive-science texlive-slashbox
# ledger-mode
yay -S ledger
# python-mode
yay -S python-pylint
# emacs-application-famework EAF
yay -S --needed git nodejs aria2 libreoffice wmctrl xdotool jre-openjdk \
python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-qrcode \
python-feedparser python-dbus python-pyinotify python-markdown \
python-grip filebrowser-bin python-epc
# other
yay -S ditaa plantuml r
#+end_src
Optional package for EAF see in Installation.
* Installation
:PROPERTIES:
:CUSTOM_ID: installation
:END:
Install into =~/.config/emacs= (must be empty)
Run one of the following install script commands.
#+begin_src sh
git clone http://gogs.weseng.de/daniel/emacs.git ~/.config/emacs
curl sh -c "$(curl -fsSL http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
wget sh -c "$(wget -O- http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
fetch sh -c "$(fetch -o - http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
#+end_src
#+RESULTS:
Installation path is =~/.config/emacs=. See details and other
installed linux packages as requirements inside =sripts/install.sh=.
or copy all files of this directory into your ~/.config/emacs directory
- for Emacs version < 27 create symbolic link to the init file
- =ln -s ~/.config/emacs/init ~/.emacs= (or =~/.emacs.el=,
=~/.emacs.d/init.el=)
LaTeX sytling files: copy/merge the =texmf= directory into your home
directory =~/texmf=
optional for EAF
#+begin_src shell
yay --editmenu -S mupdf python-pymupdf
#+end_src
edit =PGKBUILD= file for =python-pymupdf= to:
#+begin_example
prepare() {
cd "${_name}-${pkgver}"
patch --forward --strip=1 --input="${HOME}/.config/emacs/scripts/fix-pymupdf-library-linking-for-arcolinux.patch"
}
#+end_example
* Packages
:PROPERTIES:
:CUSTOM_ID: packages

137
scripts/install.sh Executable file
View File

@@ -0,0 +1,137 @@
#!/bin/sh
# Installation script for Arch and Debian (also WSL)
# run script:
# sh install.sh
# * Manual Installation
# Install into =~/.config/emacs= (must be empty)
# git clone http://gogs.weseng.de/daniel/emacs.git ~/.config/emacs
# or copy all files of this directory into your ~/.config/emacs directory
# - for Emacs version < 27 create symbolic link to the init file
# - =ln -s ~/.config/emacs/init ~/.emacs= (or =~/.emacs.el=,
# =~/.emacs.d/init.el=)
# LaTeX sytling files: copy/merge the =texmf= directory into your home
# directory =~/texmf=
# See package requirements inside the code
# INTERNAL
distro=$(lsb_release -is)
# echo $distro
case $distro in
"Arch")
echo "Arch found"
echo "Emacs installation"
yay -Syu --needed emacs-git \
yay -S ttf-inconsolata ttf-opensans noto-fonts-cjk \
yay -S aspell aspell-de aspell-en \
hunspell hunspell-de hunspell-en_US \
languagetool \
biber bibtex2html texlive-bibtexextra texlive-core \
texlive-fontsextra texlive-formatsextra texlive-langgreek \
texlive-langjapanese texlive-latexextra texlive-pgf-pie \
texlive-pgfopts texlive-pictures texlive-pstricks \
texlive-publishers texlive-science texlive-slashbox \
ledger \
python-pylint \
git nodejs aria2 libreoffice wmctrl xdotool jre-openjdk \
python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-qrcode \
python-feedparser python-dbus python-pyinotify python-markdown \
python-grip filebrowser-bin python-epc mupdf \
ditaa plantuml r
# TODO: python-pymupdf
# PGKBUILD with patch
# yay --editmenu -S python-pymupdf
# prepare() {
# cd "${_name}-${pkgver}"
# patch --forward --strip=1 --input="${HOME}/.config/emacs/scripts/fix-pymupdf-library-linking-for-arcolinux.patch"
# }
;;
"Debian")
echo "Debian found"
echo "Emacs installation"
sudo apt-get update
# sudo apt-get install emacs # version too old
# emacs-snapshot https://www.emacswiki.org/emacs/EmacsSnapshotAndDebian
# To enable adding a private repository.
sudo apt-get install -y software-properties-common wget
# To get the Apt signing key of emacs-snapshot
wget -q http://emacs.ganneff.de/apt.key -O- | sudo apt-key add
# Replace Buster with your version. check with: lsb_release -a; # repos are listed inside /etc/apt/sources.list
sudo add-apt-repository "deb http://emacs.ganneff.de/ buster main"
echo "Packages used by Emacs"
# language tool via snap
sudo apt-get update
sudo apt-get install -y emacs-snapshot \
fonts-inconsolata fonts-noto-cjk-extra \
aspell aspell-en aspell-de hunspell \
hunspell-en-us hunspell-de-de snapd \
biber bibtex2html texlive-bibtex-extra texlive-base \
texlive-fonts-extra texlive-formats-extra texlive-lang-greek \
texlive-lang-japanese texlive-latex-extra \
texlive-pictures texlive-pstricks \
texlive-publishers texlive-science \
ledger \
python3-pylint-common \
git nodejs aria2 libreoffice wmctrl xdotool default-jre \
python3-pyqt5 python3-pyqt5.qtwebengine python3-qrcodegen \
python3-feedparser python3-dbus python3-pyinotify python3-markdown \
python3-epc mupdf \
ditaa plantuml r-base
# TODO: not found: ttf-opensans
# texlive-pgf-pie texlive-pgfopts texlive-slashbox
# python-pyqt5-sip python-grip filebrowser-bin
# TODO: snap not supported for wsl
# https://wiki.ubuntuusers.de/LanguageTool/
sudo snap install core
sudo snap install languagetool
# Update Alternatives to ensure it uses the snapshot version of emacsclient.
echo "[NOTE] you may update alternatives of emacs and emacsclient."
echo "To list run:"
echo " update-alternatives --list emacs"
echo " update-alternatives --list emacsclient"
echo "To update run:"
echo " sudo update-alternatives --config emacsclient"
;;
*)
echo "unknown: \"${distro}\""
;;
esac
case $distro in
Arch|Debian)
echo "Emacs configuration"
mkdir -p ~/.config/emacs
echo "git clone"
git clone http://gogs.weseng.de/daniel/emacs.git ~/.config/emacs
cp -r ~/.config/emacs/scripts/texmf ~/
;;
*)
;;
esac
# TODO: texmf
#
# Microsoft
#
# NOT NEEDED AT THE MOMENT
# kernel_release=$(uname -r)
# check if system is Microsoft and what distro is used
# if test $(echo $kernel_release | grep -i microsoft); then
# # remove control characters ^@ ^M, (otherwise will be D^@e^@b^@i^@a^@n^@^M^@ ^@) see with: echo $distro | cat -v
# # distro=$(/mnt/c/Windows/System32/wsl.exe --list --running -q | tr -d "[:cntrl:]")
# distro=$(lsb_release -is)
# fi
# echo $distro

1140
scripts/texmf/bibtex/bst/acmu.bst Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
%%
%% This is file `dljscc.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% insdljs.dtx (with options: `copyright,cc4js')
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% insdljs.sty package, %%
%% Copyright (C) 2001-2018 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. %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\r{\eqesc r\ckivspace}
\def\t{\eqesc t\ckivspace}
\def\n{\eqesc n\ckivspace}
\def\f{\eqesc f\ckivspace}
\def\v{\eqesc v\ckivspace}
\def\b{\eqesc b\ckivspace}
\def\B{\eqesc B\ckivspace}
\def\d{\eqesc d\ckivspace}
\def\D{\eqesc D\ckivspace}
\def\s{\eqesc s\ckivspace}
\def\S{\eqesc S\ckivspace}
\def\w{\eqesc w\ckivspace}
\def\W{\eqesc W\ckivspace}
\begingroup
\catcode`\:=12\relax
\dljstfor\dlhex:={AA}{AB}{AC}{AD}{AE}{AF}%
{BA}{BB}{BC}{BD}{BE}{BF}{CA}{CB}{CC}{CD}{CE}{CF}%
{DA}{DB}{DC}{DD}{DE}{DF}{EA}{EB}{EC}{ED}{EE}{EF}%
{FA}{FB}{FC}{FD}{FE}{FF}\do{%
\expandafter\xdef\csname x\dlhex\endcsname{\noexpand\eqesc x\dlhex}%
}
\endgroup
\def\u{\eqesc u\ckivspace}
\def\0{\eqesc0}
\def\1{\eqesc1}
\def\2{\eqesc2}
\def\3{\eqesc3}
\definebraces
\def\({\eqesc\eqesci(}
\def\){\eqesc\eqesci)}
\def\.{\eqesc.}
\def\/{\eqesc/}
\def\[{\eqesc[}
\def\]{\eqesc]}
\def\|{\eqesc|}
\def\+{\eqesc+}
\def\*{\eqesc*}
\def\-{\eqesc-}
\def\?{\eqesc?}
\def\${\eqesc$}
\def\^{\eqesc^}
\def\\{\eqesc\eqesc}
\def\'{\eqesc'}
\catcode`\"=12
\def\"{\eqesc"}
\catcode`\<=12
\def\<{\eqesc<}
\catcode`\>=12
\def\>{\eqesc>}
\catcode`\%=12
\def\%{%}
\catcode`\%=14
\catcode`\& = 12
\def\&{\eqesc&}
\endinput
%%
%% End of file `dljscc.def'.

1374
scripts/texmf/tex/latex/eforms.sty Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
%%
%% This is file `epdftex.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% eforms.dtx (with options: `copyright,epdftex')
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% eForms package, %%
%% Copyright (C) 2002-2018 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. %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\noPeek#1#2{\global\pdfpageattr=\expandafter{\noPeekAction{#1}{#2}}}
\def\HyField@@AddToFields#1{%
\HyField@AfterAuxOpen{%
\if@filesw
\write\@mainaux{%
\string\HyField@AuxAddToFields{#1}}%
\ifisCalculate\write\@mainaux{%
\string\HyField@AuxAddToCoFields{}{#1}}\fi
\fi
}%
}%
\def\eq@choice@driver
{%
\Hy@pdfstringtrue
\if\@vertRotate1 \let\W@temp\eq@rectW\edef\eq@rectW{\eq@rectH}%
\edef\eq@rectH{\W@temp}\fi\centerWidget\eq@rectH
\ifx\autoCenter\ef@n\eqcenterWidget=0pt\fi
\hbox{\pdfstartlink user{\common@choiceCode}%
\lower\eqcenterWidget\ef@Bbox{\eq@rectW}{\eq@rectH}\pdfendlink}%
\HyField@AddToFields
\endgroup
}
\def\eq@Button@driver
{%
\Hy@pdfstringtrue
\ifx\eq@rectW\@empty\def\eq@rectW{\wd\eq@tmpbox}\ef@djXPD\fi
\if\@vertRotate1 \let\W@temp\eq@rectW\edef\eq@rectW{\eq@rectH}%
\edef\eq@rectH{\W@temp}\fi\centerWidget\eq@rectH
\ifx\autoCenter\ef@n\eqcenterWidget=0pt\fi
\ifx\eq@rectW\@empty\def\eq@rectW{\wd\eq@tmpbox}\fi
\hbox{\pdfstartlink user{ \common@pushButtonCode }%
\lower\eqcenterWidget\ef@Bbox{\eq@rectW}{\eq@rectH}\pdfendlink}%
\endgroup
}
\def\eq@RadioCheck@driver
{%
\Hy@pdfstringtrue
\if\@vertRotate1 \let\W@temp\eq@rectW\edef\eq@rectW{\eq@rectH}%
\edef\eq@rectH{\W@temp}\fi\centerWidget\eq@rectH
\ifx\autoCenter\ef@n\eqcenterWidget=0pt\fi
\ifx\eq@rectW\@empty\def\eq@rectW{\wd\eq@tmpbox}\fi
\hbox{\pdfstartlink user{\common@RadioCheckCode}%
\lower\eqcenterWidget\ef@Bbox{\eq@rectW}{\eq@rectH}\pdfendlink}%
\endgroup
}
\def\eq@l@check@driver
{%
\pdfstartlink user{\common@RadioCheckCode}%
\makebox[\eq@tmpdima]{\phantom{\link@@Content}}%
\pdfendlink\endgroup
}
\def\eq@TextField{\Hy@pdfstringtrue
\if\@vertRotate1 \let\W@temp\eq@rectW\edef\eq@rectW{\eq@rectH}%
\edef\eq@rectH{\W@temp}\fi\centerWidget\eq@rectH
\ifx\autoCenter\ef@n\eqcenterWidget=0pt\fi
\leavevmode
\hbox{\pdfstartlink user{\common@TextFieldCode}%
\lower\eqcenterWidget\ef@Bbox{\eq@rectW}{\eq@rectH}\pdfendlink}%
\HyField@AddToFields
\endgroup
}
\def\eq@SigField{\Hy@pdfstringtrue
\if\@vertRotate1 \let\W@temp\eq@rectW\edef\eq@rectW{\eq@rectH}%
\edef\eq@rectH{\W@temp}\fi\centerWidget\eq@rectH
\ifx\autoCenter\ef@n\eqcenterWidget=0pt\fi
\leavevmode\hbox{\pdfstartlink user{\common@SigFieldCode}%
\lower\eqcenterWidget\ef@Bbox{\eq@rectW}{\eq@rectH}\pdfendlink}%
\endgroup
}
\def\setLink@driver
{%
\@eqBS{}%
\leavevmode\pdfstartlink
attr {\eq@Border}%
user{/Subtype/Link \common@LinkCode}%
\Hy@colorlink{\@linkcolor}\link@@Box
\close@pdflink
\endgroup
}
\def\ef@setTabOrder{\ifx\ef@taborder\@empty\else
\edef\ef@tmp@toks{\the\pdfpageattr\space/Tabs/\ef@taborder}%
\global\pdfpageattr=\expandafter{\ef@tmp@toks}%
\fi\endgroup
}
\endinput
%%
%% End of file `epdftex.def'.

View File

@@ -0,0 +1,908 @@
%%
%% This is file `insdljs.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% insdljs.dtx (with options: `copyright,package')
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% insdljs.sty package, %%
%% Copyright (C) 2001-2018 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{insdljs}
[2017/09/03 v2.3g Insert Document Level JavaScripts (dps)]
\usepackage{xkeyval}
\RequirePackage{ifpdf}[2006/02/20]
\RequirePackage{ifxetex}[2006/08/21]
\RequirePackage{ifluatex}
\DeclareOptionX{dvipsone}{\def\dljs@drivernum{0}%
\AtBeginDocument{\dvips@marker}}
\DeclareOptionX{dvips}{\def\dljs@drivernum{0}%
\AtBeginDocument{\dvips@marker}}
\DeclareOptionX{textures}{\def\dljs@drivernum{0}%
\AtBeginDocument{\dvips@marker}}
\DeclareOptionX{pdftex}{\def\dljs@drivernum{1}}
\DeclareOptionX{luatex}{\def\dljs@drivernum{1}}
\DeclareOptionX{dvipdfm}{\def\dljs@drivernum{2}}
\DeclareOptionX{dvipdfmx}{\def\dljs@drivernum{2}}
\DeclareOptionX{xetex}{\def\dljs@drivernum{2}}
\let\dl@YES=y \let\dl@NO=n
\let\dl@One=1 \let\dl@Zero=0
\let\dljs@YES=y \let\dljs@NO=n
\def\dvips@marker{\ifx\dljspresent\dl@NO\@OAction\fi}
\let\isOpenAction\dl@NO
\DeclareOptionX{nodljs}{\let\importdljs\dl@NO}
\let\importdljs\dl@YES
\let\firstdljs\dl@YES
\let\dljspresent\dl@NO
\DeclareOptionX{debug}{\let\dljs@debug\dl@YES}
\let\dljs@debug\dl@NO
\DeclareOptionX{execJS}{\let\execjs\dl@YES}
\let\execjs\dl@NO
\DeclareOptionX{nopro}{\let\dl@gopro\dl@NO}
\let\dl@gopro\dl@YES
\@ifpackageloaded{web}{%
\ExecuteOptionsX{\eq@driver@name}%
}{%
\@ifpackageloaded{eforms}{%
\ExecuteOptionsX{\ef@driver}%
}{%
\ifpdf\ExecuteOptionsX{pdftex}\else
\ifxetex\ExecuteOptionsX{xetex}\else
\@ifundefined{l@tex@@@@driver}{\ExecuteOptionsX{dvips}}
{\ExecuteOptionsX{dvipsone}}\fi\fi
}%
}
\DeclareOptionX{reqjs}{\let\dl@reqJS\dl@YES}
\let\dljs@reqJS\dl@YES
\DeclareOptionX{!reqjs}{\let\dl@reqJS\dl@NO}
\DeclareOptionX{usealtadobe}{\def\inputAltAdbFncs{%
\InputIfFileExists{altadbfncs.def}%
{\PackageInfo{insdljs}{Inputting code for usealtadobe option}}%
{\PackageWarning{insdljs}{Cannot find altadbfncs.def.\MessageBreak
Reinstall or refresh your file name database.}}}}
\let\inputAltAdbFncs\relax
\ProcessOptionsX
\edef\dl@dquoteCat{\the\catcode`\"}
\catcode`\"=12\relax
\@ifundefined{dljs@drivernum}{%
\PackageError{insdljs}%
{You have not specified dvips, dvipsone, pdftex,\MessageBreak
dvipdfm, dvipdfmx, or xetex in the option list
\MessageBreak of the insdljs package}
{Place one of the drivers dvips, dvipsone, pdftex, dvipdfm,
dvipdfmx, or xetex
\MessageBreak in the option list of the insdljs package.}
}{}
\@ifundefined{ifpdfmarkup}{\newif\ifpdfmarkup}{}\pdfmarkupfalse
\ifpdf\else\ifxetex\else\pdfmarkuptrue\fi\fi
\RequirePackage{hyperref}
\ifpdf\ifx\pdfextension\@undefined\else
\protected\def\pdfnames{\pdfextension names }
\def\pdfpageref{\pdffeedback pageref}\fi\fi
\RequirePackage{verbatim}
\usepackage{conv-xkv}[2017/01/03]
\@ifundefined{dljs@drivernum}{%
\@ifundefined{eq@drivernum}{%
\PackageWarning{insdljs}
{No driver specified, will check for pdftex.}
\@ifundefined{pdfoutput}{%
\@ifundefined{@pdfm@mark}{\def\eq@drivernum{2}%
\def\dljs@drivernum{1}\let\isOpenAction\dl@NO
\PackageWarning{insdljs}{No pdftex, but detected dvipdfm}}%
{\PackageWarning{insdljs}{Neither pdftex nor dvipdfm,
assuming dvips/dvipsone.}%
\def\eq@drivernum{0}\def\dljs@drivernum{0}%
\let\isOpenAction\dl@YES}
}{%
\ifcase\pdfoutput
\def\eq@drivernum{1}\def\dljs@drivernum{1}%
\let\isOpenAction\dl@NO
\PackageInfo{insdljs}{Pdftex detected.}%
\else
\def\eq@drivernum{0}\def\dljs@drivernum{0}%
\let\isOpenAction\dl@YES
\PackageWarning{insdljs}{Pdftex engine detected,
but is outputting dvi. Assuming dvips as the driver.}%
\fi
}%
}{%
\begingroup
\count0=\eq@drivernum
\xdef\dljs@drivernum{\ifcase\count0 0\or1\or2\or0\else0\fi}
\ifnum\dljs@drivernum=0\global\let\isOpenAction\dl@YES
\else\global\let\isOpenAction\dl@NO\fi
\endgroup
}%
}{}
\ifnum\dljs@drivernum=1\relax
\RequirePackage{everyshi}
\fi
\def\AEB@psMrk{[\space}
\ifx\dl@reqJS\dl@YES
\def\dl@@reqJS{/Type/Requirement/S/EnableJavaScripts}
\ifpdf\pdfcatalog{\dl@@reqJS}\else
\ifxetex\immediate\@pdfm@mark{put @catalog <<\dl@@reqJS>>}\else
\literalps@out{\AEB@psMrk{Catalog} <<\dl@@reqJS>> /PUT pdfmark}\fi\fi
\fi
\providecommand\JS[1]{/S/JavaScript/JS(#1)}
\providecommand\Named[1]{/S/Named/N/#1}
\providecommand{\GoTo}{/S/GoTo/D}
\providecommand{\GoToD}{/S/GoTo/D}
\providecommand{\GoToR}{/S/GoToR}
\def\previewMiKTeX{\def\jsR{\string\r}\def\jsT{\string\t}}
{\obeylines %
\gdef\js@@R{\noexpand
}}
\let\dljstfor\@tfor
\def\jsR{\string\r\string\n}
\def\defineJSjsR{\string\r\eqbs^^J}
\def\jsN{\string\n}
{\catcode`\^^I\active %
\gdef^^I{\noexpand^^I}%
\gdef\js@@T{\noexpand^^I}%
}% end of \catcode`\^^I
\let\jsT=\js@@T
\newwrite\js@verbatim@out
\def\iwvo#1{\immediate\write\js@verbatim@out{#1}}
\def\dl@lparen{(}\def\dl@rparen{)}
\def\jscsDflt{\let\protect\noexpand\let\jslit\string
\let\~\dl@tilda\let\^\dl@sup
\def\\{\eqbs\eqbs}\def\cs##1{\\\\##1}%
\def\r{\\r}\def\t{\\t}\def\n{\\n}%
\let\{\dl@lBrace\let\}\dl@rBrace
\ifx\jsstr@useUni\dl@One\def\Uni{\\u}\else\def\u{\\u}\fi
\ifx\jsstr@parens\dl@One\let\l@paren\dl@lparen
\let\r@paren\dl@rparen\else
\let\l@paren\@empty\let\r@paren\@empty\fi
}
\def\jscsDLJS{\let\protect\noexpand\let\jslit\string
\let\~\dl@tilda\let\^\dl@sup
\ifxetex\def\\{\eqbs\eqbs}\else\def\\{\eqbs}\fi\def\cs##1{\\\\##1}%
\def\r{\\r}\def\t{\\t}\def\n{\\n}%
\let\{\dl@lBrace\let\}\dl@rBrace
\ifx\jsstr@useUni\dl@One\def\Uni{\\u}\else\def\u{\\u}\fi
\ifx\jsstr@parens\dl@One\let\l@paren\dl@lparen
\let\r@paren\dl@rparen\else
\let\l@paren\@empty\let\r@paren\@empty\fi
}
\ifpdf\let\jscsDLJS\jscsDflt\fi
\let\dl@JSCS\jscsDflt
\newcommand{\flJSStr}{\bgroup
\let\dl@JSCS\jscsDflt
\@ifstar{\def\isStar{*}\dl@defJSStr}
{\let\isStar\relax\dl@defJSStr}}
\let\fieldJSStr\flJSStr
\let\defineJSStr\flJSStr
\newcommand{\dlJSStr}{\bgroup
\@ifstar{\def\isStar{*}\let\dl@JSCS\jscsDLJS\dl@defJSStr}
{\let\isStar\relax\let\dl@JSCS\jscsDLJS\dl@defJSStr}}
\define@key{jsstr}{quotes}[]{\let\jsstr@quotes\dl@One}
\define@key{jsstr}{noquotes}[]{\let\jsstr@quotes\dl@Zero}
\define@key{jsstr}{parens}[]{\let\jsstr@parens\dl@One}
\define@key{jsstr}{noparens}[]{\let\jsstr@parens\dl@Zero}
\let\jsstr@quotes\dl@One\let\jsstr@parens\dl@One
\define@key{jsstr}{useUni}[]{\let\jsstr@useUni\dl@One}
\let\jsstr@useUni\dl@Zero
\newcommand{\dl@defJSStr}[3][quotes]{\def\dl@argi{#1}\ifx\dl@argi\@empty
\else\ifx\dl@JSCS\jscsDLJS\let\jsstr@parens\dl@Zero\fi
\setkeys{jsstr}{#1}\fi\dl@JSCS
\ifx\jsstr@quotes\dl@One
\xdef#2{\l@paren"#3"\r@paren}\else
\xdef#2{\l@paren#3\r@paren}\fi
\if\isStar*\gdef\dl@afterAction{{\Hy@unicodefalse\expandafter
\pdfstringdef\expandafter#2\expandafter{#2}}}\else
\global\let\dl@afterAction\relax\fi
\aftergroup\dl@afterAction\egroup}
\def\dlTC#1{try{#1}catch(e){}}
\def\js@R{\ifcase\dljs@drivernum^^J\else\jsR\fi}
\def\db#1\db{\ifx\dljs@debug\dl@YES\space\space\space#1\js@R\fi}
\newcounter{dljs@cnt}
\newcounter{dljssegs}\setcounter{dljssegs}{2}
\newenvironment{js@verbatimwrite}% writes to current \js@verbatim@out
{%
\@bsphack
\let\do\@makeother\dospecials\catcode`\^^M\active
\def\verbatim@processline{%
\immediate\write\js@verbatim@out{\the\verbatim@line}}%
\verbatim@start}{\@esphack}
\def\closejs@verbatim@out{\immediate\closeout\js@verbatim@out}
\begingroup
\catcode`\@=0 @catcode`@\=12
@gdef@eqbs{\}
@gdef@ccpdfmark{@gdef@eqesc{\}@gdef@eqesci{}}
@endgroup
\begingroup
\catcode`<=1 \catcode`\>=2 \@makeother\{ \@makeother\}
\gdef\definebraces<\def\{<\eqesc{>\def\}<\eqesc}>>
\endgroup
\def\eqdospecials{\do\ \do\{\do\}\do\$\do\&%
\do\#\do\^\do\_\do\~}
\begingroup
\catcode`\~=\active \lccode`\~=`\^^M
\lowercase{\endgroup
\def\eqverbatim@#1~{\verbatim@@#1*end\@nil}%
\def\eqverbatim@@#1*end{%
\verbatim@addtoline{#1}%
\futurelet\dl@next\eqverbatim@@@}%
\def\eqverbatim@@@#1\@nil{%
\ifx\dl@next\@nil
\verbatim@processline
\verbatim@startline
\let\dl@next\eqverbatim@
\else
\def\@tempa##1*end\@nil{##1}%
\@temptokena{*end}%
\def\dl@next{\expandafter\verbatim@test\@tempa#1\@nil~}%
\fi\dl@next}%
}%
\def\jsexpverbatimwrite
{% writes to current \js@verbatim@out
\@bsphack
\ccpdfmark
\catcode`\<=12 \catcode`\>=12
\input{dljscc.def}%
\let\verbatim@=\eqverbatim@
\let\verbatim@@=\eqverbatim@@
\let\verbatim@@@=\eqverbatim@@@
\let\do\@makeother\eqdospecials%
\catcode`\^^M=\active\catcode`\^^I=12%
\def\verbatim@processline{%
\edef\expVerb{\the\verbatim@line}%
\immediate\write\js@verbatim@out{\expVerb}}%
\verbatim@start%
}
\def\endjsexpverbatimwrite{\immediate\closeout\js@verbatim@out\@esphack}
\let\js@Path\@empty
\def\insPath#1{\def\js@Path{#1}}
\begingroup
\catcode`\{=12 \catcode`\}=12 \catcode`\<=1 \catcode`\>=2
\gdef\dl@lBrace<\string\{> \gdef\dl@rBrace<\string\}>
\gdef\dl@tilda<\string~> \gdef\dl@sup<\string^>
\endgroup
\def\makeJSspecials{%
\def\\{\eqbs\eqbs}% % define \\ to be \\
\let\jslit\string
\let\{\dl@lBrace\let\}\dl@rBrace
\let\u\@empty
\def\({\eqbs(}\def\){\eqbs)}%
\makespecialJS % make \r=\jsR and \t=\jsT
}
\def\dl@fitpage{/Fit}
\def\dl@actualsize{/XYZ null null 1.0} %{/XYZ -32768 -32768 1.0}
\def\dl@fitwidth{/FitH null} %{/FitH -32768}
\def\dl@fitheight{/FitV null} %{/FitV -32768}
\def\dl@fitvisible{/FitBH null} %{/FitBH -32768}
\def\dl@inheritzoom{/XYZ 0 0 0}
\def\dl@mag#1{/XYZ null null #1}
\edef\dl@Page#1{\ifcase\dljs@drivernum
{Page#1}\or\noexpand\pdfpageref#1\space\space 0 R\or
@page#1\fi}
\def\dl@preProcDefns{\let\Page\dl@Page\let\mag\dl@mag
\let\fitpage\dl@fitpage\let\actualsize\dl@actualsize
\let\fitwidth\dl@fitwidth\let\fitheight\dl@fitheight
\let\fitvisible\dl@fitvisible\let\inheritzoom\dl@inheritzoom
}
\let\aeb@additionalOpenAction\@empty
\let\aeb@addActionCode\@empty
\let\addActionObj\@empty
\let\aebpopentoks\@empty
\let\aebpFA\dl@NO
\def\aebp@rightDelimiters{}
\newcommand{\addToDocOpen}[1]{%
\ifx\aebpFA\dl@NO
\g@addto@macro\aebpopentoks{#1}%
\def\aeb@additionalOpenAction{/Next {pubAddToDocOpen}}%
\ifpdf
\def\aeb@addActionCode{\immediate\pdfobj{<<
\aebpopentoks\aebp@rightDelimiters >>}%
\edef\addActionObj{\the\pdflastobj\space 0 R}}%
\else\ifxetex
\def\aeb@addActionCode{\immediate
\@pdfm@mark{obj @objAddActionObj
<< \aebpopentoks\aebp@rightDelimiters >> }}%
\def\addActionObj{@objAddActionObj}%
\else % postscript
\def\aeb@addActionCode{\literalps@out{%
\AEB@psMrk/_objdef {pubAddToDocOpen}
/type/dict /OBJ pdfmark^^J%
\AEB@psMrk{pubAddToDocOpen} <<
\aebpopentoks\aebp@rightDelimiters >> /PUT pdfmark}}%
\def\addActionObj{{pubAddToDocOpen}}%
\fi\fi
\global\let\aebpFA\dl@YES
\let\@pdfstartview\@empty
\else
\edef\aebp@dljstmp{\aebp@rightDelimiters}%
\xdef\aebp@rightDelimiters{\aebp@dljstmp >> }%
\g@addto@macro\aebpopentoks{/Next << #1 }%
\fi
}
\def\dljs@OpenActions{/OpenAction \addActionObj}
\def\dljs@setOpenActions{\bgroup\makeJSspecials\dl@preProcDefns
\aeb@addActionCode
\ifpdf\pdfcatalog{\dljs@OpenActions}\else
\ifxetex\immediate
\@pdfm@mark{put @catalog <<\dljs@OpenActions>>}\else
\literalps@out{\AEB@psMrk
{Catalog} <<\dljs@OpenActions>> /PUT pdfmark}\fi\fi\egroup}
\@ifpackageloaded{aeb_pro}{}
{\AtBeginDocument{\ifx\aebpFA\dl@YES\expandafter
\dljs@setOpenActions\fi}}
\let\@CloseAction\@empty
\def\@OAction@pdfmark{\literalps@out{%
\AEB@psMrk{ThisPage} << /AA << /O << \theFirstAction\space
\opentoks\@rightDelimiters >> \@CloseAction >> >> /PUT pdfmark}}
\def\@POAction@pdfmark{\literalps@out{%
\AEB@psMrk{ThisPage} << /AA << \@thisOpenAction
\@thisCloseAction >> >> /PUT pdfmark}%
}
\def\@OAction@pdftex{%
\ifx\isOpenAction\dl@YES
\xdef\pdftexOAction{/AA << /O << \theFirstAction\space
\opentoks\@rightDelimiters >> \@CloseAction >>}%
\AtNextShipout{\pdfpageattr=\expandafter{\pdftexOAction}}%
\fi
}
\def\@POAction@pdftex{%
\xdef\thisPageActionpdftex{/AA << \@thisOpenAction
\@thisCloseAction >>}%
\AtNextShipout{\pdfpageattr=\expandafter{\thisPageActionpdftex}}%
}
\def\@OAction@dvipdfm{\ifx\isOpenAction\dl@YES
\@pdfm@mark{put @thispage << /AA << /O << \theFirstAction\space
\opentoks\@rightDelimiters >> \@CloseAction >> >>}\fi
}
\def\@POAction@dvipdfm{%
\@pdfm@mark{put @thispage << /AA << \@thisOpenAction
\@thisCloseAction >> >>}%
}
\ifcase\dljs@drivernum
\let\@OAction\@OAction@pdfmark
\let\@POAction\@POAction@pdfmark
\gdef\theFirstAction{/S/JavaScript/JS (\the\importfdftoks)}
\let\isOpenAction\dl@YES
\or
\let\@OAction\@OAction@pdftex
\let\@POAction\@POAction@pdftex
\AtBeginDocument{\@OAction@pdftex}
\or
\let\@OAction\@OAction@dvipdfm
\let\@POAction\@POAction@dvipdfm
\AtBeginDocument{\@OAction@dvipdfm}
\fi
\def\opentoks{}
\def\makespecialJS{%
\let\r\jsR\let\t\jsT\let\n\jsN}
\def\@rightDelimiters{}
\def\OpenAction{\@ifnextchar\Next
{\expandafter\@OpenAction\@gobble}{\@OpenAction}}
\def\@OpenAction#1{%
\ifx\isOpenAction\dl@NO
{\makespecialJS\xdef\theFirstAction{#1}}%
\global\let\isOpenAction\dl@YES
\else
\edef\dljstmp{\@rightDelimiters}%
\xdef\@rightDelimiters{\dljstmp >> }%
{\makespecialJS\xdef\dljstmp{\opentoks /Next << #1 }}%
\xdef\opentoks{\dljstmp}%
\fi
\@nextOpenAction
}
\def\@nextOpenAction{\@ifnextchar\Next{\expandafter
\@OpenAction\@gobble}{}}
\def\protectJSCtrls{\def\r{\string\r\string\n}%
\def\t{\string\t}\def\n{\string\n}}
\def\dljs@tstlp{\@ifnextchar\bgroup
{\let\dljs@multi\dl@YES\dljs@tstlpi}%
{\let\dljs@multi\dl@NO\dljs@tstlpi}}
\def\dljs@tstlpi#1\@nil{}%
\def\dljs@bldScript#1#2#3{{%
\dljs@tstlp#1\@nil
\ifx\dljs@multi\dl@NO{\protectJSCtrls\xdef#3{/#2<<#1>>}}\else
\toks0={}\let\dljs@rAngles\@empty\count0=0
\@tfor\dljs@arg:=#1\do{%
\ifnum\count0=0
\toks0=\expandafter{\dljs@arg}\else
\toks2=\expandafter{\dljs@arg}%
\edef\holdtokstmp{\the\toks0
/Next<<\the\toks2 }%
\edef\dljs@rAngles{\dljs@rAngles\space>>}%
\toks0=\expandafter{\holdtokstmp}%
\fi
\advance\count0by1
}%
{\protectJSCtrls\xdef#3{/#2<<\the\toks0 \dljs@rAngles>>}%
\xdef#3{#3}}%
\fi
}}
\newcommand{\thisPageAction}[2]{%
\let\@CloseAction\@empty
\let\@thisOpenAction\@empty
\let\@thisCloseAction\@empty
\def\dljs@argi{#1}\def\dljs@argii{#2}%
\ifnum\value{page}=1\relax
\ifx\dljs@argii\@empty\else
\dljs@bldScript{#2}{C}{\@CloseAction}\fi
\ifx\dljs@argi\@empty\else\dljs@tstlp#1\@nil
\ifx\dljs@multi\dl@NO\OpenAction{#1}\else
\@tfor\dljs@arg:=#1\do{\expandafter
\OpenAction\expandafter{\dljs@arg}%
}\fi
\fi
\else
\ifx\dljs@argi\@empty\else
\dljs@bldScript{#1}{O}{\@thisOpenAction}\fi
\ifx\dljs@argii\@empty\else
\dljs@bldScript{#2}{C}{\@thisCloseAction}\fi
\@POAction
\fi
}
\let\insdljsloadVar\@empty
\newenvironment{insDLJS}[3][]
{%
\gdef\detectdljs{#1}\gdef\dljsBase{#2}%
\ifxetex{\def\1{\string\1}\def\2{\string2}%
\def\3{\string\3}\xdef\dljsName{#3}}\else
\Hy@unicodefalse\pdfstringdef{\dljsName}{#3}\fi
\ifx\detectdljs\@empty
\stepcounter{dljs@cnt}%
\xdef\detectdljs{_bInsdljsload\arabic{dljs@cnt}}%
\edef\insdljsloadVar{var \detectdljs=true;}%
\addtocounter{dljs@cnt}{-1}%
\fi
\global\let\multisegments\dl@NO\setcounter{dljssegs}{2}%
\global\dljsobjtoks={}%
\expandafter\ifx\csname dljs\dljsBase\endcsname\relax
\else\@insjserrDuplicate\fi
\ifcase\dljs@drivernum
\let\insert@DLJS=\insert@DLJS@pdfmark
\let\endinsDLJS=\endinsert@DLJS@pdfmark
\let\newsegment=\newsegment@pdfmark
\let\endnewsegment=\endnewsegment@pdfmark
\or
\let\insert@DLJS=\insert@DLJS@pdftex
\let\endinsDLJS=\endinsert@DLJS@pdftex
\let\newsegment=\newsegment@pdftex
\let\endnewsegment=\endnewsegment@pdftex
\or
\let\insert@DLJS=\insert@DLJS@dvipdfm
\let\endinsDLJS=\endinsert@DLJS@dvipdfm
\let\newsegment=\newsegment@dvipdfm
\let\endnewsegment=\endnewsegment@dvipdfm
\fi
\insert@DLJS
}{}
\newenvironment{insDLJS*}[2][]
{%
\gdef\detectdljs{#1}\gdef\dljsBase{#2}%
\ifx\detectdljs\@empty
\stepcounter{dljs@cnt}%
\xdef\detectdljs{_bInsdljsload\arabic{dljs@cnt}}%
\edef\insdljsloadVar{var \detectdljs=true;}%
\addtocounter{dljs@cnt}{-1}%
\fi
\global\let\multisegments\dl@YES\setcounter{dljssegs}{2}%
\global\dljsobjtoks={}%
\expandafter\ifx\csname dljs\dljsBase\endcsname\relax
\else\@insjserrDuplicate\fi
\ifcase\dljs@drivernum
\let\insert@DLJS=\insert@DLJS@pdfmark
\expandafter
\let\csname endinsDLJS*\endcsname\endinsert@DLJS@pdfmark
\let\newsegment=\newsegment@pdfmark
\let\endnewsegment=\endnewsegment@pdfmark
\or
\let\insert@DLJS=\insert@DLJS@pdftex
\expandafter
\let\csname endinsDLJS*\endcsname\endinsert@DLJS@pdftex
\let\newsegment=\newsegment@pdftex
\let\endnewsegment=\endnewsegment@pdftex
\or
\let\insert@DLJS=\insert@DLJS@dvipdfm
\expandafter
\let\csname endinsDLJS*\endcsname\endinsert@DLJS@dvipdfm
\let\newsegment=\newsegment@dvipdfm
\let\endnewsegment=\endnewsegment@dvipdfm
\fi
\insert@DLJS
}{}
\def\@insjserrDuplicate{%
\typeout{^^J! insdljs Package error.}
\typeout{! insDLJS environment: On line number \the\inputlineno,}
\typeout{! the base name `\dljsBase' has already been chosen.}
\typeout{! A DLJS earlier defined has been overwritten!}
\typeout{! Choose another name for the first required argument}
\typeout{! of the insDLJS environment.^^J}
}
\newif\ifisdljs \isdljsfalse
\begingroup
\catcode`\~=12 \catcode`\#=12
\gdef\efdlspecials{\catcode`\~=12 \catcode`\#=12}
\endgroup
\def\ckivspace#1{\if\noexpand#1\space\else\expandafter#1\fi}
\let\DLspecialDefs\@empty
\def\fdfAfterheader
{%
\iwvo{\string\begingroup\string\efdlspecials}
\iwvo{\string\DLspecialDefs}
\iwvo{\string\isdljstrue}
\iwvo{\string\makeatletter}
\iwvo{\string\immediate\string\openout\string
\js@verbatim@out=\string\js@Path\space\dljsBase.fdf}%
\iwvo{\string\begin{jsexpverbatimwrite}}
\iwvo{\string\firstFDFline}
\iwvo{1 0 obj}
\iwvo{<< /FDF << /JavaScript << /Doc 2 0 R /After 3 0 R >> >> >> }
\iwvo{endobj}
\iwvo{2 0 obj}
\ifpdfmarkup
\iwvo{[ (ExecJS \dljsBase) (var _\dljsBase\space = true;) ] }\else
\iwvo{[ (00 ExecJS \dljsBase) (var _\dljsBase\space = true;) ] }\fi
\iwvo{endobj}
\iwvo{3 0 obj}
\iwvo{<<>>}
\iwvo{stream}
}
\newenvironment{execJS}[1]
{%
\gdef\detectdljs{\string_#1}\gdef\dljsBase{#1}%
\global\dljsobjtoks={}%
\expandafter\gdef\csname dljs\dljsBase\endcsname{}%
\ifx\importdljs\dl@YES\ifx\execjs\dl@YES
\ifx\dl@gopro\dl@YES
\ifnum\dljs@drivernum=0\relax
\addImportAnFDF\importAnFDFTemplate
\else
\OpenAction{/S/JavaScript/JS (\importAnFDFTemplate)}%
\fi\fi
\fi\fi
\immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
\fdfAfterheader
\js@verbatimwrite
}{%
\fdfendstreamobj
\endjs@verbatimwrite
\fdftrailer
\closejs@verbatim@out
\expandafter\xdef\csname\dljsBase OBJ\endcsname{\the\dljsobjtoks}%
\edef\@dljstmp{\noexpand\AtBeginDocument{%
\noexpand\input{\js@Path\dljsBase.djs}}}\@dljstmp
}
\newtoks\JStoks
\newenvironment{defineJS}[2][]
{%
\expandafter\@ifundefined\expandafter{%
\expandafter\@gobble\string#2}{}{%
\PackageWarning{insdljs}{The command
\string#2 already defined}}%
\gdef\defineJSArg{#2}\JStoks={}%
\def\verbatim@processline
{%
\xdef\JS@temp{\the\JStoks\the\verbatim@line\defineJSjsR}%
\global\JStoks=\expandafter{\JS@temp}%
}%
\let\do\@makeother\dospecials\catcode`\^^M\active
#1%
\verbatim@start
}{\gdef\eq@JStemp{\expandafter\edef\defineJSArg{\the\JStoks}}%
\aftergroup\eq@JStemp}
\newenvironment{@defineJS}[2][]
{%
\gdef\defineJSArg{#2}\JStoks={}%
\def\verbatim@processline
{%
\xdef\JS@temp{\the\JStoks\the\verbatim@line\defineJSjsR}%
\global\JStoks=\expandafter{\JS@temp}%
}%
\let\do\@makeother\dospecials\catcode`\^^M\active
#1%
\verbatim@start
}{\gdef\eq@JStemp{\expandafter\edef\defineJSArg{\the\JStoks}}%
\aftergroup\eq@JStemp}
\newenvironment{localJS}[1][]{}{\ifvmode\else\unskip\fi}
\newenvironment{willClose}[1][]
{\@defineJS[#1]{\will@Close}}
{\end@defineJS}
\let\will@Close\@empty
\newenvironment{willSave}[1][]
{\@defineJS[#1]{\will@Save}}
{\end@defineJS}
\let\will@Save\@empty
\newenvironment{didSave}[1][]
{\@defineJS[#1]{\did@Save}}
{\end@defineJS}
\let\did@Save\@empty
\newenvironment{willPrint}[1][]
{\@defineJS[#1]{\will@Print}}
{\end@defineJS}
\let\will@Print\@empty
\newenvironment{didPrint}[1][]
{\@defineJS[#1]{\did@Print}}
{\end@defineJS}
\let\did@Print\@empty
\def\dljs@willDidActions{/AA <<
\ifx\test@will@Close\@empty\else/WC <<
\JS{\will@Close} >>\fi
\ifx\test@will@Save\@empty\else/WS <<
\JS{\will@Save} >>\fi
\ifx\test@did@Save\@empty\else/DS <<
\JS{\did@Save} >>\fi
\ifx\test@will@Print\@empty\else/WP <<
\JS{\will@Print} >>\fi
\ifx\test@did@Print\@empty\else/DP <<
\JS{\did@Print} >>\fi
>>
}
\newcommand\dljs@setDocActions{%
\edef\test@will@Close{\will@Close}%
\edef\test@will@Save{\will@Save}%
\edef\test@did@Save{\did@Save}%
\edef\test@will@Print{\will@Print}%
\edef\test@did@Print{\did@Print}%
\ifpdf\pdfcatalog{\dljs@willDidActions}\else
\ifxetex\immediate
\@pdfm@mark{put @catalog <<\dljs@willDidActions>>}\else
\literalps@out{\AEB@psMrk
{Catalog} <<\dljs@willDidActions>> /PUT pdfmark}\fi\fi
}
\@ifpackageloaded{aeb_pro}{}
{\AtBeginDocument{\dljs@setDocActions}}
\begingroup
\catcode`\%=12
\gdef\firstFDFline{%FDF-1.2}
\gdef\lastFDFline{%%EOF}
\endgroup
\def\fdfheader
{%
\iwvo{\string\begingroup\string\efdlspecials}
\iwvo{\string\isdljstrue}
\iwvo{\string\makeatletter}
\iwvo{\string\immediate\string\openout\string
\js@verbatim@out=\string\js@Path\space\dljsBase.fdf}%
\iwvo{\string\begin{jsexpverbatimwrite}}
\iwvo{\string\firstFDFline}
\iwvo{1 0 obj}
\iwvo{<< /FDF << /JavaScript << /Doc 2 0 R >> >> >>}
\iwvo{endobj}
\iwvo{2 0 obj}
\iwvo{[ \string\csname\string\@gobble\space\dljsBase%
OBJ\string\endcsname]}
\iwvo{endobj}
}
\def\fdfbeginstreamobj
{%
\iwvo{\thedljssegs\space 0 obj}
\iwvo{<<>>}
\iwvo{stream}
\ifx\insdljsloadVar\@empty\else
\iwvo{\insdljsloadVar}
\global\let\insdljsloadVar\@empty
\fi
}
\def\fdfendstreamobj{%
\iwvo{endstream}
\iwvo{endobj}
}
\def\fdftrailer{%
\iwvo{trailer}
\iwvo{<< /Root 1 0 R >>}
\iwvo{\string\lastFDFline}
\iwvo{*end{jsexpverbatimwrite}}
\iwvo{\string\endgroup}
}
\newtoks\importfdftoks \importfdftoks={}
\newtoks\dljsobjtoks \dljsobjtoks={}
\def\importAnFDFTemplate{%
if(typeof \detectdljs\space == "undefined")\jsR\jsT
( app.viewerVersion > 8 ) ? %
aebTrustedFunctions( this, aebImportAnFDF, %
"\js@Path\dljsBase.fdf") : %
this.importAnFDF("\js@Path\dljsBase.fdf");\jsR
}
\def\addImportAnFDF#1{%
\ifx\importdljs\dl@YES
\edef\importAnFDFtmp{\the\importfdftoks#1}%
\global\importfdftoks=\expandafter{\importAnFDFtmp}%
\fi
}
\def\importAnFDF{\ifx\importdljs\dl@YES\@OAction\fi}
\newenvironment{newsegment@pdfmark}[1]{%
\addtocounter{dljssegs}{1}%
\addtocounter{dljs@cnt}{1}%
\Hy@unicodefalse\pdfstringdef{\dljsName}{#1}%
\edef\@dljstmp{\the\dljsobjtoks(\dljsName)
\thedljssegs\space 0 R\space}
\global\dljsobjtoks=\expandafter{\@dljstmp}
\fdfbeginstreamobj
\js@verbatimwrite
}{%
\fdfendstreamobj
\endjs@verbatimwrite
}
\def\insert@DLJS@pdfmark{%
\global\let\dljspresent\dl@YES
\expandafter\gdef\csname dljs\dljsBase\endcsname{}%
\ifx\importdljs\dl@YES\ifx\dl@gopro\dl@YES
\addImportAnFDF\importAnFDFTemplate
\fi\fi
\immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
\fdfheader
\ifx\multisegments\dl@NO\expandafter
\newsegment\expandafter{\expandafter\dljsName\expandafter}\fi
}
\def\endinsert@DLJS@pdfmark{%
\ifx\importdljs\dl@YES
\ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
\fdftrailer
\closejs@verbatim@out
\expandafter\xdef\csname\dljsBase%
OBJ\endcsname{\the\dljsobjtoks}%
\edef\@dljstmp{\noexpand\AtBeginDocument{%
\noexpand\input{\js@Path\dljsBase.djs}}}%
\@dljstmp
\ifx\firstdljs\dl@YES
\AtBeginDocument{\edef\@dljstmp{\importAnFDF}%
\@dljstmp}\global\let\firstdljs\dl@NO
\fi
\fi
}
\begingroup
\catcode`\@=0 @catcode`@\=12
@gdef@ccpdftex{@gdef@eqesc{\\}@gdef@eqesci{\}}
@endgroup
\def\begindljs
{%
\iwvo{\string\begingroup\string\efdlspecials}
\iwvo{\string\isdljstrue}
\iwvo{\string\makeatletter}
{\uccode`c=`\%\uppercase{%
\iwvo{\string\obeyspaces\string\obeylines
\string\let\string^\string^M=\string\jsR c}}}
{\escapechar=-1 \lccode`C=`\%\lowercase{%
\iwvo{\string\\catcode`\string\\"=12C}}}
}
\def\beginseg
{%
{\lccode`P=`\{\lccode`C=`\%\lowercase{%
\iwvo{\string\gdef\string\dljs\dljsBase\roman{dljssegs}PC}}}%
}
\def\endseg
{%
{\uccode`c=`\%\uccode`p=`\}\uppercase{\iwvo{pc}}}%
}
\def\enddljs
{%
\iwvo{\string\endgroup}%
}
\def\@roman#1{\romannumeral#1}
\def\write@objs
{%
\iwvo{\begingroup}
\iwvo{\string\catcode`\string\<=12 }
\iwvo{\string\catcode`\string\>=12 }
{\lccode`C=`\%\lowercase{\iwvo{\string\ccpdftex C}}}
{\lccode`C=`\%\lowercase{\iwvo{%
\string\input{dljscc.def}C\the\dljsobjtoks}}}
\iwvo{\endgroup}
}
\newenvironment{newsegment@pdftex}[1]{%
\addtocounter{dljssegs}{1}%
\addtocounter{dljs@cnt}{1}%
\edef\tmp{^^J\string\immediate\string\pdfobj{ << /S/JavaScript/JS%
(\string\dljs\dljsBase\roman{dljssegs}) >> }}%
\edef\@dljstmp{\the\dljsobjtoks\tmp}%
\global\dljsobjtoks=\expandafter{\@dljstmp}%
\edef\tmp{^^J\string\xdef\string\obj\dljsBase\roman{dljssegs}%
{\string\the\string\pdflastobj\string\space 0 R}}%
\edef\@dljstmp{\the\dljsobjtoks\tmp}%
\global\dljsobjtoks=\expandafter{\@dljstmp}%
\edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
\Hy@unicodefalse\pdfstringdef{\dljsName}{#1}%
\edef\dljspdftextmp
{\the\importfdftoks (\curr@Cnt\space\dljsName)
\noexpand\csname obj\dljsBase\roman{dljssegs}%
\noexpand\endcsname\space}%
\global\importfdftoks=\expandafter{\dljspdftextmp}%
\beginseg
\js@verbatimwrite
}{%
\endjs@verbatimwrite
\endseg
}
\newenvironment{insert@DLJS@pdftex}{%
\expandafter\gdef\csname dljs\dljsBase\endcsname{}%
\immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
\begindljs
\ifx\multisegments\dl@NO\expandafter
\newsegment\expandafter{\expandafter\dljsName\expandafter}\fi
}{%
\ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
\enddljs
\write@objs
\endjs@verbatimwrite
\closejs@verbatim@out
\edef\@dljstmp{\noexpand\AtBeginDocument{%
\noexpand\input{\js@Path\dljsBase.djs}}}%
\@dljstmp
\ifx\importdljs\dl@YES
\ifx\firstdljs\dl@YES
\AtEndDocument{\edef\@dljstmp{\setDLJSRef@pdftex}\@dljstmp}
\global\let\firstdljs\dl@NO
\fi
\fi
}
\def\setDLJSRef@pdftex
{%
\noexpand\immediate\noexpand\pdfobj {%
<< /Names [\the\importfdftoks] >> }%
\edef\noexpand\objNames{\noexpand\the\noexpand\pdflastobj\space 0 R}%
\pdfnames {/JavaScript \noexpand\objNames}%
}
\newenvironment{newsegment@dvipdfm}[1]
{%
\addtocounter{dljssegs}{1}%
\addtocounter{dljs@cnt}{1}%
\edef\tmp{^^J\string\immediate\string
\csname\space @pdfm@mark\string\endcsname
{obj @obj\dljsBase\roman{dljssegs}\space << /S/JavaScript%
/JS(\string\dljs\dljsBase\roman{dljssegs}) >> }}%
\edef\@dljstmp{\the\dljsobjtoks\space\tmp}%
\global\dljsobjtoks=\expandafter{\@dljstmp}%
\edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
{\def\1{\string\1}\def\2{\string2}%
\def\3{\string\3}\xdef\dljsName{#1}}%
\edef\dljspdftextmp
{\the\importfdftoks (\curr@Cnt\space \dljsName) %
@obj\dljsBase\roman{dljssegs}\space}%
\global\importfdftoks=\expandafter{\dljspdftextmp}%
\beginseg
\js@verbatimwrite
}{%
\endjs@verbatimwrite
\endseg
}
\def\setDLJSRef@dvipdfm
{%
\immediate\@pdfm@mark{obj @objnames %
<< /Names [\the\importfdftoks] >> }%
\@pdfm@mark{put @names %
<< /JavaScript @objnames >> }%
}
\newenvironment{insert@DLJS@dvipdfm}
{%
\expandafter\gdef\csname dljs\dljsBase\endcsname{}%
\immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
\begindljs
\ifx\multisegments\dl@NO\expandafter\newsegment\expandafter{%
\expandafter\dljsName\expandafter}\fi
}{%
\ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
\enddljs
\write@objs
\endjs@verbatimwrite
\closejs@verbatim@out
\edef\@dljstmp{\noexpand\AtBeginDocument{%
\noexpand\input{\js@Path\dljsBase.djs}}}%
\@dljstmp
\ifx\importdljs\dl@YES
\ifx\firstdljs\dl@YES
\AtBeginDocument{\setDLJSRef@dvipdfm}%
\global\let\firstdljs\dl@NO
\fi
\fi
}
\catcode`\"=\dl@dquoteCat
\inputAltAdbFncs
\endinput
%%
%% End of file `insdljs.sty'.

View File

@@ -0,0 +1,485 @@
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.25 2013/08/06 17:46:08 tantau Exp $
% Driver commands for tex4ht
%
% Load common pdf commands:
%
\input pgfsys-common-svg.def
%
% tex4ht-specific stuff:
%
\def\pgfsys@invoke#1{\pgf@sys@fail{svg code in preamble}}
\def\pgfsys@body@invoke#1{\HCode{#1}}
\newcount\pgf@sys@svg@picnum
\def\pgfsys@pictureboxsynced#1{%
\pgfsys@beginscope\pgflowlevelsynccm\box#1\pgfsys@endscope%
}
%%
%% initial support of Mathml and xhtml inside svg through the svg:foreignelement tag
%%
%% it'll allow us to have complicated text nodes in the tex4ht driver
%%
%Example (to improve the display, you have to use css)
%
%\tikzpicture[svg text only=false]
%\draw (0,0) node[inner sep=0pt,draw] {tight}
%(0cm,2em) node[inner sep=5pt,draw] {loose}
%(0cm,4em) node[fill=red!20] {default};
%\draw (3,0) node[inner sep=0pt,draw] {TIGHT}
%(3cm,2em) node[inner sep=5pt,draw] {LOOSE}
%(3cm,4em) node[fill=red!20] {DEFAULT};
%\draw (6,0) node[inner sep=0pt,draw] {$tight$}
%(6cm,2em) node[inner sep=5pt,draw] {$loose$}
%(6cm,4em) node[fill=red!20] {$default$};
%\draw (9,0) node[inner sep=0pt,draw] {$TIGHT$}
%(9cm,2em) node[inner sep=5pt,draw] {$LOOSE$}
%(9cm,4em) node[fill=red!20] {$Default$};
%\endtikzpicture
%
% you can use the options "svg text css=filename", "svg text id=idname", "svg text class=classname" to customize the display through the use of css
%
%\def\pgfsys@beginpicture{%
% % \Configure{[]}{$}{$} these two lines aren't needed for tex4ht and moreother they produce errors with plain tex !
% % \Configure{()}{$}{$}
% \Configure{$$}{}{}{}%$$
% \Configure{$}{}{}{}%$
% \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}
% \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}
% \Configure{SUBSUP}{}{}{}
% \Configure{htf}
% {0}{+}{<tspan font-family="}
% {\%s}{" font-size="\%s}{}{}
% {">}{</tspan>}
%}
%\def\pgfsys@endpicture{%
% % undo:
% \Configure{htf}{0}{+}{<span\Hnewline
% class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}
%}
%\def\pgfsys@svg@newline{\Hnewline}
\def\pgfsys@svg@newline{^^J}
% we don't want tex4ht putting <p> and </p> tags automatically in our svg code and causing invalid xhtml in our svg pictures
\newif\ifpgfsys@CssIncluded@\pgfsys@CssIncluded@false
\def\pgfsys@beginpicture{%
\EndP\HtmlParOff
\pgfkeys{/pgf/tex4ht node/escape=false}%
% text only nodes are the default. Advantage : pure svg pictures are
% the default, nicer for text only nodes.
% Disadvantages : this rendering methods produce more invalid or degraded svg pictures than with the foreignelement tag
%% we use css to control the display of foreignelement rendered text nodes
\ifpgfsys@CssIncluded@
\else
\Css{
.foreignobject {%
line-height:100\%;
font-size:120\%; % this is the trick....a font of size 100% in
% a box scaled down to half size makes it a
% half size font.
% you'll have to double the size of things
% that you want to have a regular size in
% this half-scaled box though
font-family:STIXgeneral,Times,Symbol,cmr10,CMSY10,CMEX10;%
% can't wait for the stix font...the cmr10, etc font are
% available from the mozilla site, times and symbols should be
% okey
padding:0;
margin:0;
% background-color:\#12ff55; usefull for debugging positioning
text-align:center; % good for centered text nodes...will have to improve that later on...with more integration with pgf options for text nodes
}
}%
\Css{%
math {%, math[mode="inline"] {
vertical-align:baseline;
line-height:100\%;
font-size:100\%;
font-family:STIXGeneral,Times,Symbol, cmr10,cmsy10,cmex10,cmmi10;
font-style: normal;
margin:0;
% background-color:\#99ff99;
padding:0;
}%
}%
\pgfsys@CssIncluded@true
\fi
}%
\def\pgfsys@endpicture{%
\HtmlParOn
\par% FIXME : was '\Par' but that seems to be undefined!?
}%
% this is okay for both rendering methods for text nodes (mtext or foreignelement)...
\def\pgfsys@typesetpicturebox#1{%
\global\advance\pgf@sys@svg@picnum by 1\relax%
% Ok, compute width/height
\pgf@xa=\pgf@picminx%
\pgf@ya=\pgf@picminy%
\pgf@xb=\pgf@picmaxx%
\pgf@yb=\pgf@picmaxy%
\pgf@x=\pgf@xb%
\advance\pgf@x by-\pgf@xa%
\pgf@y=\pgf@yb%
\advance\pgf@y by-\pgf@ya%
\ifdim\pgf@y<1pt%
\pgf@y=1pt%
\fi%
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
\pgfsysprotocol@flushcurrentprotocol%
\HCode{<object data="\jobname-\the\pgf@sys@svg@picnum.svg" width="}%
% Calculate pixel coordinates (this does not really make sense, but
% we have to do it anyway). Assume 96dpi.
\pgf@x=1.3333333\pgf@x%
\pgf@y=1.3333333\pgf@y%
% Add one pixel for security:
\advance\pgf@x by1pt%
\advance\pgf@y by1pt%
\pgf@sys@pt\pgf@x%
\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{" height="}%
\pgf@sys@pt\pgf@y%
\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{" type="image/svg+xml"><p>SVG-Viewer needed.</p></object>}%
\special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}%
%%%%%%%% This is necessary to control the svg through css
\pgfkeys{%
/pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css
}%
\pgfsys@invoke{<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\Hnewline% added that
<?xml-stylesheet href="\pgfsys@foreignobject@css.css" type="text/css"?>\Hnewline}% added that
%%%%%%%%%%%%%%% maybee I should add an option to change the css, for the whole picture
\pgfsys@invoke{<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="\the\pgf@xc"
height="\the\pgf@yc" viewBox="}%
\pgf@sys@pt{\pgf@xa}\pgf@sys@pt{\pgf@ya}\pgf@sys@pt{\pgf@xc}\pgf@sys@pt{\pgf@yc}%
\pgfsysprotocol@flushcurrentprotocol%
\pgf@ya=-\pgf@ya%
\pgfsys@invoke{">\Hnewline <g transform="translate(0,}
\pgf@sys@pt\pgf@yb\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{) scale(1,-1) translate(0,}%
\pgf@sys@pt\pgf@ya\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{)">\Hnewline }%
%
\pgf@ya=\pgf@shift@baseline\relax%
\advance\pgf@ya by-\pgf@picminy\relax%
%
%
\advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height
\advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width
\setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}%
\ht#1=\pgf@picmaxy%
\wd#1=\pgf@picmaxx%
\dp#1=0pt%
\leavevmode
\pgf@xa=\pgf@trimleft@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi
\raise-\pgf@ya\box#1%
\pgf@xa=\pgf@trimright@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi
\pgfsys@invoke{</g>\Hnewline </svg>\Hnewline }%
\special{t4ht<\jobname-\the\pgf@sys@svg@picnum.svg}%
}%
%% we'll use this hbox for the mtext rendering method (the "text only=true" option)
\def\pgfsys@hbox#1{%
\pgf@x=.5\wd#1%
\ifx\tikz@textcolor\relax\else\ifx\tikz@textcolor\@undefined\else%
\ifx\tikz@textcolor\pgfutil@empty%
\pgfsetfillcolor{.}%
\else%
\pgfsetfillcolor{\tikz@textcolor}%
\fi%
\fi\fi% tweak for TikZ
\HCode{<text
style="stroke:none"
transform="scale(1,-1) translate(\pgf@sys@tonumber{\pgf@x},0)"
text-anchor="middle"
}%
\ifpgfutil@format@is@latex%
\ifx\f@size\pgfutil@empty%
\else%
\HCode{ font-size="\f@size"}%
\fi%
\fi%
\HCode{>\Hnewline }%
\wd#1=0pt%
\ht#1=0pt%
\dp#1=0pt%
\box#1
\HCode{</text>\Hnewline }%
}%
%% we save this definition
\let\pgfsys@mtext@hbox\pgfsys@hbox
%% we have to use some "evil" ^^ tex4ht hackery
% tex4ht hackery
{% grouping necessary cause we change the catcode of ":"
\catcode`:=11\relax
%%% this is necessary to calculate the size of text nodes with
%%% inline maths
% (it is an improvement of tex4ht, got to ask eitan gurary if he
% could put it in the tex4ht code)
\gdef\DviMathAlt{%
\a:DviMath\leavevmode \MathClass
\ht:special{t4ht@(}\hbox\bgroup{\expandafter\ifx\csname
ht:everypar\endcsname\relax\expandafter\everypar\else
\expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend
}%
% these are configures for the foreignelement rendering method of text nodes : we let tex4ht write xhtml and mathml in the svg picture
%
\gdef\pgfsys@foreignobject@configure{%
\Configure{$}{\Configure{@math}{%\a:mathml
display="inline" }\DviMathAlt}{\EndDviMath}{}%%% we REALLY need to use \DviMathAlt here instead of \DviMath see above remark
\Configure{$$}{\Configure{@math}{%\a:mathml
display="block" }\IgnorePar
\ifvmode\else \HCode{<!--tex4ht:inline-->}\fi\EndP
\DviMath}{\EndDviMath\ShowPar\pgfsys@foreignobject@par{\csname HCondtrue\endcsname\noindent}
}{\DisplayMathtrue}%
\Configure{SUB}{\Send{BACK}{<\a:mathml msub><\a:mathml mrow\Hnewline>}%
\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msub\Hnewline>}%
\Configure{SUP}{\Send{BACK}{<\a:mathml msup><\a:mathml mrow\Hnewline>}%
\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msup\Hnewline>}%
\Configure{SUBSUP}{\Send{BACK}{<\a:mathml msubsup><\a:mathml mrow\Hnewline>}%
\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msubsup\Hnewline>}%
\Configure{htf}{0}{+}{<span\Hnewline
class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}%
}%
\global\let\pgfsys@foreignobject@par=\par % use this instead of \par
% -- \Configure is no \long macro (at
% least in one of the older
% versions).
% these are the configures for the mtext rendering method of text
% nodes : we turn everything into regular character (don't want math
% modes or subsup)
% and we hope it works (it doesn't if the text nodes aren't simple)
\gdef\pgfsys@mtext@configure{%
% no configures for \(\) and \[\] those might be needed for
% context or Latex. Let me know !
\Configure{$$}{}{}{}% no block maths
\Configure{$}{}{}{}%$ no inline maths
\Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
\Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
\Configure{SUBSUP}{}{}{}% not both sub and sup
\Configure{htf} {0}{+}{<tspan font-family="}{\%s}{" font-size="\%s}{}{}{">}{</tspan>}%
}%
}%
% a counter to produce unique ids for each text node rendered with foreign element
\newcount\pgf@sys@svg@nodenum
% pgfutil@minipage
%
% I had to change it to make it play nice with the way tex4ht puts <p> and <\p> tags
%
\newif\ifpgfsys@textonly
\def\pgfutil@minipage[#1]#2{%
\hbox to#2\bgroup
\hsize=#2\relax
\vbox\bgroup
% though it works, I'm desabling the above mentioned hack to make tex4ht behave with <p> <\p>, because it blurps the positioning
% (I''l try to fix that later, it's a css thing)
%
% \ifpgfsys@textonly\else\HtmlParOn\fi
%
% \noindent is better as it doesn't produce indentation AND it makes you leave vertical mode
\noindent%\leavevmode
}%
\def\pgfutil@endminipage{%
% same thing here
%
% \ifpgfsys@textonly\else\EndP\HtmlParOff\fi
\egroup\egroup
}%
% I'll have to fix those names later
\newbox\pgfsys@foreignobject@Box
\newdimen\pgf@s
\newdimen\pgf@t
% this is the alternate hbox routine that renders text nodes through the foreignobject tag
\def\pgfsys@foreignobject@hbox#1{%
% Compute box y translation (x translation is correct).
\pgf@y=-\ht#1\relax
\HCode{<g transform="scale(1,-1) translate(0,\pgf@sys@tonumber{\pgf@y}) % got to translate in y
scale(0.5,0.5)">\Hnewline}% scaling work around (damn dumb browsers !)
% Compute box size (scaled 2 times)
% this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen,
% so we have to work around this by making svg scale the things down 50%, doubling the size of the text node frame (i.e. no changement there)
\pgf@x=2\wd#1\relax
\pgf@y=2\ht#1\relax
\advance\pgf@y by 2\dp#1\relax
% this is to adjust the y translation to compensate for the differences between the TeX and the Html models for lines
\setbox\pgfsys@foreignobject@Box=\hbox{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZf_1^1\overline D)_1^1\vec i\vec j$}%
\pgf@t=\ht#1\relax
\advance\pgf@t by -\ht\pgfsys@foreignobject@Box\relax
\pgf@s=\pgf@t\relax
\advance\pgf@s by \dp#1\relax
\advance\pgf@s by -\dp\pgfsys@foreignobject@Box\relax
\ifnum\pgf@s>0\relax
\pgf@s=0pt
\pgf@t=0pt
\else
\advance \pgf@y by -2\pgf@s\relax
\pgf@t=2\pgf@t\relax
\fi
%
\HCode{<foreignObject x="0" y="\pgf@sys@tonumber{\pgf@t}"
width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}">}%
% this is to make use of the css, class and id options through which you can control the way things display
\pgfkeys{%
/pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css,%
/pgf/tex4ht node/class/.get=\pgfsys@foreignobject@class,%
/pgf/tex4ht node/id/.get=\pgfsys@foreignobject@id
}%
\HCode{<head>\Hnewline
<link rel="stylesheet" type="text/css" href="\pgfsys@foreignobject@css.css" />\Hnewline
</head>\Hnewline
% I'll have to look into this, perhaps there are better
% doctype....&nbsp; aren't recognised and produces invalid svg
% pictures a workaround (not implemented yet) would be to make
% them into entities of the svg picture.
<body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline
<div>\Hnewline
}%
\box#1%
\HCode{%
</div>\Hnewline
</body>\Hnewline
</foreignObject>\Hnewline
}%
% debug positioning not needed but it would be nice to let it there to control things later on
% \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}"
% style="fill:yellow;stroke:red; fill-opacity:0.5;stroke-opacity:0.5"/>}
\HCode{</g>\Hnewline}%
\global\advance\pgf@sys@svg@nodenum by 1\relax
}%
% the options and the code that controls it all (switches between \pgfsys@mtext@hbox and \pgfsys@foreignelement@hbox)
\pgfkeys{%
/pgf/.cd,
tex4ht node/escape/.is choice,
tex4ht node/escape/false/.code={\let\pgfsys@hbox\pgfsys@mtext@hbox\pgfsys@mtext@configure\pgfsys@textonlytrue},
tex4ht node/escape/true/.code={\let\pgfsys@hbox\pgfsys@foreignobject@hbox\pgfsys@foreignobject@configure\pgfsys@textonlyfalse},
tex4ht node/css/.initial=\jobname,
tex4ht node/class/.initial=foreignobject,
tex4ht node/id/.initial=\jobname\the\pgf@sys@svg@picnum-\the\pgf@sys@svg@nodenum
}%
% this might be needed
%\font\SvgText=cmr10\relax
% There is something rellay wrong with the way "%" chars are used in here... you should code "}%" to avoid unnecessary spaces
% and it is unnecessary to code \cs%
% got to be carefull with numbers though, cf the texbook...2\relax and 2 % are okey
\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\pgfutil@gobble\fi}
\def\pgfsys@shadingoutsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}}
\def\pgfsys@shadinginsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}}
\def\pgfsys@body@shadingoutsidepgfpicture#1{%
\begingroup%
#1%
\setbox\pgfpic=\hbox to0pt{%
\pgfsys@beginpicture%
\pgfsys@beginscope%
\pgf@sys@svg@sh@defs%
\pgf@sys@svg@sh%
\pgfsys@endscope%
\pgfsys@endpicture%
\hss%
}%
\pgf@process{\pgf@sys@svg@pos}%
\pgf@picminx=0pt%
\pgf@picminy=0pt%
\pgf@picmaxx=\pgf@x%
\pgf@picmaxy=\pgf@y%
\def\pgf@shift@baseline{0pt}%
\pgfsys@typesetpicturebox\pgfpic%
\endgroup%
}
\def\pgfsys@body@shadinginsidepgfpicture#1{%
#1%
\pgf@sys@svg@sh@defs% hmmm....
\pgf@process{\pgf@sys@svg@pos}
\pgf@xa=-.5\pgf@x%
\pgf@ya=-.5\pgf@y%
\pgfsysprotocol@literal{<g transform="translate(\pgf@sys@tonumber{\pgf@xa},\pgf@sys@tonumber{\pgf@ya})">\Hnewline}%
\pgf@sys@svg@sh%
\pgfsysprotocol@literal{</g>\Hnewline}%
}
\ifpgfutil@format@is@latex
% Protect against color.4ht evil meddling with xcolor:
\RequirePackage{xcolor}
\let\pgf@xcolor@declaredcolor=\@declaredcolor
\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor
\fi
\AtBeginDocument{
\let\pgfsys@invoke=\pgfsys@body@invoke
\let\pgfsys@shadingoutsidepgfpicture=\pgfsys@body@shadingoutsidepgfpicture
\let\pgfsys@shadinginsidepgfpicture=\pgfsys@body@shadinginsidepgfpicture
\ifpgfutil@format@is@latex
\let\pgf@texht@declaredcolor=\@declaredcolor
\let\pgf@texht@undeclaredcolor=\@undeclaredcolor
\def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi}
\def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi}
\fi
\def\pgfutil@color{\pgfsetcolor}
% \ConfigureEnv{pgfpicture}{}{}{}{} there is no environment in plain TeX and this produces errors
% this might be needed for context or latex though....let me know !
}%
\endinput
%%% Local Variables:
%%% mode: latex
%%% End:

View File

@@ -0,0 +1,92 @@
%%
%% This is file `taborder.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% taborder.dtx (with options: `copyright,package')
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% taborder.sty package, %%
%% Copyright (C) 2009--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. %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{taborder}
[2009/09/04 v0.1 taborder: Sets the tab order, Acrobat Distiller only (dps)]
\DeclareOption{structure}{\let\to@earlyendinput\relax}
\let\to@earlyendinput\endinput
\let\setTabOrderByList\relax\let\setTabOrderByNumber\relax
\ProcessOptions
\newif\ifto@structOrder\to@structOrderfalse
\newcommand{\setTabOrder}[1]{\begingroup
\global\to@structOrderfalse
\def\to@to@C{C}\def\to@to@R{R}\def\to@to@S{S}%
\def\to@to@W{W}\def\to@to@A{A}\def\to@to@us{UNSPECIFIED}%
\uppercase{\def\ef@taborder{#1}}%
\ifx\ef@taborder\@empty
\else\ifx\ef@taborder\to@to@us
\let\ef@taborder\@empty
\else\ifx\to@to@C\ef@taborder
\else\ifx\to@to@R\ef@taborder
\else\ifx\to@to@S\ef@taborder
\ifx\to@earlyendinput\endinput
\PackageWarning{taborder}{%
The structure (S) option is supported only\MessageBreak
with Acrobat Distiller. Using the default\MessageBreak
value of 'unspecified'}\let\ef@taborder\@empty
\else\global\to@structOrdertrue\fi
\else\ifx\to@to@W\ef@taborder
\else\ifx\to@to@A\ef@taborder
\else\PackageWarning{taborder}{%
Invalid value for \string\setTabOrder. Permissible \MessageBreak
values are R, C, S, W, A, and unspecified. Using \MessageBreak
the default value of 'unspecified'}\let\ef@taborder\@empty
\fi\fi\fi\fi\fi\fi\fi\ef@setTabOrder
}
\to@earlyendinput
\def\ef@setTabOrder{%
\ifx\ef@taborder\@empty\else\literalps@out{%
[ {ThisPage} <</Tabs/\ef@taborder>> /PUT pdfmark}\fi
\endgroup
}
\newcommand{\setTabOrderByList}{%
\global\to@settabsbylisttrue
\global\let\setStructTabOrder\to@setStructTabOrder
}
\newcommand{\setTabOrderByNumber}{%
\global\to@settabsbylistfalse
\global\let\setStructTabOrder\@gobble
}
\newcommand{\to@setStructTabOrder}[1]{%
\@setStructTabOrder#1\end
}
\newif\ifto@settabsbylist\to@settabsbylisttrue
\let\setStructTabOrder\to@setStructTabOrder
\define@key{structOpts}{title}[]{\def\structOpts@title{#1}}
\define@key{structOpts}{type}[Form]{\def\structOpts@type{#1}}
\newcommand{\@setStructTabOrder}[2][]{%
\setkeys{structOpts}{title,type,#1}
\ifx#2\end\else\literalps@out{%
[/Subtype/\structOpts@type\ifx\structOpts@title\@empty
\else/Title (\structOpts@title)\fi/StPNE pdfmark
[/Obj {#2} /StOBJ pdfmark
[/StPop pdfmark}\expandafter\@setStructTabOrder
\fi
}
\def\to@insertStrucTabOrder#1{%
\ifto@structOrder\ifx\eq@objdef\@empty\else
\ifx\eq@taborder\@empty\else\literalps@out{%
[/Subtype/#1/At \eq@taborder/StPNE pdfmark
[/Obj {\eq@objdefName} /StOBJ pdfmark [/StPop pdfmark}%
\fi\fi\fi
}
\endinput
%%
%% End of file `taborder.sty'.

View File

@@ -0,0 +1,189 @@
%% Dimension line for LaTeX/TikZ
%% Copyright © 2013 Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
%%
%% This file may be distributed and/or modified
%%
%% 1. under the LaTeX Project Public License and/or
%% 2. under the WTF Public License.
%%
%%
%% This simplify the creation drawing of dimension arrows.
%%
%%
%% To install it copy the tango directory to either:
%% - $TEXHOME/tex/latex/
%% - ~/texmf/tex/latex/
%% - ~/Library/texmf/tex/latex
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tikz-dimline}[2013/03/13 v1.0 initial version]
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\RequirePackage{ifthen}
\usetikzlibrary{calc,decorations.markings,arrows}
\makeatletter
\pgfkeys {
/dimline/.cd,
execute style/.style = {#1},
execute macro/.style = {/dimline/execute style/.expand once=#1},
}
\newdimen\dimline@arrow@linewidth
\pgfarrowsdeclare{dimline}{dimline}
{
\arrowsize=1\pgflinewidth
\pgfarrowsleftextend{0\arrowsize}
\pgfarrowsrightextend{5\arrowsize}
} {
\arrowsize=1\pgflinewidth
\pgfsetdash{}{0pt} % do not dash
% |
\pgfsetlinewidth{.5\arrowsize}
\pgfpathmoveto{\pgfpoint{4.75\arrowsize}{3\arrowsize}}
\pgfpathlineto{\pgfpoint{4.75\arrowsize}{-3\arrowsize}}
\pgfusepathqstroke
% >
\pgfsetlinewidth{0.01pt}
\pgfpathmoveto{\pgfpoint{4.5\arrowsize}{0pt}}
\pgfpathlineto{\pgfpoint{-3\arrowsize}{2\arrowsize}}
\pgfpathlineto{\pgfpoint{-3\arrowsize}{-2\arrowsize}}
\pgfpathclose
\pgfusepathqfillstroke
}
\pgfarrowsdeclare{dimline reverse}{dimline reverse}
{
\arrowsize=1\pgflinewidth
\pgfarrowsleftextend{-5\arrowsize}
\pgfarrowsrightextend{0\arrowsize}
} {
\arrowsize=1\pgflinewidth
\pgfsetdash{}{0pt} % do not dash
% |
\pgfsetlinewidth{0.5\arrowsize}
\pgfpathmoveto{\pgfpoint{-0.25\arrowsize}{3\arrowsize}}
\pgfpathlineto{\pgfpoint{-0.25\arrowsize}{-3\arrowsize}}
\pgfusepathqstroke
% >
\pgfsetlinewidth{0.01pt}
\pgfpathmoveto{\pgfpoint{0pt}{0pt}}
\pgfpathlineto{\pgfpoint{7.5\arrowsize}{2\arrowsize}}
\pgfpathlineto{\pgfpoint{7.5\arrowsize}{-2\arrowsize}}
\pgfpathclose
\pgfusepathqfillstroke
}
% measure lenght
% http://tex.stackexchange.com/questions/123913
\newcommand{\dimline@do@nothing}[1]{#1}%
% http://tex.stackexchange.com/questions/58283/tikz-how-to-determine-the-vector-between-two-co-ordinates
% #1: optional keys parameters
% #2: start point
% #3: end point
% #4: text
\newcommand{\dimline}[4][]{%
\pgfplotsifinaxis{%
\let\dimline@internal\pgfplotsextra%
}{%
\let\dimline@internal\dimline@do@nothing%
}%
\dimline@internal{
\pgfkeys{
dimline/.is family,
dimline,
color/.initial = black,
extension start length/.initial=1cm,
extension end length/.initial=1cm,
extension start angle/.initial=-90,
extension end angle/.initial=90,
line style/.initial = {},
label style/.initial = {},
extension style/.initial = {},
extension start style/.initial = {},
extension start path/.initial = {},
extension end style/.initial = {},
extension end path/.initial = {},
#1,
line style/.get = \dimline@line@style,
label style/.get = \dimline@label@style,
extension style/.get = \dimline@extension@style,
extension start style/.get = \dimline@extension@start@style,
extension start path/.get = \dimline@extension@start@path,
extension end style/.get = \dimline@extension@end@style,
extension end path/.get = \dimline@extension@end@path,
}
\begin{scope} [
line/.style = {
color=\pgfkeysvalueof{/dimline/color},
arrows=dimline-dimline,
/dimline/execute macro = \dimline@line@style,
},
extension/.style = {
color=\pgfkeysvalueof{/dimline/color}!40, line width=0.01,
/dimline/execute macro = \dimline@extension@style,
},
extension start/.style = {
extension,
/dimline/execute macro = \dimline@extension@start@style
},
extension end/.style = {
extension,
/dimline/execute macro = \dimline@extension@end@style,
},
label/.style = {
fill=white, align=center, sloped=true, pos=0.5,
/dimline/execute macro = \dimline@label@style
},
]
\coordinate (a) at #2 {};
\coordinate (b) at #3 {};
\ifthenelse{\equal{\dimline@extension@start@path}{}}{
\coordinate (a to b) at ($(a)!\pgfkeysvalueof{/dimline/extension start length}!\pgfkeysvalueof{/dimline/extension start angle}:(b)$);
\draw [extension start] (a.center) -- (a to b);
} {
\draw [extension start] plot coordinates {\dimline@extension@start@path};
}
\ifthenelse{\equal{\dimline@extension@end@path}{}}{
\coordinate (b to a) at ($(b)!\pgfkeysvalueof{/dimline/extension end length}!\pgfkeysvalueof{/dimline/extension end angle}:(a)$);
\draw [extension end] (b.center) -- (b to a);
} {
\draw [extension end] plot coordinates {\dimline@extension@end@path};
}
\draw[line] (a.center) -- (b.center) node[label] {#4};
\end{scope}
}
}
\@ifclassloaded{beamer}{%
\renewcommand<>{\dimline}[4][]{\only#5{\beameroriginal{\dimline}[#1]{#2}{#3}{#4}}}
}
\makeatother
\endinput
%% tikz-dimline.sty ends here.