;;;; gentext-tex.el in support of generic-text.el -- generic things that get passed to TeX, LaTeX, html, troff, texinfo etc ;;; Time-stamp: <2006-07-11 12:46:51 jcgs> ;; This program is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the ;; Free Software Foundation; either version 2 of the License, or (at your ;; option) any later version. ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License along ;; with this program; if not, write to the Free Software Foundation, Inc., ;; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ;;;;;;;;;;;;;;;; note that this is part-way through being generated by hacking about lists of functions automatically and then patching them up afterwards!!!!!!!!!!!!!!!! (provide 'gentext-tex) (require 'gentext-models) (require 'tex-mode) (defun latex-leave-construct () "Move point out of a bracketted construct. Moves forward if necessary. Returns whether it moved." (interactive) (let ((outside (safe-scan-lists (point) 1 1))) (if outside (progn (goto-char outside) t) nil))) (defun latex-leave-constructs () "Move point out of any bracketted constructs, going forward if necessary. This is what you want to do when you've just typed a header text, and haven't yet left the braces around the name, and want to start a paragraph, for example. It saves on typing, and is nice if using voice input. You just say \"section\" then the section name, then \"new paragraph\", and it all does the right thing." (interactive) ;; yes, I know there's no loop body (while (latex-leave-construct))) (defmodal generic-text-paragraph (tex-mode latex-mode texinfo-mode) (&optional surround) "Insert a paragraph structure. With optional argument, make the region into a paragraph." (interactive "P") (if surround (progn (save-excursion (goto-char (region-end)) (tex-terminate-paragraph nil)) (save-excursion (goto-char (region-beginning)) (tex-terminate-paragraph nil))) (when (eq major-mode 'latex-mode) (latex-leave-constructs)) (tex-terminate-paragraph nil))) (define-skeleton latex-insert-title "Insert a title macro" nil \n "\\title{" _ "}" >) ;; (define-skeleton latex-insert-paragraph ;; "Insert a paragraph macro" ;; nil ;; \n ;; _ ;; \n) (if (not (fboundp 'latex-insert-item)) ;; seems to have appeared around emacs 21 (define-skeleton latex-insert-item "Insert a \item macro." nil \n "\\item " >)) (define-skeleton latex-insert-ordered-list "Insert a ordered-list macro" nil \n "\\begin{enumerate}" \n "\\item " _ \n "\\end{enumerate}" \n) (define-skeleton latex-insert-unordered-list "Insert a unordered-list macro" nil \n "\\begin{itemize}" \n "\\item " _ \n "\\end{itemize}" >) (define-skeleton latex-insert-definition-list "Insert a description-list macro" nil \n "\\begin{description}" \n "\\item[" _ "]" \n "\\end{description}" \n) (define-skeleton latex-insert-table "Insert a table macro" nil \n "\\begin{tabular}" \n _ \n "\\end{tabular}") (define-skeleton latex-insert-table-row "Insert a table-row macro" nil \n "\\table-row " >) (define-skeleton latex-insert-table-data "Insert a table-data macro" nil \n "\\table-data " >) (define-skeleton latex-insert-table-heading "Insert a table-heading macro" nil \n "\\table-heading " >) (define-skeleton latex-insert-hyperlink "Insert a hyperlink macro" nil \n "\\hyperlink " >) (define-skeleton latex-insert-chapter "Insert a header-1 macro" ;; todo: go over to LaTeX-section if using AuCTeX? nil '(latex-leave-constructs) \n "\\chapter{" _ "}" >) (define-skeleton latex-insert-section "Insert a header-2 macro" ;; todo: go over to LaTeX-section if using AuCTeX? nil '(latex-leave-constructs) \n \n "\\section{" _ "} " >) (define-skeleton latex-insert-subsection "Insert a header-3 macro" ;; todo: go over to LaTeX-section if using AuCTeX? nil '(latex-leave-constructs) \n "\\subsection{" _ "}" >) (define-skeleton latex-insert-subsubsection "Insert a header-4 macro" ;; todo: go over to LaTeX-section if using AuCTeX? nil '(latex-leave-constructs) \n "\\subsubsection{" _ "}" >) (define-skeleton latex-insert-horizontal-line "Insert a horizontal-line macro" nil \n "\\horizontal-line " >) (define-skeleton latex-insert-image "Insert a image macro" nil \n "\\image " >) (define-skeleton latex-insert-link-target "Insert a link-target macro" nil \n "\\link-target " >) (define-skeleton latex-insert-italic "Insert a italic macro" nil "\\textit{" _ "}") (define-skeleton latex-insert-bold "Insert a bold macro" nil "\\textbf{" _ "} ") (define-skeleton latex-insert-emphasized "Insert a emphasized macro" nil "\\emph{" _ "}") (define-skeleton latex-insert-definition "Insert a definition macro" nil \n "\\definition " >) (define-skeleton latex-insert-code "Insert a code macro" nil \n "\\code " >) (define-skeleton latex-insert-preformatted "Insert a preformatted macro" nil \n "\\begin{verbatim}" \n _ \n "\\end{verbatim}" >) (define-skeleton latex-insert-quote "Insert a blockquote macro" nil \n "\\begin{quote}" \n _ \n "\\end{quote}") (defmodalalias generic-text-end-sentence latex-mode end-sentence) (defmodalalias generic-text-end-question latex-mode end-question) (defmodalalias generic-text-end-exclamation latex-mode end-exclamation) (defmodalalias generic-text-end-whatever latex-mode end-sentence-with) ;; (defmodalalias generic-text-paragraph latex-mode latex-insert-paragraph) (if (fboundp 'latex-insert-item) (defmodalalias generic-text-insert-item latex-mode latex-insert-item)) (defmodalalias generic-text-ordered-list latex-mode latex-insert-ordered-list) (defmodalalias generic-text-unordered-list latex-mode latex-insert-unordered-list) (defmodalalias generic-text-definition-list latex-mode latex-insert-definition-list) (defmodalalias generic-text-table latex-mode latex-insert-table) (defmodalalias generic-text-table-row latex-mode latex-insert-table-row) (defmodalalias generic-text-table-data latex-mode latex-insert-table-data) (defmodalalias generic-text-table-heading latex-mode latex-insert-table-heading) (defmodalalias generic-text-hyperlink latex-mode latex-insert-hyperlink) (defmodalalias generic-text-header-1 latex-mode latex-insert-chapter) (defmodalalias generic-text-header-2 latex-mode latex-insert-section) (defmodalalias generic-text-header-3 latex-mode latex-insert-subsection) (defmodalalias generic-text-header-4 latex-mode latex-insert-subsubsection) (defmodalalias generic-text-horizontal-line latex-mode latex-insert-horizontal-line) (defmodalalias generic-text-image latex-mode latex-insert-image) (defmodalalias generic-text-link-target latex-mode latex-insert-link-target) (defmodalalias generic-text-italic latex-mode latex-insert-italic) (defmodalalias generic-text-bold latex-mode latex-insert-bold) (defmodalalias generic-text-emphasized latex-mode latex-insert-emphasized) (defmodalalias generic-text-definition latex-mode latex-insert-definition) (defmodalalias generic-text-code latex-mode latex-insert-code) (defmodalalias generic-text-preformatted latex-mode latex-insert-preformatted) (defmodalalias generic-text-blockquote latex-mode latex-insert-quote) (require 'reftex-cite) ; unfortunately defmodalalias is unhappy with autoload, it seems (defmodalalias generic-text-citation latex-mode reftex-citation) ;;; end of generic-text.el