X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=texi%2Ftexi2latex.el;h=91ccda6e27c2b66f88032d3c922315a9e1787768;hp=f77b84fe77372b3284125e8576680a0dcf371b4d;hb=c14337e1a2a4def64360a74f2669160805f49323;hpb=1003ef003d894967ca5b5fe4a5f54919c1597d3f diff --git a/texi/texi2latex.el b/texi/texi2latex.el index f77b84fe7..91ccda6e2 100644 --- a/texi/texi2latex.el +++ b/texi/texi2latex.el @@ -1,5 +1,5 @@ ;;; texi2latex.el --- convert a texi file into a LaTeX file. -;; Copyright (C) 1996, 2004 Lars Magne Ingebrigtsen +;; Copyright (C) 1996, 2004, 2008 Lars Magne Ingebrigtsen (require 'cl) @@ -64,7 +64,18 @@ (erase-buffer) (insert-buffer-substring cur) (goto-char (point-min)) + (when (search-forward "@copying" nil t) + (latexi-copying)) + (while (search-forward "@insertcopying" nil t) + (delete-region (match-beginning 0) (match-end 0)) + (latexi-insertcopying)) + (goto-char (point-min)) (latexi-strip-line) + (latexi-translate-string "@'e" "\\'{e}") + (latexi-translate-string "@`a" "\\`{a}") + (latexi-translate-string "@,{c}" "\\c{c}") + (latexi-translate-string "@aa{}" "{\\aa}") + (latexi-translate-string "@\"{@dotless{i}}" "ï") (latexi-translate-string "%@{" "\\gnuspercent{}\\gnusbraceleft{}") (latexi-translate-string "%@}" "\\gnuspercent{}\\gnusbraceright{}") (latexi-translate-string "%1@{" "\\gnuspercent{}1\\gnusbraceright{}") @@ -387,4 +398,23 @@ "\\\\\n")) (insert "\\end{tabular}\n") (widen)))) - + +(defvar latexi-copying-text "" + "Text of the copyright notice and copying permissions.") + +(defun latexi-copying () + "Copy the copyright notice and copying permissions from the Texinfo file, +as indicated by the @copying ... @end copying command; +insert the text with the @insertcopying command." + (let ((beg (progn (beginning-of-line) (point))) + (end (progn (re-search-forward "^@end copying[ \t]*\n") (point)))) + (setq latexi-copying-text + (buffer-substring-no-properties + (save-excursion (goto-char beg) (forward-line 1) (point)) + (save-excursion (goto-char end) (forward-line -1) (point)))) + (delete-region beg end))) + +(defun latexi-insertcopying () + "Insert the copyright notice and copying permissions from the Texinfo file, +which are indicated by the @copying ... @end copying command." + (insert (concat "\n" latexi-copying-text)))