diff options
Diffstat (limited to 'macros/latex/contrib/vpe')
-rw-r--r-- | macros/latex/contrib/vpe/README | 478 | ||||
-rw-r--r-- | macros/latex/contrib/vpe/vpe.pl | 430 | ||||
-rw-r--r-- | macros/latex/contrib/vpe/vpe.sty | 821 |
3 files changed, 1729 insertions, 0 deletions
diff --git a/macros/latex/contrib/vpe/README b/macros/latex/contrib/vpe/README new file mode 100644 index 0000000000..9ac6edf8fd --- /dev/null +++ b/macros/latex/contrib/vpe/README @@ -0,0 +1,478 @@ +README for project vpe 2012/04/18 v0.2 + +TABLE OF CONTENTS +================= +A. Project vpe +B. Copyright, Disclaimer, Lizenz +C. Files +D. Requirements +E. Installation +F. Howto +F.1 VTeX/Linux +F.2 PdfTeX and dvips +F.3 (X)emacs +G. User interface +G.1 Perl script +G.2 Package +H. Linux launch details +I. Author +J. Questions, bug reports +K. History + +A. PROJECT VPE +============== +VPE deals with source specials for pdf files: clicking +on special annotations will launch an editor with the +source file at the source line. + +The project supports three routes to pdf files: + +* VTeX/Linux route: + MicroPress' VTeX is able to insert specials by itself. + It smoothly works under Windows. But the AcrobatReader + versions under Linux/Unix require additional work, see + section H "Linux launch details", that is done by the + perl script `vpe.pl'. + +* pdfTeX route: + For Han The Thanh's pdfTeX under Linux/Unix or Windows + the package `vpe.sty' inserts the specials with the + help of the perl script `vpe.pl'. + The catalog entry `/AcroForm' is added, so that + the `revert' menu entry of AR4.05 is enabled for + easier reloading, if the pdf file has changed. + Users of AR4.05 can also try option `form' of + the package to get nicer source special markers, + but the memory consumption is higher. + +* dvips route: + As in the pdfTeX route package `vpe.sty' inserts the + specials with the help of the perl script `vpe.pl'. + Also the `/AcroForm' entry is added, but the + `form' option is not implemented. + +B. COPYRIGHT, DISCLAIMER, LIZENZ +================================ +Copyright (C) 1999, 2000, 2012 Heiko Oberdiek. + +This program may be distributed and/or modified 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. + +C. FILES +======== +The project `vpe' consists of three files: + +vpe(.pl): Perl script, used by all routes. The extension `.pl' + may be omitted for installation purposes. +vpe.sty: LaTeX2e package for pdftex and dvips routes. +README: Documentation, the file you are reading. + +Help and temporary files, generated by use: +myfile.tex.vpe: Symbol link from source file `myfile.tex' + to the perl script, required for the source + specials launch actions in the pdf file. + Each source file need a link. +myfile.vpe: Temporary file for data exchange between + TeX and the perl script called by \write18{}. +vpe.cfg: Configuration file of package `vpe.sty'. + +D. REQUIREMENTS +=============== +All routes: +* Perl5 (version 5 of the perl interpreter). + +pdfTeX, dvips routes: +* \write18 feature (--shell-escape) +* LaTeX2e + +pdfTeX route: +* pdfTeX >= v0.14 + +E. INSTALLATION +=============== +1. TeX directory structure (TDS): + The files + `vpe.txt' (documentation) + `vpe.sty' (pdf(e)tex, pdf(e)latex, (e)tex, (e)latex) + go to + texmf/doc/latex/oberdiek/vpe.txt + texmf/tex/latex/oberdiek/vpe.sty + +2. Perl script `vpe.pl': + + Unix + * Your are allowed to rename `vpe.pl' to `vpe': + mv vpe.pl vpe + * Ensure that the execute permission is set: + chmod +x vpe + * Move the file to a directory where the shell can find it + (environment variable PATH, e.g. /usr/local/bin/). + * The environment variables TEXEDIT and VPE are + looked for the editor call, eg: + export VPE='xterm -e joe +%d %s' (bash) + %d will be replaced by the line number and + %s by the file name. + + Windows (Dos) + * Methods for calling by typing the script name without extension + and perl interpreter: + a) If your perl distribution provides a pl2exe program, + use it to generate `vpe.exe'. + Advantage: I/O redirection works. + b) A good method is a dos program of John Dallman: + #!perl.exe (versions below 4) + hbperl.exe (version 4) + http://www.perl.com/CPAN/authors/id/JDALLMAN/hbp_403.zip + Move vpe.pl in a PERLLIB directory and copy the + exe program to `vpe.exe'. Then the program looks + for the perl interpreter, the script and calls them. + Advantage: I/O redirection works. + c) Windows NT 4.0 users can use associated file types: + SET PATHEXT=.pl;%PATHEXT% + See perl win32 faq "How do I associate Perl scripts with perl?": + http://www.activestate.com/support/faqs/win32/perlwin32faq4.html + Disadvantage: I/O redirection does not work. + d) 4DOS: SET .PL=c:/bin/perl.exe + See perl win32 faq "How can I get Perl to run a Perl script at + the 4DOS command line by typing the name of the script without + the extension or "perl", just like a regular exe file?": + http://www.activestate.com/support/faqs/win32/perlwin32faq1.html + e) Convert the perl script to a batch file `vpe.bat', if your + distribution provides `pl2bat.bat'. + Disadvantage: I/O redirection does not work. + Many of this methods are listed in the perl win32 faq + "What's the equivalent of the shebang ("#!") syntax for Win32?": + http://www.activestate.com/support/faqs/win32/perlwin32faq4.html + * Running the perl interpreter directly with the perl script: + perl vpe.pl ... + Use this method only, if the other methods fail. + Then you have to configure the command name in the + configuration file `vpe.cfg': + \vpesetup{command={perl vpe.pl}} + * The editor application and the syntax of the paramters + for the editor can be configured by \vpesetup in + the configuration file `vpe.cfg': + \vpesetup{application={pfe.exe},parameters={-g $d $s}} + $d will be replaced by the line number, + $s by the file name. + +F. HOWTO +======== + +F.1 VTeX/Linux +-------------- +Do not use the package `vpe.sty', the VTeX/Linux route +is only based on the perl script. + +a) Enable VTeX's source special generation with option `-*<num>', + eg: -*20 +b) Run the perl script on the generated pdf file. It + fixes the launch actions and creates the necessary symbol + links (See section H "Linux launch details"): + vpe myfile.pdf + +F.2 PdfTeX and dvips +-------------------- +a) Load the package `vpe.sty', eg: + \usepackage{vpe} +b) Produce the pdf file, but with enabled \write18{} feature + for system commands. This can be achieved by setting the + command line option `--shell-escape' for pdfTeX or TeX. + An alternative is the boolean variable `shell_escape' + in the configuration file `texmf.cnf'. For security + reasons I recommend the command line option. +c) Only Linux: After the first call it is possible that + the symbol links are not created yet (depends on write + puffer effects). Then it can be done by envoking the + perl script manually: + vpe myfile.pdf + +F.3 (X)emacs +------------ +This section is provided by Uwe Brauer. + +In order to use vpe with (X)emacs, you will need to set a +client as the editor variable since otherwise for each +call a separate (X)macs session would be started. There +are two server/clients: gnuclient which is shipped with +xemacs and emacsclient which is shipped with GNU emacs. +The configuration for emacsclient is a little more +delicate, that's why in the following only the +configuration of gnuclient is discussed. Either install +gnuclient for GNU emacs or, if you want to use emacsclient, +read the following instuctions +http://xdvi.sourceforge.net/inverse-search.html. + +* insert in your .emacs the line + (gnuserv-start) + +* set the variable VPE, either + setenv VPE 'gnuclient -q +%d %s' + in your .tcshrc file or + export VPE='gnuclient -q +%d %s' + in your .bashrc file + +* now if you want to avoid that a new window(frame) is + opened every time you call the gnuclient, insert + something like this in your .emacs file + + (custom-set-variables + ;;; ... other stuff ... + '(gnuserv-frame t) + '(gnuserv-visit-hook (lambda () (raise-frame) (recenter)))) + +* If you use AuCTeX, the following definitions come in handy: + Copy in your .emacs file + + (custom-set-variables + '(TeX-command-list (quote ( + ;; ..other stuff.. + ("srcpdflatex" "pdflatex --shell-escape %t" TeX-run-command t "nil") + ("vpe" "vpe %g" TeX-run-command t nil)))) + '(TeX-expand-list (quote ( + ;; ..other stuff.. + ("%g" file "pdf" t))))) + + If you don't want to use %g for pdf files, use another letter + but make sure that it is not already in use. + Now you can call srcpdflatex for generating an appropriate pdf + file and the perl script vpe to insert the source specials. + +G. USER INTERFACE +================= + +G.1 Perl script +--------------- +General options: +--help: print help and usage screen. +--verbose: print additional informations. + +Options that influence the symbol links: +--force: force symbol links (`ln -f' is called). +--delete: remove the symbol links for the source files, + mentioned in the pdf file: + vpe --delete myfile.pdf + +Internal options, called by the package `vpe.sty': +--system: detects the system (linux or win) and writes + the information in the data exchange file: + vpe --system myfile.vpe +--sty: generates the absolute file name of the + source file `file.tex', get the maximum + line number and writes the informations + in the data exchange file `myfile.vpe': + vpe --sty file.tex myfile.vpe +--progname: this option sets the program name option + of `kpsewhich', called by the --sty option: + vpe --sty --progname=pdfelatex file.tex myfile.vpe + +G.2 Package +----------- +There are three places, where the options can be specified +in evaluation order: +a) Configuration file `vpe.cfg` with \vpesetup. +b) LaTeX package options: local in \usepackage or + global in \documentclass. +c) Some options can be set by \vpesetup after the + package is loaded. + +`active', `inactive' (place: abc, default: active) + Enables/disables insertion of source specials + +`debug' (place: a, default: off) + Verbose messages for debugging purposes. + +`dupes', `nodupes' (place: abc, default: dupes) + Option `nodupes' suppresses source specials that point + to the same file and line. + +`linux', `unix', `win', `dos' (place: ab, default: automatic) +`system=linux|win' (place b) + The format of the launch action differs in the win and unix + case. Therefore the packages has to know, which kind it + should generate. If none of the options is given, then + the packages calls the perl script with option `--system' + to get the information. + (Recommendation: set in `vpe.cfg' to save time.) + +`form', `noform' (place: ab, default: noform) + Users of AR4.05 can try this option to get nicer + source special marks. Only the pdfTeX route is + supported currently. + +`acroform', `noacroform' (place: ab, default: acroform) + With forms AR4.05 enables the `revert' menu entry, + so that changed files can more easily be reloaded. + If option `form' is used, the /AcroForm dictionary + can be suppressed with `noacroform', when another + /AcroForm is already provided. + +`command=...' (place: bc, default: vpe) + Call of the perl script for the \write18{} feature. + +`progname=...' (place: bc, default: automatic) + TeX cannot provide absolute path names of files, + therefore the package calls the perl script to ask + `kpsewhich'. This program needs the program/format + name in order to select the correct search path + variables. Automatically the package is able to + distinguish between `latex', `elatex', `pdflatex' + and `pdfelatex'. For other names this option has + to be set. + +`application=...' (place: bc, default: pfe.exe) +`parameters=...' (place: bc, default: `-g $d $s') + These options configure the editor call for windows: + `application' contains the call of the editor, + `parameters' the parameters for the editor. + $d will be replaced by the line number and + $s by the file name. + +`width', `height', `depth', `color', `border', +`flag', `attr' (place: bc, default: see vpe.sty) + With these options the launch annotation + can be configured (`noform' version). + Because of the beta status of the options, + they can change in future, for details see + the package source. + +`everyhbox', `noeveryhbox' (place: ab, default: noeveryhbox) + By this option a lot of source specials are inserted, + but there is a high risk to get a lot of "Underfull + \hbox" warnings. + +`no<feature>' (place: a, default: <feature>) + For the introduction of source specials many + internal commands are redefined. This can cause + problems with incompatible packages and macros. + The redefinitions that cause problems can be + disabled. Current list of features: + input, @input, include, + newpage, clearpage, + everypar, document, @item, @doendpe, + @arrayparboxrestore, @xsect, @afterheading, + @setminipage, @startsection, + everymath, everyhbox, + newline, mbox, TILDE, + ref, cite, + item, trivlist, endtrivlist, + @bsphack, @esphack, @Esphack, @xaddvskip, + @tabularcr, @arraycr, + hrule, vrule + +H. LINUX LAUNCH DETAILS +======================= +It is quite easy to launch a program with parameters +with a link annotation under Windows, because +AcrobatReader knows a /Win dictionary, eg: + << /Type Annot + /Subtype /Link + /Rect [100 700 120 720] + /A << /Type /Action + /S /Launch + /Win << /F (pfe.exe) + /P (-g 21 c:/myhome/myfile.tex) + >> + >> + >> +A corresponding /Unix dictionary is not yet defined +in the pdf specification and not implemented in AR. +Therefore only the file name can be used to store +the parameter informations, eg: + /A << /Type /Action + /S /Launch + /F (//.////../myhome/myfile.tex.vpe) + >> + +The file that will be launched is a symbol link +to the script `vpe(.pl)', eg: + ln -s /usr/local/bin/vpe /myhome/myfile.tex.vpe + +The script scans its calling name, the name of the +symbol link, to extract the parameters for the +editor call: +* The initial part encodes the line number, +* the rest without the extension `.vpe' is the + file name. +* Condition: The path names are absolute path names. + +The coding algorithm for the line number: +* The decimal digits of the number are separated + and ended by the sequence "./". +* Each decimal digit of the number is converted + to a sequence of slashes, optionally followed + by a period. The count of slashes is the + number. With the period, the count have to be + incremented by 5. +* The conversion of the first digit always starts + with a slash to ensure a absolute path names, + eg: "5" is converted to "/////", but not as + first digit it can be shrunk to ".". +Examples (spaces only for clarifying): + 2: // ./ + 6: /. ./ + 9: ////. ./ + 11: / ./ / ./ + 28: // ./ ///. ./ (see example above) + 505: ///// ./ ./ . ./ + +I. AUTHOR +========= +Heiko Oberdiek +Email: heiko.oberdiek at googlemail.com + +J. QUESTIONS, BUG REPORTS +========================= +If you have questions, problems with `vpe', error reports, +if you have improvements or want to have additional features, +please send them to the author. + +Because I do not have to much time, I cannot garantee +that I will fix all problems and add all suggested features. + +Regarding bug reports I have some wishes: +* Please only send a minimal test file. + I do not have the time to check hundreds of lines + and pages. + Strip the minimal file off all unnecessary packages, + macros, and stuff. + But the minimal file should be complete, so that I can + immediately call latex on it. +* Please no .log, .dvi, .ps, .pdf files. + I have a lot of TeX and related programs installed + and can generate them in the most cases. +* Please get all versions numbers of packages and + programs (examples see below). Only the + distribution version does not help, so I do not + have MikTeX installed and I am using a very old + teTeX and even emTeX, but almost always the latest + pdfTeX binaries. Therefore the pdfTeX version is + much more important. + Hints: + * With "\listfiles" LaTeX prints the versions of the + used files at the end of the .log file. + * Many programs know options like: + --version, -v, -help, -h, -? + +My environment for developing and testing (2000): +* linux, debian 2.0 +* perl 5.004_04 +* VTeX/Linux: 7.06 +* pdfTeX: 0.14g-pretest-20000912 +* TeX: 3.14159, Web2C 7.2 +* dvips 5.78 +* Ghostscript 6.01 + +K. HISTORY +========== +2000/09/15 v0.1: First release +2005/11/28 (X)emacs section from Uwe Brauer +2012/04/18 v0.2: + * Option --version added. + * `vpe.txt' renamed to `README'. + * Email address updated. diff --git a/macros/latex/contrib/vpe/vpe.pl b/macros/latex/contrib/vpe/vpe.pl new file mode 100644 index 0000000000..ba93d8c4d7 --- /dev/null +++ b/macros/latex/contrib/vpe/vpe.pl @@ -0,0 +1,430 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' + if 0; +use strict; +# +# vpe.pl +# +# Copyright (C) 2000, 2012 Heiko Oberdiek. +# +# This program may be distributed and/or modified 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. +# +# See file "vpe.txt" for a list of files that belong to this project. +# +# This file "vpe.pl" may be renamed to "vpe" +# for installation purposes. +# +my $prj = 'vpe'; +my $file = "$prj.pl"; +my $program = uc($&) if $file =~ /^\w+/; +my $version = "0.2"; +my $date = "2012/04/18"; +my $author = "Heiko Oberdiek"; +my $copyright = "Copyright (c) 2000, 2012 by $author."; +# +# History: +# 2000/09/15 v0.1: First release. +# 2012/04/18 v0.2: Option --version added. +# + +### program identification +my $title = "$program $version, $date - $copyright\n"; + +### editor call +# %F: file name +# %L: line number +my $EditorCall = "xterm -e joe +%d %s"; +$EditorCall = $ENV{TEXEDIT} if $ENV{TEXEDIT}; +$EditorCall = $ENV{VPE} if $ENV{VPE}; + +### error strings +my $Error = "!!! Error:"; # error prefix + +my $usage = <<"END_OF_USAGE"; +${title} +Depending on the name of the script `vpe' works in four modes: + +* [vpe] Syntax: vpe <pdf file>[.pdf] + The pdf file is scanned for actions created by VTeX, + that start an editor with the source file at the + specified line under Windows. + A symbol link is made from the source file name + extended by the extension `.vpe' to this script. + The line number is encoded in the path and the + action is changed to start this script. + +* [sty] Internal for vpe.sty: + Syntax: vpe --sty [--progname=...] <latex file> <vpe file> + +* [system] Internal for vpe.sty: + Syntax: vpe --system <vpe file> + +* [launch] Syntax: <source file name>.vpe + The script decodes the line number in the path of + the source file name and starts an editor with + this file at that line number. + +Options: + --help: print usage + --version print version number + --verbose: print additional informations during running + --force: force symbol links + --delete: delete symbol links + --sty: internal for `vpe.sty' (get absolute file name and lines) + --system: internal for `vpe.sty' (get system info linux or win) + --progname: latex, pdflatex, elatex, pdfelatex +END_OF_USAGE + +### options +$::opt_verbose = 0; +$::opt_help = 0; +$::opt_version = 0; +$::opt_force = 0; +$::opt_delete = 0; +$::opt_sty = 0; +$::opt_system = 0; +$::opt_progname = "latex"; +use Getopt::Long; +GetOptions( + "help!", + "version!", + "verbose!", + "force!", + "delete!", + "sty!", + "system!", + "progname=s", +) or die $usage; +if ($::opt_help) { + die $usage; +} +if ($::opt_version) { + print "$prj $date v$version\n"; + exit(0); +} + +if ($::opt_sty and $::opt_system) { + die "$usage" . + "$Error Options --sty and --system cannot used together!\n"; +} + +################### +### launch mode ### +################### +if ($0 =~ /\.vpe/) { + + @ARGV == 0 or + die "$usage$Error Too many arguments [launch mode]!\n"; + + my $file = ""; + $0 =~ m|(^[\./]+\./)(.+)\.vpe$| or + die "$Error Cannot extract line number ($0)!\n"; + my $str = $1; + $file = "/$2"; + + my $line = ""; + while ($str ne "") { + $str =~ m|^(/*)(\.?)\./(.*)$| or + die "$Error Parse error!\n"; + $line .= length($1) + (($2 eq ".") ? 5 : 0); + $str = $3; + } + + my $callstr = $EditorCall; + $EditorCall =~ s/%s/$file/; + $EditorCall =~ s/%d/$line/; + print "File: $file, line: $line\n" if $::opt_verbose; + exec($EditorCall); + exit 1; +} + +### +### used by both sty and system mode: +### +my $system = "linux"; +$system = "" if $^O =~ /os2/i; +$system = "" if $^O =~ /mac/i; +$system = "win" if $^O =~ /dos/i; +$system = "win" if $^O =~ /win/i; + +################ +### sty mode ### +################ +if ($::opt_sty) { + + @ARGV == 2 or + die "$usage$Error Wrong arguments [sty mode]!\n"; + + my $vpefile = $ARGV[1]; + print "VPE file: $vpefile\n" if $::opt_verbose; + + my $file = `kpsewhich -progname=$::opt_progname $ARGV[0]`; + chomp $file; + if (!($file =~ m|^/| or $file =~ m|^\w:|)) { + use Cwd; + $file = cwd() . "/" . $file; + $file =~ s|/[^/]+/\.\./|/|g; + $file =~ s|/\./|/|g; + } + -f $file or + die "$Error Cannot find file `$file' [sty mode]!\n"; + print "File: $file\n" if $::opt_verbose; + + my $last = 0; + if (open(IN, $file)) { + while (<IN>) { + $last++; + } + } + if ($last == 0) { + $last = 10000; + } + print "Last line: $last\n" if $::opt_verbose; + + open(OUT, ">>$vpefile") or + die "$Error Cannot open file `$vpefile`!\n"; + print OUT "\\vpeentry{$file}{$last}\n"; + + exit 1; +} + +################### +### system mode ### +################### +if ($::opt_system) { + + @ARGV == 1 or + die "$usage$Error Wrong arguments [system mode]!\n"; + + my $vpefile = $ARGV[0]; + print "VPE file: $vpefile\n" if $::opt_verbose; + + open(OUT, ">>$vpefile") or + die "$Error Cannot open file `$vpefile`!\n"; + print OUT "\\vpesystem{$system}\n"; + + exit 1; +} + +################ +### vpe mode ### +################ +if (@ARGV < 1) { + die "$usage$Error Missing pdf file [vpe mode]!\n"; +} +if (@ARGV > 2) { + die "$usage$Error Too many arguments [vpe mode]!\n"; +} + +my $pdffile = $ARGV[0]; +if (!-f $pdffile) { + my $name = $pdffile; + $pdffile .= ".pdf"; + -f $pdffile or + die "$Error File `$name' not found [vpe mode]!\n"; +} + +open(IN, "+<$pdffile") or + die "$Error Cannot open `$pdffile' [vpe mode]!\n"; +binmode(IN); +my %symlinks = (); +while (<IN>) { + + if (m|/F\([\./]*(/.*)\.vpe\)|) { + $symlinks{$1} = 1; + next; + } + + my $do = 0; + my ($action, $file, $line, $type); + # my $color; # only for debugging + + if (m|^ + /A \s* << \s* + /Type \s* /Action \s* + /S \s* /Launch \s* + /Win \s* << \s* + /F \s* \(aftcomp.exe\) \s* + /P \s* \("(.*)\" \s+ \d+\-(\d+)\) \s* + >> \s* + >> \s* + $ + |x + ) { + $action = $_; + $file = $1; + $line = $2; + # $color = "/C[0 0 1]"; # only for debugging + $type = "aftcomp"; + $do = 1; + } + + if (m|^ + /A \s* << \s* + /Type \s* /Action \s* + /S \s* /Launch \s* + /Win \s* << \s* + /F \s* \(repos.exe\) \s* + /P \s* \( + "(.*)" \s* + "(\d+)" \s* + "(.*)" \s* + "(\d+)" + \) \s* + >> \s* + >> \s* + $ + |x + ) { + $action = $_; + if ($3 eq "") { + $file = $1; + $line = $2; + } + else { + # ??? + $file = $1; + $line = $2; + } + # $color = "/C[1 0 0]"; # only for debugging + $type = "repos"; + $do = 1; + } + + if ($do) { + my $length = length($action); + print "* File: $file, line: $line, type: $type\n" if $::opt_verbose; + + if (!($file =~ m|^/|)) { + print STDERR "$Error File `$file' lacks of absolute path!\n"; + next; + } + + if (!$::opt_delete) { + if ($line <= 0) { + $line = 1; + } + + my $newaction = ""; + { + my $digit = substr($line, 0, 1); + if ($digit <= 5) { + $newaction .= "/" x $digit; + } + else { + $newaction .= "/" x ($digit - 5) . "."; + } + $newaction .= "./"; + my $rest = $line; + while (($rest = substr($rest, 1)) ne "") { + $digit = substr($rest, 0, 1); + if ($digit < 5) { + $newaction .= "/" x $digit; + } + else { + $newaction .= "/" x ($digit - 5) . "."; + } + $newaction .= "./"; + } + } + $newaction .= substr($file, 1) . ".vpe"; + $newaction = # $color . # only for debugging + "/A<</Type/Action/S/Launch/F($newaction)>>"; + $newaction .= " " x ($length - length($newaction) - 1); + if (length($newaction) > $length) { + print STDERR "$Error Action too long!\n"; + next; + } + + seek(IN, -length($action), 1); + print IN $newaction; + } + + $symlinks{$file} = 1; + } +} + +if (keys(%symlinks)) { + + my $this = $0; + if (!$::opt_delete) { + if (!-f $0 or !-x $0) { + $this = `which $0`; + ($this ne "") or die "$Error Cannot find this script!\n"; + } + if (!($this =~ m|^/|)) { + use Cwd; + $this = cwd() . "/" . $this; + } + $this =~ s|/[^/]+/\.\./|/|g; + $this =~ s|/\./|/|g; + } + + if ($::opt_delete) { + print "Delete symlinks:\n"; + } + else { + if ($::opt_force) { + print "Forced symlinks to $this:\n"; + } + else { + print "Symlinks to $this:\n"; + } + } + + foreach (keys(%symlinks)) { + my $sym = $_ . ".vpe"; + print " $sym ["; + + if ($::opt_delete) { + if (!-l $sym) { + print "ok, not existing]\n"; + next; + } + unlink($sym); + if (!-l $sym) { + print "ok, deleted]\n"; + next; + } + print "failed]\n"; + next; + } + if ($::opt_force) { + if (-l $sym) { + unlink($sym); + if (-l $sym) { + print "deletion failed]\n"; + next; + } + if (symlink($this, $sym)) { + print "ok, deleted and created]\n"; + next; + } + print "deleted, creation failed]\n"; + next; + } + if (symlink($this, $sym)) { + print "ok, created]\n"; + next; + } + print "creation failed]\n"; + next; + } + if (-f $sym) { + print "exists]\n"; + next; + } + if (symlink($this, $sym)) { + print "ok, created]\n"; + next; + } + print "failed]\n"; + next; + } +} +__END__ diff --git a/macros/latex/contrib/vpe/vpe.sty b/macros/latex/contrib/vpe/vpe.sty new file mode 100644 index 0000000000..78022b22c9 --- /dev/null +++ b/macros/latex/contrib/vpe/vpe.sty @@ -0,0 +1,821 @@ +% File: vpe.sty +% Project: vpe +% Version: 2012/04/18 v0.2 +% Author: Heiko Oberdiek +% +% Function: Source specials for pdf files. +% +% Copyright: Copyright (C) 2000, 2012 Heiko Oberdiek. +% +% This program may be distributed and/or modified 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. +% +% See file `vpe.txt' for a list of files that +% belong to this project. +% +% Requirement: * Linux/Unix or Windows/Dos +% * enabled \write18 feature. +% * LaTeX2e +% +% Use: * \usepackage{vpe} +% See file `vpe.txt' for further documentation. +% +% History: 2000/09/15 v0.1: first public release +% 2012/04/18 v0.2 +% +% \vpe@ is the prefix for internal command names. +% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{vpe}% +[2012/04/18 v0.2 Source specials for pdf files (HO)] + +\RequirePackage{keyval} + +%*** options + +%*** active/inactive +\DeclareOption{active}{\vpe@oktrue} +\DeclareOption{inactive}{\vpe@okfalse} +\newif\ifvpe@ok +\vpe@oktrue + +%*** dupes +\DeclareOption{dupes}{\vpe@dupestrue} +\DeclareOption{nodupes}{\vpe@dupesfalse} +\newif\ifvpe@dupes +\vpe@dupestrue + +%*** form, revert, acroform +\DeclareOption{form}{\vpe@formtrue} +\DeclareOption{noform}{\vpe@formfalse} +\newif\ifvpe@form +\vpe@formfalse +\DeclareOption{acroform}{\vpe@acroformtrue} +\DeclareOption{noacroform}{\vpe@acroformfalse} +\newif\ifvpe@acroform +\vpe@acroformtrue + +%*** debug +\DeclareOption{debug}{% + \def\vpe@debug#1{\typeout{*** #1 ***}}% +} +\let\vpe@debug\@gobble + +%*** system +\DeclareOption{linux}{\def\vpe@system{linux}} +\DeclareOption{unix}{\def\vpe@system{linux}} +\DeclareOption{win}{\def\vpe@system{win}} +\DeclareOption{dos}{\def\vpe@system{win}} +\let\vpe@system\@empty + + +%*** driver specific options +\DeclareOption{pdftex}{\let\vpe@annot\vpe@annotpdftex} +\DeclareOption{dvips}{\let\vpe@annot\vpe@annotdvips} +\DeclareOption{ps2pdf}{\let\vpe@annot\vpe@annotdvips} +\DeclareOption{pdfmark}{\let\vpe@annot\vpe@annotdvips} +\def\vpe@annotpdftex#1{\pdfannot\vpe@rule{#1}} +\def\vpe@dvips@pdfmark#1{\special{ps:SDict begin[#1 pdfmark end}} +\def\vpe@annotdvips#1{% + \vpe@dvips@pdfmark{% + /Rect[% + currentpoint + exch 1 72 div Resolution mul sub + exch \vpe@depth\space 1 add 72 div Resolution mul add + currentpoint + exch \vpe@width\space 1 add 72 div Resolution mul add + exch \vpe@height\space 1 add 72 div Resolution mul sub% + ]% + #1% + /ANN% + }% +} +\let\vpe@annot\vpe@annotdvips + + +\DeclareOption{everyhbox}{\vpe@everyhboxtrue} +\DeclareOption{noeveryhbox}{\vpe@everyhboxfalse} +\newif\ifvpe@everyhbox + +%*** disable options +\DeclareOption*{% + \expandafter\let\csname vpeorg@\expandafter + \@gobbletwo\CurrentOption\@empty\@empty\endcsname \@empty% +} + +%*** keyval options +\def\vpe@revert#1#2{% + \expandafter\ifx\csname vpe@#1\endcsname\relax + \else + \csname vpe@#1% + \@gobble\iftrue\csname if#1\endcsname + false% + \else + true% + \fi + \endcsname + \fi +} + +\define@key{vpe}{active}[true]{\csname vpe@ok#1\endcsname} +\define@key{vpe}{inactive}[true]{\vpe@revert{ok}{#1}} +\define@key{vpe}{dupes}[true]{\csname vpe@dupes#1\endcsname} +\define@key{vpe}{nodupes}[true]{\vpe@revert{dupes}{#1}} +\define@key{vpe}{form}[true]{\csname vpe@form#1\endcsname} +\define@key{vpe}{noform}[true]{\vpe@revert{form}{#1}} +\define@key{vpe}{acroform}[true]{\csname vpe@acroform#1\endcsname} +\define@key{vpe}{noacroform}[true]{\vpe@revert{acroform}{#1}} +\define@key{vpe}{command}{\def\vpe@command{#1}} +\define@key{vpe}{system}{\def\vpe@system{#1}} +\define@key{vpe}{width}{\def\vpe@width{#1}} +\define@key{vpe}{height}{\def\vpe@height{#1}} +\define@key{vpe}{depth}{\def\vpe@depth{#1}} +\define@key{vpe}{color}{\def\vpe@color{#1}} +\define@key{vpe}{border}{\def\vpe@border{#1}} +\define@key{vpe}{flag}{\def\vpe@flag{#1}} +\define@key{vpe}{attr}{\def\vpe@attr{#1}} +\define@key{vpe}{application}{\def\vpe@application{#1}} +\define@key{vpe}{parameters}{\def\vpe@parameters{#1}} +\define@key{vpe}{progname}{\def\vpe@progname{#1}} +\define@key{vpe}{everyhbox}[true]{\csname vpe@everyhbox#1\endcsname} +\def\vpesetup{\setkeys{vpe}} +\def\vpe@command{vpe} +\def\vpe@width{12} +\def\vpe@height{12} +\def\vpe@depth{2} +\def\vpe@border{0 0 1} +\def\vpe@color{1 1 0} +\def\vpe@flag{0}% 8 = not zoomed, 16 = not rotated +\let\vpe@attr\@empty +\def\vpe@application{pfe.exe} +\def\vpe@parameters{-g $d $s} +\newif\ifvpe@pdftex +\ifx\eTeXversion\@undefined + \def\vpe@progname{latex} +\else + \def\vpe@progname{elatex} +\fi +\ifx\pdfoutput\@undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \let\vpe@annot\vpe@annotpdftex + \vpe@pdftextrue + \ifx\eTeXversion\@undefined + \def\vpe@progname{pdflatex}% + \else + \def\vpe@progname{pdfelatex}% + \fi + \fi + \fi +\fi + +%*** option processing + +\InputIfFileExists{vpe.cfg}{}{} + +\ProcessOptions + +%*** help file +% File for read informations of commands +% launched by \write18: +\newread\vpe@read +\immediate\openout\vpe@read=\jobname.vpe +\immediate\closeout\vpe@read +\openin\vpe@read=\jobname.vpe + +%*** get system info +\ifx\vpe@system\@empty + \immediate\write18{\vpe@command\space -system \jobname.vpe} + \def\vpesystem#1{\gdef\vpe@system{#1}}% + \begingroup + \endlinechar-1 % + \read\vpe@read to \vpe@temp + \vpe@temp + \endgroup + \ifx\vpe@system\@empty + \PackageWarningNoLine{vpe}{% + Option \string`system\string' is not specified and\MessageBreak + the automatic detection failed,\MessageBreak + therefore package loading is aborted% + }% + \closein\vpe@read + \let\VPE\relax + \expandafter\expandafter\expandafter\endinput + \fi +\fi +\let\vpesystem\@gobble + +\newif\ifvpe@linux +\def\vpe@temp{linux} +\ifx\vpe@system\vpe@temp + \vpe@linuxtrue +\else + \def\vpe@temp{win} + \ifx\vpe@system\vpe@temp + \else + \PackageWarningNoLine{vpe}{% + Unknown value `\vpe@system' of option \string`system\string',% + \MessageBreak + therfore package loading is aborted% + }% + \closein\vpe@read + \let\VPE\relax + \expandafter\expandafter\expandafter\endinput + \fi +\fi + +%*** /AcroForm in the catalog for `revert' menu item of AR4.05 +\ifvpe@acroform + \ifvpe@pdftex + \AtEndDocument{% + \@ifundefined{SubmitObject}{% + \pdfcatalog{/AcroForm<</Fields[]/NeedAppearances true>>}% + }{% + % /AcroForm already set by hyperref's pdftex driver + }% + }% + \else + \vpe@dvips@pdfmark{% + \string{Catalog\string}% + <</AcroForm<</Fields[]/NeedAppearances true>>>>% + /PUT% + }% + \fi +\fi + +%*** form variant + +% definition without form: +\def\vpe@insertmark{% + \vpe@annot{% + /Subtype/Link% + \ifx\vpe@border\vpe@borderdefault + \else + /Border[\vpe@border]% + \fi + \ifx\vpe@color\vpe@colordefault + \else + /C[\vpe@color]% + \fi + \ifnum\vpe@flag=0 + \else + /F \vpe@flag + \fi + /A<<% + /Type/Action% + /S/Launch% + \ifvpe@linux + /F(\vpe@temp\vpe@removeslash\vpe@peekfile.vpe)% + \else + /Win<<% + /F(\vpe@application)% + /P(\vpe@temp)% + >>% + \fi + >>% + \vpe@attr + }% +}% + +\ifvpe@form + \ifvpe@pdftex + + \RequirePackage[pdftex]{color} + \RequirePackage{pifont} + + \newcount\vpe@count + \vpe@count0 + + \setbox\@tempboxa=\hbox{% + \color{yellow}% + \raisebox{-.4\totalheight}{% + \ding{56}% + }% + } + \edef\vpe@mark@width{\the\wd\@tempboxa} + \edef\vpe@mark@height{\the\ht\@tempboxa} + \edef\vpe@mark@depth{\the\dp\@tempboxa} + \immediate\pdfxform\@tempboxa + \edef\vpe@mark@objN{ \the\pdflastxform\space 0 R} + \setbox\@tempboxa=\hbox{% + \colorbox{yellow}{% + \color{black}% + \ding{56}% + }% + } + \immediate\pdfxform\@tempboxa + \edef\vpe@mark@objD{ \the\pdflastxform\space 0 R} + + \def\vpe@insertmark{% + \global\advance\vpe@count1 % + \begingroup + \setbox\@tempboxa\hbox{% + \normalfont + \kern\vpe@mark@width + \scriptsize\ttfamily + \setlength{\fboxsep}{0.5ex}% + \colorbox{yellow}{% + \color{black}% + \space\vpe@peekfile, \vpe@line + }% + }% + \dimen@\ht\@tempboxa + \advance\dimen@-\vpe@mark@height + \advance\dimen@-\vpe@mark@depth + \edef\vpe@temp{% + width\the\wd\@tempboxa + height\the\dimen@ + }% + \dimen@\dp\@tempboxa + \advance\dimen@\vpe@mark@height + \advance\dimen@\vpe@mark@depth + \edef\vpe@temp{% + \vpe@temp + depth\the\dimen@ + }% + \immediate\pdfxform\@tempboxa + \pdfannot\vpe@temp{% + /Subtype/Widget% + /FT/Btn% + /Ff 65537% readonly (bit 1) + checkbox button (bit 17) + /T(v\the\vpe@count)% + /AS/X% + /AP<</N<</F \the\pdflastxform\space 0 R>>>>% + }% + \endgroup + \pdfannot width\vpe@mark@width + height\vpe@mark@height + depth\vpe@mark@depth{% + /Subtype/Widget% + /FT/Btn% + /Ff 65536% + /T(m\the\vpe@count)% + /H/P% + /AP<</N\vpe@mark@objN/D\vpe@mark@objD>>% + /AA<<% + /E<<% + /Type/Action% + /S/SetState% + /T(v\the\vpe@count)% + /AS/F% + >>% + /X<<% + /Type/Action% + /S/SetState% + /T(v\the\vpe@count)% + /AS/X% + >>% + >>% + /A<<% + /Type/Action% + /S/Launch% + \ifvpe@linux + /F(\vpe@temp\vpe@removeslash\vpe@peekfile.vpe)% + \else + /Win<<% + /F(\vpe@application)% + /P(\vpe@temp)% + >>% + \fi + >>% + \vpe@attr + }% + }% + \fi +\fi +\let\vpe@formtrue\relax +\let\vpe@formfalse\relax + +%*** src marker + +\def\vpe@src{\vpe@special{\the\inputlineno}} +\def\vpe@src@sphack{\vpe@special@sphack{\the\inputlineno}} +\def\vpe@srcfirst{\vpe@special1} +\def\vpe@srclast{\vpe@special\vpe@peeklast} + +\let\VPE\vpe@src + +\newif\ifvpe@document +\AtBeginDocument{% + \vpe@documenttrue + \vpe@src +} + +\def\vpe@special{% + \ifcase + \ifvpe@ok + \ifvpe@document + \ifnum\lastpenalty=\z@ + \ifdim\lastskip=\z@ + \else 1% + \fi + \else 1% + \fi + \else 1% + \fi + \else 1% + \fi + 0 % + \expandafter\vpe@@special + \else + \expandafter\@gobble + \fi +} +\def\vpe@special@sphack{% + \ifcase + \ifvpe@ok + \ifvpe@document + \ifhmode + \else 1% + \fi + \else 1% + \fi + \else 1% + \fi + 0 % + \expandafter\vpe@@special + \else + \expandafter\@gobble + \fi +} +\let\vpe@lastspecial\@empty +\def\vpe@@special#1{% + \begingroup + \vpe@okfalse % prevent nesting + \let\vpe@temp\vpe@lastspecial + \xdef\vpe@lastspecial{#1 \vpe@peekfile}% + \ifvpe@dupes + \vpe@@@special{#1}% + \else + \ifx\vpe@temp\vpe@lastspecial + \else + \vpe@@@special{#1}% + \fi + \fi + \endgroup +} +\def\vpe@@@special#1{% + \count@=#1\relax + \ifnum\count@<1 \count@=1 \fi + \edef\vpe@line{\the\count@}% + \ifvpe@linux + \let\vpe@temp\@empty + \expandafter\vpe@scan\the\count@\@nil + \vpe@debug{SRC: \vpe@peekfile, \vpe@line\space(\vpe@temp)}% + \else + \let\vpe@temp\vpe@parameters + \expandafter\vpe@setline\vpe@temp$d\@nil{\the\count@}% + \expandafter\vpe@setfile\vpe@temp$s\@nil\vpe@peekfile + \vpe@debug{SRC: \vpe@peekfile, \vpe@line}% + \fi + \vpe@insertmark +} + +\def\vpe@rule{% + width\vpe@width bp height\vpe@height bp depth\vpe@depth bp% +} +\def\vpe@borderdefault{0 0 1} +\def\vpe@colordefault{0 0 0} +\def\vpe@scan#1#2\@nil{% + \count@=#1\relax + \ifnum\count@>\ifx\vpe@temp\@empty 5 \else 4 \fi + \advance\count@ by -5 + \def\p{.}% + \else + \let\p\@empty + \fi + \@whilenum\count@>0 \do{% + \advance\count@ by -1 + \edef\vpe@temp{\vpe@temp/}% + }% + \edef\vpe@temp{\vpe@temp\p./}% + \ifx\\#2\\% + \else + \@ReturnAfterFi{% + \vpe@scan#2\@nil + }% + \fi +} +\long\def\@ReturnAfterFi#1\fi{\fi#1} + +\def\vpe@removeslash#1{% + \if/#1% + \else + #1% + \fi +} + +\def\vpe@setline#1$d#2\@nil#3{% + \ifx\limits#2\limits + \else + \edef\vpe@temp{#1#3\vpe@remline#2\@nil}% + \fi +} +\def\vpe@remline#1$d\@nil{#1} +\def\vpe@setfile#1$s#2\@nil#3{% + \ifx\limits#2\limits + \else + \def\vpe@temp{#1#3\vpe@remfile#2\@nil}% + \fi +} +\def\vpe@remfile#1$s\@nil{#1} + +%*** def check +\def\vpe@redef#1{% + \expandafter\ifx\csname vpeorg@#1\endcsname\@empty + \begingroup + \let\on@line\@empty + \PackageInfo{vpe}{src marker in % + \expandafter\string\csname #1\endcsname\space + disabled% + }% + \endgroup + \expandafter\@gobble + \else + \expandafter\let + \csname vpeorg@#1\expandafter\endcsname + \csname #1\endcsname + \expandafter\@firstofone + \fi +} +% #1: active character or special case (eg: ~, \\) +% #2: string for command names (eg: TILDE, NL) +\def\vpe@redefspecial#1#2{% + \expandafter\ifx\csname vpeorg@#2\endcsname\@empty + \begingroup + \let\on@line\@empty + \PackageInfo{vpe}{src marker in \string#1 disabled}% + \endgroup + \expandafter\@gobble + \else + \expandafter\let\csname vpeorg@#2\endcsname#1% + \expandafter\@firstofone + \fi +} +\def\vpe@check#1{% + \expandafter\ifx\csname vpeorg@#1\endcsname\@empty + \begingroup + \let\on@line\@empty + \PackageInfo{vpe}{src marker in % + \expandafter\string\csname #1\endcsname\space + disabled% + }% + \endgroup + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi +} + +%*** file name stack +\newcount\vpe@sp % stack pointer +\global\vpe@sp=0 + +\newif\ifvpe@stack +\vpe@stacktrue +\AtEndDocument{\global\vpe@stackfalse} + +\def\vpe@push#1{% + \ifvpe@stack + \global\advance\vpe@sp by 1 + \vpe@debug{PUSH(\the\vpe@sp): #1}% + \immediate\write18{% + \vpe@command\space + -sty + -progname=\vpe@progname\space + \ifx\vpe@debug\@gobble\else -v \fi + #1 % + \jobname.vpe% + }% + \gdef\vpe@file{#1}% + \gdef\vpe@last{10000}% + \ifeof\vpe@read + \vpe@debug{EOF: \jobname.vpe}% + \else + \begingroup + \endlinechar-1 % + \read\vpe@read to \vpe@temp + \vpe@temp + \endgroup + \fi + \vpe@debug{% + LEVEL: \the\vpe@sp, FILE: \vpe@file, LAST: \vpe@last + }% + \expandafter\xdef\csname vpeF\the\vpe@sp\endcsname{\vpe@file}% + \expandafter\xdef\csname vpeL\the\vpe@sp\endcsname{\vpe@last}% + \fi +} +\def\vpeentry#1#2{% + \gdef\vpe@file{#1}% + \gdef\vpe@last{#2}% +} +\def\vpe@pop{% + \ifvpe@stack + \global\advance\vpe@sp by -1 % + \vpe@debug{POP(\the\vpe@sp)}% + \fi +} +\def\vpe@peekfile{% + \csname vpeF\the\vpe@sp\endcsname +} +\def\vpe@peeklast{% + \csname vpeL\the\vpe@sp\endcsname +} + +\vpe@push{\jobname} + +\AtEndDocument{% + \vpe@debug{MAKE SYMBOL LINKS}% + \immediate\write18{% + \vpe@command\space + \ifx\vpe@debug\@gobble\else -v \fi\jobname.pdf% + }% +} + +%*** file input +\def\vpe@doinput#1#2{% + \VPE + \vpe@push{#2}% + \vpe@srcfirst + #1{#2}% + \vpe@srclast + \vpe@pop + \VPE +} + +\vpe@redef{input}{% + \def\input{\@ifnextchar\bgroup\vpe@input\vpeorg@input} + \def\vpe@input{\vpe@doinput\vpeorg@input} +} +\vpe@redef{@input}{% + \def\@input#1{% + \IfFileExists{#1}\@firstofone\@gobble\vpe@doinput + \vpeorg@@input{#1}% + }% +} + +\vpe@redef{include}{\def\include{\vpe@doinput\vpeorg@include}} + +\vpe@redef{newpage}{% + \def\newpage{% + \VPE + \vpeorg@newpage + \vpe@emptyeverypar + }% +} +\vpe@redef{clearpage}{\def\clearpage{\vpeorg@clearpage\VPE}} + +%*** everypar +\def\vpe@everypar{\everypar\expandafter{\the\everypar\VPE}} +\def\vpe@emptyeverypar{% + \edef\vpe@temp{\the\everypar}% + \ifx\vpe@temp\@empty + \everypar{\VPE}% + \fi +} +\iffalse +\vpe@redef{everypar}{% + \def\everypar#1#{\vpe@everypar} + \def\vpe@everypar#1{% + \vpeorg@everypar{#1\VPE}% + }% +} +\fi +\vpe@redef{document}{% + \def\document{% + \global\vpe@stackfalse + \vpeorg@document + \global\vpe@stacktrue + \VPE + \vpe@emptyeverypar + \ignorespaces + }% +} +\vpe@redef{@item}{% + \def\@item[#1]{% + \vpeorg@@item[{#1}]% + \VPE + \vpe@doubleeverypar + \ignorespaces + }% +} +\iffalse +\vpe@redef{@verbatim}{% + \def\@verbatim{% + \vpeorg@@verbatim + \vpe@everypar + }% +} +\fi +\vpe@check{@doendpe}{% + \def\@doendpe{% + \@endpetrue + \def\par{% + \@restorepar + \everypar{\VPE}% + \par + \@endpefalse + }% + \everypar{% + {\setbox\z@\lastbox}% + \everypar{\VPE}% + \@endpefalse + \VPE + }% + }% +} +\vpe@redef{@arrayparboxrestore}{% + \def\@arrayparboxrestore{% + \vpeorg@@arrayparboxrestore + \vpe@everypar + }% +} +\vpe@redef{@xsect}{% + \def\@xsect#1{% + \vpeorg@@xsect{#1}% + \vpe@doubleeverypar + \ignorespaces + }% +} +\vpe@redef{@afterheading}{% + \def\@afterheading{% + \vpeorg@@afterheading + \vpe@doubleeverypar + }% +} +\vpe@redef{@setminipage}{% + \def\@setminipage{% + \vpeorg@@setminipage + \vpe@doubleeverypar + }% +} +\def\vpe@doubleeverypar{% + \expandafter\vpe@@doubleeverypar\the\everypar\everypar!!\@nil +} +\def\vpe@@doubleeverypar#1\everypar#2#3\@nil{% + \def\vpe@temp{#2}% + \ifx\vpe@temp\@empty + \everypar\expandafter{\the\everypar\vpe@everypar}% + \fi + \vpe@everypar +} +\vpe@redef{@startsection}{% + \def\@startsection{% + \if@nobreak + \let\vpe@orgeverypar\everypar + \let\everypar\vpe@tempeverypar + \fi + \vpeorg@@startsection + }% +} +\def\vpe@tempeverypar#1{% + \let\everypar\vpe@orgeverypar + \everypar{#1\VPE}% +} + +\vpe@check{everymath}{\everymath{\VPE}} + +\ifvpe@everyhbox + \everyhbox\expandafter{\the\everyhbox\VPE}% +\fi + +\vpe@redef{newline}{\def\newline{\VPE\vpeorg@newline}} +\vpe@redefspecial{\\}{NL}{\def\\{\VPE\vpeorg@NL}} +\vpe@redef{tabularnewline}{% + \def\tabularnewline{\VPE\tabularnewline} +} + +\vpe@redef{mbox}{% + \def\mbox{\VPE\vpe@mbox} + \long\def\vpe@mbox#1{\vpeorg@mbox{#1\VPE}} +} + +\vpe@redefspecial{~}{TILDE}{\def~{\VPE\vpeorg@TILDE}} + +\vpe@redef{ref}{\def\ref{\VPE\vpeorg@ref}} +\vpe@redef{cite}{\def\cite{\VPE\vpeorg@cite}} + +\vpe@redef{item}{\def\item{\VPE\vpeorg@item}} +\vpe@redef{trivlist}{\def\trivlist{\VPE\vpeorg@trivlist}} +\vpe@redef{endtrivlist}{\def\endtrivlist{\VPE\vpeorg@endtrivlist}} + +\vpe@redef{@bsphack}{\def\@bsphack{\vpeorg@@bsphack\VPE}} +\vpe@redef{@esphack}{\def\@esphack{\VPE\vpeorg@@esphack}} +\vpe@redef{@Esphack}{\def\@Esphack{\VPE\vpeorg@@Esphack}} +\vpe@redef{@xaddvskip}{\def\@xaddvskip{\vpeorg@@xaddvskip\VPE}} + +\vpe@redef{@tabularcr}{\def\@tabularcr{\VPE\vpeorg@@tabularcr}} +\vpe@redef{@arraycr}{\def\@arraycr{\VPE\vpeorg@@arraycr}} + +\vpe@redef{hrule}{\def\hrule{\VPE\vpeorg@hrule}} +\vpe@redef{vrule}{\def\vrule{\VPE\vpeorg@vrule}} +\endinput |