# HG changeset patch # User HIROSE Yuuji # Date 1443682058 -32374 # Node ID fa7408c1a9e313f9f3641687b05f714735383fda # Parent 8923ea11c085c1edcf7eb27eefbc0482e7cbe754# Parent 64c07f0a179f852ef74609c1397c1929f5022eed merged diff -r 8923ea11c085 -r fa7408c1a9e3 yatex.el --- a/yatex.el Thu Oct 01 15:46:25 2015 +0859 +++ b/yatex.el Thu Oct 01 15:47:12 2015 +0859 @@ -1,6 +1,6 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*- ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Wed Jul 8 13:41:17 2015 on duke +;;; Last modified Mon Aug 31 11:59:17 2015 on zxr ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -299,6 +299,8 @@ ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") ;;cleveref ("cref") ("crefrange") ("cpageref") ("labelcref") ("labelcpageref") + ;; beamer + ("frametitle") ("framesubtitle") ) (if YaTeX-use-LaTeX2e '(("documentclass") ("usepackage") @@ -349,7 +351,7 @@ ; Set tex-environment possible completion (defvar env-table (append - '(("quote") ("quotation") ("center") ("verse") ("document") + '(("quote") ("quotation") ("centerc") ("verse") ("document") ("verbatim") ("itemize") ("enumerate") ("description") ("list") ("tabular") ("tabular*") ("table") ("tabbing") ("titlepage") ("sloppypar") ("picture") ("displaymath") @@ -359,6 +361,7 @@ ("minipage") ("supertabular") ("wrapfigure") ("wraptable") + ("frame") ("block") ("example") ("columns") ("column") ;beamer ) (if YaTeX-use-LaTeX2e '(("comment") ;defined in version @@ -410,6 +413,7 @@ ("linebreak") ("pagebreak") ("noindent") ("indent") ("left") ("right") ("dots") ("smallskip") ("medskip") ("bigskip") ("displaystyle") + ("onslide") ("pause") ;beamer ) (if YaTeX-greek-by-maketitle-completion '(("alpha") ("beta") ("gamma") ("delta") ("epsilon") diff -r 8923ea11c085 -r fa7408c1a9e3 yatexadd.el --- a/yatexadd.el Thu Oct 01 15:46:25 2015 +0859 +++ b/yatexadd.el Thu Oct 01 15:47:12 2015 +0859 @@ -1,6 +1,6 @@ ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Wed Jul 8 09:15:15 2015 on firestorm +;;; Last modified Mon Aug 31 22:40:47 2015 on zxr ;;; $Id$ ;;; Code: @@ -2105,6 +2105,85 @@ ((memq c '(?c ?C)) (setq left "{\\scriptsize " right "}"))) (format "%s%s%s" left char right))))) +;;; -------------------- beamer stuff -------------------- +(defvar YaTeX:frame-option-alist-default + '(("plain") ("containsverbatim") ("shrink") ("squeeze") + ("allowframebreaks") ("label="))) +(defvar YaTeX:frame-option-alist-private nil + "*Alist for completion list of the argument for `frame' environemnt") +(defvar YaTeX:frame-option-alist + (append YaTeX:frame-option-alist-private YaTeX:frame-option-alist-default)) + +(defun YaTeX:frame () + (let*((minibuffer-local-completion-map YaTeX-minibuffer-completion-map) + (delim ",") + (opt (YaTeX-completing-read-or-skip + "Frame option: " YaTeX:frame-option-alist)) + (title (YaTeX-read-string-or-skip "Title: ")) + (subtitle (YaTeX-read-string-or-skip "Subtitle: "))) + (setq YaTeX-env-name "columns") + (concat + (if (string< "" opt) (concat "[" opt "]")) + (if (string< "" title) (concat "{" title "}")) + (if (string< "" subtitle) (concat "{" subtitle "}"))))) + +(defun YaTeX:column-read-width () + "Completing function for column environment/macro of Beamer" + (let ((md (match-data)) (colsinf (YaTeX-quick-in-environment-p "columns")) + (totalw (float 1)) restw (ww "\\textwidth") defw cw) + (unwind-protect + (progn + (if (save-excursion + (YaTeX-re-search-active-backward + "totalwidth=\\([.0-9]+\\)\\(\\\\.*width\\)" + YaTeX-comment-prefix (cdr colsinf) t)) + (setq totalw (float (string-to-number (YaTeX-match-string 1))) + ww (YaTeX-match-string 2))) + (setq restw totalw) + (save-excursion + (while (YaTeX-re-search-active-backward + (concat + "\\\\begin{column}{\\([.0-9]+\\)\\(\\\\.*width\\)}" + "\\|" + "\\\\column{\\([.0-9]+\\)\\(\\\\.*width\\)}") + YaTeX-comment-prefix + (cdr colsinf) t) + (setq restw (- restw (string-to-number + (or (YaTeX-match-string 1) + (YaTeX-match-string 3))))))) + (setq defw (format "%.2f%s" + (if (= totalw restw) (/ totalw 2) restw) + (or (YaTeX-match-string 2) + (YaTeX-match-string 4) + ww)) + cw (YaTeX:read-length + (format "Column width(default: %s): " defw))) + (if (string= "" cw) (setq cw defw)) + (prog1 + cw + (setq YaTeX-section-name "column"))) + (store-match-data md)))) + +(defun YaTeX:column () + (if (eq YaTeX-current-completion-type 'begin) + (concat "{" (YaTeX:column-read-width) "}"))) +(defun YaTeX::column (argp) + (cond + ((= argp 1) (YaTeX:column-read-width)))) +(defvar YaTeX:columns-option-alist + '(("t") ("T") ("b") ("c") ("onlytextwidth") ("totalwidth=0.9\\textwidth")) + "*Default option alist for completing columns environment of Beamer") + +(defun YaTeX:columns () + (setq YaTeX-section-name "column" + YaTeX-env-name "column") + (let*((minibuffer-local-completion-map YaTeX-minibuffer-completion-map) + (delim ",=") + (tbl (append YaTeX:columns-option-alist)) ;XX + (opt (YaTeX-completing-read-or-skip "columns option: " tbl))) + (if (string< "" opt) + (concat "[" opt "]")))) + ;;; -------------------- math-mode stuff -------------------- (defun YaTeX::tilde (&optional pos) "For accent macros in mathmode"