[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] tex2text
From: |
Andreas Roehler |
Subject: |
[AUCTeX] tex2text |
Date: |
Sat, 11 Nov 2006 18:20:03 +0100 |
User-agent: |
Thunderbird 1.5.0.4 (X11/20060516) |
Couldn't find a convenient way to transfer tex-files
into plain text.
Tried pdf, pdftotext - there are always corrections to
do afterwards.
So I set out to hack it in Emacs.
Here is the beginning:
(defun tex2text (&optional ispec)
"Kill tex-formatters, preserve address, signature and phone "
(interactive "*p")
(while
(re-search-forward
"\\(\\\\[^\[{]+\\)[\[{]\\{1\\}\\([^\]}]+[\]}]\\{1\\}.*\\)$" nil t 1)
(cond
((string= (match-string 1) "\\phone")
(replace-match (match-string 2))
(beginning-of-line)
(insert (concat "Tel.: ")))
((string= (match-string 1) "\\address")
(replace-match (match-string 2)))
((string= (match-string 1) "\\signature")
(save-excursion
(goto-char (point-max))
(insert (match-string 2)))
(replace-match ""))
(t
(replace-match "")))))
Maybe there is a more efficient way though?
__
Andreas Roehler
- [AUCTeX] tex2text,
Andreas Roehler <=