yatex
changeset 424:af4fa99fabd3 dev
Beamer: column/columns
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 31 Aug 2015 22:23:02 +0900 |
parents | e1e67b1b70e6 |
children | 3c29f87e383b |
files | yatex.el yatexadd.el |
diffstat | 2 files changed, 56 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/yatex.el Mon Aug 31 11:58:39 2015 +0900 1.2 +++ b/yatex.el Mon Aug 31 22:23:02 2015 +0900 1.3 @@ -1,6 +1,6 @@ 1.4 ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*- 1.5 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] 1.6 -;;; Last modified Fri Aug 28 21:02:24 2015 on zxr 1.7 +;;; Last modified Mon Aug 31 11:59:17 2015 on zxr 1.8 ;;; $Id$ 1.9 ;;; The latest version of this software is always available at; 1.10 ;;; http://www.yatex.org/ 1.11 @@ -361,7 +361,7 @@ 1.12 ("minipage") 1.13 ("supertabular") 1.14 ("wrapfigure") ("wraptable") 1.15 - ("frame") ("block") ("example") ;beamer 1.16 + ("frame") ("block") ("example") ("columns") ("column") ;beamer 1.17 ) 1.18 (if YaTeX-use-LaTeX2e 1.19 '(("comment") ;defined in version
2.1 --- a/yatexadd.el Mon Aug 31 11:58:39 2015 +0900 2.2 +++ b/yatexadd.el Mon Aug 31 22:23:02 2015 +0900 2.3 @@ -1,6 +1,6 @@ 2.4 ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- 2.5 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] 2.6 -;;; Last modified Mon Aug 31 11:57:05 2015 on zxr 2.7 +;;; Last modified Mon Aug 31 22:22:33 2015 on zxr 2.8 ;;; $Id$ 2.9 2.10 ;;; Code: 2.11 @@ -2121,11 +2121,64 @@ 2.12 "Frame option: " YaTeX:frame-option-alist)) 2.13 (title (YaTeX-read-string-or-skip "Title: ")) 2.14 (subtitle (YaTeX-read-string-or-skip "Subtitle: "))) 2.15 + (setq YaTeX-env-name "columns") 2.16 (concat 2.17 (if (string< "" opt) (concat "[" opt "]")) 2.18 (if (string< "" title) (concat "{" title "}")) 2.19 (if (string< "" subtitle) (concat "{" subtitle "}"))))) 2.20 2.21 +(defun YaTeX:column-read-width () 2.22 + "Completing function for column environment/macro of Beamer" 2.23 + (let ((md (match-data)) (colsinf (YaTeX-quick-in-environment-p "columns")) 2.24 + (colw (float 1)) defw cw) 2.25 + (unwind-protect 2.26 + (progn 2.27 + (save-excursion 2.28 + (while (YaTeX-re-search-active-backward 2.29 + (concat 2.30 + "\\\\begin{column}{\\([.0-9]+\\)\\(\\\\.*width\\)}" 2.31 + "\\|" 2.32 + "\\\\column{\\([.0-9]+\\)\\(\\\\.*width\\)}") 2.33 + YaTeX-comment-prefix 2.34 + (cdr colsinf) t) 2.35 + (setq colw (- colw (string-to-number 2.36 + (or (YaTeX-match-string 1) 2.37 + (YaTeX-match-string 3))))))) 2.38 + (setq defw (format "%.1f%s" 2.39 + (if (= colw (float 1)) 2.40 + (string-to-number "0.5") 2.41 + colw) 2.42 + (or (YaTeX-match-string 2) 2.43 + (YaTeX-match-string 4) 2.44 + "\\textwidth")) 2.45 + cw (YaTeX:read-length 2.46 + (format "Column width(default: %s): " defw))) 2.47 + (if (string= "" cw) (setq cw defw)) 2.48 + (prog1 2.49 + cw 2.50 + (setq YaTeX-section-name "column"))) 2.51 + (store-match-data md)))) 2.52 + 2.53 +(defun YaTeX:column () 2.54 + (if (eq YaTeX-current-completion-type 'begin) 2.55 + (concat "{" (YaTeX:column-read-width) "}"))) 2.56 +(defun YaTeX::column (argp) 2.57 + (cond 2.58 + ((= argp 1) (YaTeX:column-read-width)))) 2.59 +(defvar YaTeX:columns-option-alist 2.60 + '(("t") ("T") ("b") ("c") ("onlytextwidth") ("totalwidth=0.9\\linewidth")) 2.61 + "*Default option alist for completing columns environment of Beamer") 2.62 + 2.63 +(defun YaTeX:columns () 2.64 + (setq YaTeX-section-name "column" 2.65 + YaTeX-env-name "column") 2.66 + (let*((minibuffer-local-completion-map YaTeX-minibuffer-completion-map) 2.67 + (delim ",=") 2.68 + (tbl (append YaTeX:columns-option-alist)) ;XX 2.69 + (opt (YaTeX-completing-read-or-skip "columns option: " tbl))) 2.70 + (if (string< "" opt) 2.71 + (concat "[" opt "]")))) 2.72 + 2.73 ;;; -------------------- math-mode stuff -------------------- 2.74 (defun YaTeX::tilde (&optional pos) 2.75 "For accent macros in mathmode"