"Translate."
(interactive)
(latexi-translate-file "gnus")
- (latexi-translate-file "gnus-faq"))
+ (latexi-translate-file "gnus-faq")
+ (latexi-translate-file "message" t)
+ (latexi-translate-file "emacs-mime" t)
+ (latexi-translate-file "sieve" t)
+ (latexi-translate-file "pgg" t))
-(defun latexi-translate-file (file)
+(defun latexi-translate-file (file &optional as-a-chapter)
"Translate file a LaTeX file."
(let ((item-string "")
(item-stack nil)
(progn (end-of-line) (point))))
(if (equal arg "@head")
(insert "\\gnusinteresting")))
- ((member command '("setfilename"
+ ((member command '("setfilename" "set"
"synindex" "setchapternewpage"
"summarycontents" "bye"
"top" "iftex" "cartouche"
"ifnottex" "direntry"))
(latexi-discard-until command))
((member command '("subsection" "subsubsection"))
- (latexi-switch-line command arg))
+ (if as-a-chapter
+ (latexi-switch-line (format "sub%s" command) arg)
+ (latexi-switch-line command arg)))
((member command '("chapter"))
- (latexi-switch-line
- (format
- "gnus%s{\\epsfig{figure=ps/new-herd-%d.ps,scale=.5}}"
- command (incf chapter))
- arg))
+ (if (string-match "Index" arg)
+ (latexi-strip-line)
+ (if as-a-chapter
+ (latexi-switch-line "gnussection" arg)
+ (latexi-switch-line
+ (format
+ "gnus%s{%s}" command
+ (format "\\epsfig{figure=ps/new-herd-%d,scale=.5}"
+ (if (> (incf chapter) 9) 9 chapter)))
+ arg))))
((member command '("section"))
- (latexi-switch-line (format "gnus%s" command) arg))
+ (if as-a-chapter
+ (latexi-switch-line "subsection" arg)
+ (latexi-switch-line (format "gnus%s" command) arg)))
((member command '("cindex" "findex" "kindex" "vindex"))
(latexi-index-command command arg))
((member command '("*"))
(insert "\\\\"))
((equal command "sp")
(replace-match "" t t))
+ ((member command '("deffn" "defvar" "defun"))
+ (replace-match "" t t))
((equal command "node")
(latexi-strip-line)
- (insert (format "\\label{%s}\n" arg)))
+ (unless (string-match "Index" arg)
+ (insert (format "\\label{%s}\n" arg))))
((equal command "contents")
(latexi-strip-line)
;;(insert (format "\\tableofcontents\n" arg))
(insert (format "\\end{%s}\n" arg)))
((member arg '("iflatex" "iftex" "cartouche"))
(latexi-strip-line))
+ ((member arg '("deffn" "defvar" "defun"))
+ (latexi-strip-line))
(t
(error "Unknown end arg: %s" arg))))
((member command '("table"))
(insert "duppat{}"))
((equal command "settitle")
(latexi-strip-line)
- (insert (format "\\newcommand{\\gnustitlename}{%s}\n" arg)))
+ (if (not as-a-chapter)
+ (insert
+ (format "\\newcommand{\\gnustitlename}{%s}\n" arg))))
((equal command "title")
(latexi-strip-line)
(insert (format "\\gnustitlename{%s}\n" arg)))
(delete-char 1))
((equal command "include")
(latexi-strip-line)
- (insert "\\input{gnus-faq.latexi}\n"))
+ (string-match "\\.texi" arg)
+ (insert (format "\\input{%s.latexi}\n"
+ (substring arg 0 (match-beginning 0)))))
((equal command "noindent")
(latexi-strip-line)
(insert "\\noindent\n"))
;; "\\begin{theindex}\\input{gnus.%s}\\end{theindex}\n" arg))
)
(t
- (error "Unknown command (line %d): %s"
+ (error "Unknown command (file %s line %d): %s"
+ file
(save-excursion
(widen)
(1+ (count-lines (point-min) (progn
(latexi-strip-line))
((member command '("ref" "xref" "pxref"))
(latexi-exchange-command (concat "gnus" command) arg))
- ((member command '("sc" "file" "dfn" "emph" "kbd" "uref"
+ ((member command '("sc" "file" "dfn" "emph" "kbd" "key" "uref"
"code" "samp" "var" "strong" "i"
- "result"))
+ "result" "acronym" "email"))
(goto-char (match-beginning 0))
(delete-char 1)
(insert "\\gnus"))
(delete-char 2)
(insert "duppat{}"))
(t
- (error "Unknown command (line %d): %s"
+ (error "Unknown command (file %s line %d): %s"
+ file
(save-excursion
(widen)
(1+ (count-lines (point-min) (progn