;ELC ;;; Compiled by rdsorkin@umoja.phy.syr.edu on Tue Jul 25 01:47:47 2006 ;;; from file /home1/sorkin/ms/eltex/standalone.version/eltex.standalone.el ;;; in Emacs version 20.7.1 ;;; with bytecomp version 2.56 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`eltex.standalone.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\302\303!\207" [require cl provide eltex] 2) #@36 * token that opens reference names (defvar eltex-ref-open "[R::" (#$ . -713)) #@35 * token that opens equation names (defvar eltex-eqn-open "(E::" (#$ . -797)) #@69 * a list of the symbols to be used cyclically to indicate footnotes (defvar eltex-footnote-indicators '("$^\\star$" "$^\\dagger$" "$^\\flat$") (#$ . -880)) #@181 After a call to `eltex-number-refs' this variable holds an ``alist'' mapping each reference-tag to its number. To see this dictionary in readable form call `eltex-list-refs'  (defvar *ref-dictionary* nil (#$ . 1043)) #@178 After a call to `eltex-number-eqs' this variable holds an ``alist'' mapping each equation tag to its number. To see the dictionary in readable form say `eltex-list-eqs'  (defvar *eqn-dictionary* nil (#$ . 1272)) (byte-code "\302\300!\204\303\300 B\303\207" [*eltex-draftmode* current-load-list boundp nil] 2) #@56 Remove repititions from a list scanning from the left (defalias 'stably-remove-duplicates #[(L) "\303 \304\n\305%\207" [L :test :from-end remove-duplicates equal t] 6 (#$ . 1598)]) #@75 Delete up to max blanks, newlines or carriage returns forward from point (defalias 'del-blanks-fwd #[(max) " S\211\302Y\203g\303\304\305E\235\203\306\307!\210\202)\310\207" [max #1=#:G67204 0 32 10 13 delete-char 1 nil] 4 (#$ . 1787)]) #@46 Delete up to max blanks backward from point (defalias 'del-blanks-bwd #[(max) " S\211\302Y\203h\303\232\203\304\305!\210\202)\306\207" [max #1=#:G67205 0 32 delete-char -1 nil] 2 (#$ . 2039)]) #@174 Is point within a (``non-escaped'') comment? True iff a `%' strictly precedes point on the same line, and the line does not begin with the `override' escape string.  (defalias 'within-comment-p #[(&optional override) "`\303y\210`b\210\304\305 {\"\205\n \211\nG\\{\232?*\207" [stop start override 0 find 37] 4 (#$ . 2249)]) #@125 True iff point is within a displayed equation (ie is preceded by an odd number of $$'s, ignoring $$ within comments).  (defalias 'within-equation-p #[nil "`\212eb\210\302\303\304\305\306#\203\307 \204 T\202 )!*\207" [end #1=#:G67208 oddp 0 search-forward "$$" t within-comment-p] 5 (#$ . 2592) nil]) #@236 Go to next construct-opening and leave point just after it. Pass over constructs within comments unless they are escaped by `% eltex:' at the beginning of the line. (The word construct means equation number or reference etc)  (defalias 'to-next-open #[(opening) "\303\304\305\n\304\303#\203\306\307!\204`\304\211\204 *\207" [#1=#:G67209 #2=#:G67210 opening t nil search-forward within-comment-p "% eltex:"] 4 (#$ . 2914)]) #@56 used to display dictionary of references or equations (defalias 'eltex-show-dictionary #[(dict) "\302\303\304!!\220\305\302\305\306\307\310!\311 \312$\"\"\221\207" [dict :key princ format "*Eltex Dictionary*" mapcar #[($) "\301\302\"\207" [$ format "%s\n"] 3] sort* copy-seq < cdr] 10 (#$ . 3362)]) #@39 See the documentation for `eltex-do' (defalias 'eltex-list-refs #[nil "\301!\207" [*ref-dictionary* eltex-show-dictionary] 2 (#$ . 3670) nil]) (defalias 'eltex-show-refs 'eltex-list-refs) #@39 See the documentation for `eltex-do' (defalias 'eltex-list-eqs #[nil "\301!\207" [*eqn-dictionary* eltex-show-dictionary] 2 (#$ . 3866) nil]) (defalias 'eltex-show-eqs 'eltex-list-eqs) #@486 Replaces partially processed tags by their numbers, removing up to 16 trailing blanks, as well as part of the opening. The net effect can be illustrated by [R::{piombino}] --> [17] Notice here that rather than remove the entire opening string "[R::", we have retained its first character in order to preserve the initial bracket. We do the same for an initial parenthesis, but not for any other characters. See the function itself for the klugey details.  (defalias 'eltex-replace-tags #[(dictionary open) "\305\234\306\305\234\307\305\234D\235\203\310\311\"\202\n\312 :\203J @\212\313 \314\f@\315R\312\316#\203B\317\320\321\fA\"\316\211#\210\322\323!\210\202$) A\211\202+\312\207" [open head dictionary #1=#:G67211 x 0 "[" "(" subseq 1 nil search-forward "{" "}" t replace-match format "%s" del-blanks-fwd 16] 6 (#$ . 4060)]) #@1566 Processes references from point forward. A citation should have the form [R::] or [R:: ] where should be either a legal name for an elisp symbol or an integer. We also allow to be be surrounded by a few blanks. (Currently must also be a ``sexp'' for tex mode. Thus, can contain the usual letters [A-z] and digits [0-9] as well as certain special characters including the hyphen [-] and, by special dispensation, the colon [:]. Various other special characters can be ``protected'' by including {} in the tag. For example, `{Minkowski^17:1903_or_1907}' would be valid as a single tag.) This input will turn into [n] where n is a sequential number beginning with *`eltex-ref-offset', which for now is an internal variable set to 1. EXAMPLE [R:: kuku b page 7] --> [6b page 7] A set of tags can be declared equivalent using the syntax % (ref-equivalence:: ...) where the entire equivalence class must go into a single declaration (ie you should NOT declare ovelapping equivalences). EXAMPLE % (ref-equivalence:: logan VisT unimod3) The dictionary used to convert tags into reference numbers is returned and also put into `*ref-dictionary*'. Reference constructs within comments are ignored *unless* the line begins with the string "% eltex:". You can use this to override the numbering you would have got otherwise. ADVERTENCIA A totally blank will cause an error  (defalias 'eltex-number-refs #[nil "\306 \307\310\311\312\312\312\312 \312!\312\"\312#\312$\312%\312&\313\314!\211'\2053\314K(\315\216\314\316M\210\313\317!\211)\205F\317K*\320\216\317\321M\210\313\322!\211+\205Y\322K,\323\216\322\324M\210\313\325!\211-\205l\325K.\326\216\325\327M\210\313\330!\211/\205\330K0\331\216\330\332M\210\212\333\314 ! \317 \210\325\333\322 !!!\330 \210\334!\n\"\210 !L.\207" [eltex-ref-offset eltex-ref-open ref-open equiv-open equiv-close return-dictionary 1 "(ref-equivalence::" ")" *ref-dictionary* nil fboundp gather-tags ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#1=#:--letf-bound--67215 #2=#:--letf-save--67214 gather-tags fmakunbound] 2)) #[nil "\212\305\306 !\203(\307\310!\210`\311\312\313\217\n {\314\n \315\f\316Q#\210\fB\202\237*\207" [#3=#:G67232 ref-open tag-start tag-end tag nil to-next-open del-blanks-fwd 16 msg (byte-code "\302\303z!\304\305\"\210\306 \210\304 \"\210`*\207" [colon save-syntax 58 string modify-syntax-entry "_" forward-sexp] 3) ((error (byte-code "\301\302\303!!\220\301\302\304`\305 A@`\306Z`\307\\{%!\221\210\310\311!\207" [msg princ format " *error in reference numberer*" "Likely syntax error in tex file.\nProblem is near character %d in buffer %s.\n(Error message was: %s.)\nHere is a glimpse of the offending text:\n=======================================\n%s\n=======================================" buffer-name 64 48 error "Numbering cannot continue"] 10))) cl-set-buffer-substring "{" "}"] 6] gather-equivalences ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#4=#:--letf-bound--67219 #5=#:--letf-save--67218 gather-equivalences fmakunbound] 2)) #[nil "\212eb\210\n\306\307 \306\310#\203+`\307 !\311\312\313\314 {\315Q!\"\fB\202\n\f\237,\211\207" [equiv-open open equiv-close close #6=#:G67237 start nil search-forward t mapcar #[($) "9\203 \301!\207\250\203\302\303\"\207\304\305!\207" [$ symbol-name format "%s" error "invalid tag used for a reference"] 3] Read-from-string "( " " )" stop equivalences] 6] canonize-tags ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#7=#:--letf-bound--67223 #8=#:--letf-save--67222 canonize-tags fmakunbound] 2)) #[nil "\306!\n\307 :\203@ @\211@\fA\n\307 \n:\2038\n@ \310  \f\311%\210\nA\211\n\202+ A\211\202 +\207" [tags c-tags equivalences #9=#:G67238 fiber x copy-seq nil nsubstitute equal #10=#:G67239 y :test] 8] make-dictionary ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#11=#:--letf-bound--67227 #12=#:--letf-save--67226 make-dictionary fmakunbound] 2)) #[(tags) "\305 G\306\nW\203 8\f\\B BT\211\202 \237+\207" [j tags #13=#:G67240 #14=#:G67241 eltex-ref-offset 0 nil] 4] complete-dictionary ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#15=#:--letf-bound--67231 #16=#:--letf-save--67230 complete-dictionary fmakunbound] 2)) #[nil "\305 :\203# @\306\n@ \"A\307\310\311\nA\" \" A\211\202 *\211\207" [equivalences #17=#:G67242 fiber dictionary n nil assoc append mapcar #[($) " B\207" [$ n] 2]] 5] stably-remove-duplicates eltex-replace-tags tag-start tag-end tag tags dictionary msg start stop equivalences n #1# #2# #4# #5# #7# #8# #11# #12# #15# #16#] 4 (#$ . 4941)]) #@1118 Processes equations from point forward. An equation number should have the form (E:: ) where should be either a legal name for an elisp symbol or an integer, and should ALSO be a sexp in tex mode. (It can be surrounded by a few blanks.) This input will turn into (n) where n is a sequential number beginning with *`eltex-eqn-offset', which for now is an internal variable set to 1. Example: (E::kuku b) --> (6b) WARNINGS 1. ``Forward references'' to equations may fail if `$$' are embedded within comments. 2. Using ``(E::??)'' as an eq. number will cause an error (``??'' is not a sexp in tex mode!) 3. A totally blank tag will cause an error 4. Only tags that actually number equations get processed. A stray equation number in the text will not be processed if it corresponds to no actual equation 5. Commented out equations once confused it, but are supposed to be ok now. The dictionary that governs the conversion of tags into equation numbers is returned and also put into `*eqn-dictionary*'.  (defalias 'eltex-number-eqs #[nil "\306 \307\310\310\310\310\310\310\311\312!\211\205!\312K\313\216\312\314M\210\311\315!\211\2054\315K\316\216\315\317M\210\212\320\312 !\315!\321\n\"\210 L.\207" [eltex-eqn-offset eltex-eqn-open eqn-open return-dictionary tag-start tag-end 1 *eqn-dictionary* nil fboundp gather-tags ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#1=#:--letf-bound--67246 #2=#:--letf-save--67245 gather-tags fmakunbound] 2)) #[nil "\212\305\306 !\2032\307\310!\210`\311\312\313\217\n {\314\n \315\f\316Q#\210\317 \203\320 \204\fB\202\237*\207" [#3=#:G67251 eqn-open tag-start tag-end tag nil to-next-open del-blanks-fwd 16 msg (byte-code "\300 \210`\207" [forward-sexp] 1) ((error (byte-code "\301\302\303!!\220\301\302\304`\305 A@`\306Z`\307\\{%!\221\210\310\311!\207" [msg princ format " *error in equation numberer*" "Likely syntax error in tex file.\nProblem is near character %d in buffer %s.\n(Error message was: %s.)\nHere is a glimpse of the offending text:\n=======================================\n%s\n=======================================" buffer-name 64 48 error "Numbering cannot continue"] 10))) cl-set-buffer-substring "{" "}" within-equation-p within-comment-p] 6] make-dictionary ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#4=#:--letf-bound--67250 #5=#:--letf-save--67249 make-dictionary fmakunbound] 2)) #[(tags) "\306 \306 :\203 @\211\fB B A\fT\202 \237,\207" [tags #6=#:G67255 tag eltex-eqn-offset j #7=#:G67256 nil] 3] stably-remove-duplicates eltex-replace-tags tag tags dictionary msg #1# #2# #4# #5#] 4 (#$ . 9800)]) #@412 Provides footnote labels for footnotes that begin: \footnote{}, choosing them cyclically from the list `eltex-footnote-indicators', which normally is (asterisk dagger flat). If the footnote begins any other way than \footnote{}, it will be ignored. This can be convenient if you want to label certain footnotes by hand, or for latex files. If you need an extra indicator try \ddagger or \otimes.  (defalias 'eltex-provide-footnote-indicators #[nil "\212\302\303\304\305#\203\306\307!\210 @c\210\310 A @C\"\202*\304\207" [eltex-footnote-indicators inds search-forward "\\footnote{}" nil t backward-char 1 append] 4 (#$ . 12576)]) #@1051 Numbers the equations and references in a TeX buffer, also provides symbols for the footnotes. Then writes the processed text out to the file `tmp.tex'. Equation and reference numbers should have the respective forms (E:: ) and [R:: ], and a footnote should begin as: \footnote{} if you want eltex to process it. For further details, see the documentation for the functions eltex-number-eqs, eltex-number-refs, and eltex-provide-footnote-indicators. Unless dissuaded by a prefix argument, we also suspend emacs so you can tex the file tmp.tex from shell level. (NOT WORKING FOR NOW: Your directory is also changed after the suspension to that where tmp.tex resides.) To see the respective dictionaries use `eltex-list-refs' or `eltex-list-eqs'. (See the documentation for the global variables *ref-dictionary* and *eqn-dictionary*.) The interactive commands `eqn' and `ref' aid in writing the TeX file (and they do name completion). Normally the keystrokes ^C^C will invoke `eltex-do'  (defalias 'eltex-do #[(&optional no-suspend) "\212\304\305\306\"\210p\307\310!\211q\210\311!\210\312 \210\313\314!\210\315 \210\313\316!\210\317\320!\210\321 \210\317\322!\210\323 \210\317\324!\210\325 \210\326\310!\210\327 !\210+\n?\205I\330\331 P!\207" [in-buff temp-buff no-suspend default-directory local-set-key [3 3] eltex-do generate-new-buffer "tmp.tex" insert-buffer tex-mode outline-minor-mode 1 show-all 0 message "Starting on references" eltex-number-refs "Starting on equations" eltex-number-eqs "Starting on footnotes" eltex-provide-footnote-indicators write-file kill-buffer suspend-emacs "cd "] 4 (#$ . 13234) "P"]) (defalias 'eltex-do-draftmode #[(&optional no-suspend) "\302\303 !\210)\302\211\207" [*eltex-draftmode* no-suspend nil eltex-do] 2 nil "P"]) #@104 Takes from user and inserts ``[R::]'' into the text. Will do completion on .  (defalias 'ref #[nil "\302\303\"\304 \305Qc\210\306\307!\210\310\311\312 \"\")\207" [*ref-dictionary* tag completing-read "reference name? " "[R::" "]" eltex-do no-suspend message "%s" assoc] 5 (#$ . 15070) nil]) #@103 Takes from user and inserts ``(E::)'' into the text Will do completion on .  (defalias 'eqn #[nil "\302\303\"\304 \305Qc\210\306\307!\210\310\311\312 \"\")\207" [*eqn-dictionary* tag completing-read "equation name? " "(E::" ")" eltex-do no-suspend message "%s" assoc] 5 (#$ . 15396) nil]) #@46 Insert template for an eltex sytle footnote (defalias 'footnote #[nil "\300c\210\301\302!\207" ["\\footnote{}\n%\n{\n}\n%" previous-line 2] 2 (#$ . 15719) nil])