File: multirow.hlx

package info (click to toggle)
hyperlatex 2.5-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 480 kB
  • ctags: 288
  • sloc: lisp: 2,291; sh: 180; makefile: 86; awk: 21
file content (74 lines) | stat: -rw-r--r-- 2,446 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
%% -*-latex-*-
%%
%% Support for `multirow' package in Hyperlatex
%%
%% (C) 1997, Eric Delaunay <delaunay@lix.polytechnique.fr>

\newcommand{\multirowsetup}{}

\HlxEval{
(put 'multirow 'hyperlatex 'hyperlatex-format-multirow)

(defun hyperlatex-format-multirow ()
  "Make an entry that will span multiple rows of a tabular."
  (let ((rows (hyperlatex-parse-required-argument))
    (width (hyperlatex-parse-required-argument))
	(item (hyperlatex-parse-required-argument))
	(here (point-marker)))
    (if (<= hyperlatex-html-level 20)
	(error "\\multirow not available in Html2")
      (re-search-backward
       (concat "COLSPAN=" hyperlatex-meta-dq "1" hyperlatex-meta-dq))
      (replace-match 
       (format (concat "COLSPAN=" hyperlatex-meta-dq "1" hyperlatex-meta-dq
		       " ROWSPAN=" hyperlatex-meta-dq "%s" hyperlatex-meta-dq)
	       rows))
      (goto-char here)
      (insert item)
      (goto-char here)
      (set-marker here nil)
      (setcar (nthcdr (car (car hyperlatex-tabular-column-descr))
		   hyperlatex-tabular-nrows-count)
	      (1- (- (string-to-int rows))))
)))

(if (fboundp 'hyperlatex-format-tab-mro)
  ()
  (fset 'hyperlatex-format-tab-mro (symbol-function 'hyperlatex-format-tab))
  (defun hyperlatex-format-tab ()
    (hyperlatex-format-tab-mro)
    (let* ((pos (1- (car (car hyperlatex-tabular-column-descr))))
	   (val (nth pos hyperlatex-tabular-nrows-count)))
      (if (< val 0)
	(setcar (nthcdr pos hyperlatex-tabular-nrows-count) (- val))
	; else
	(if (<= val 1)
	  ()
	  (let* ((pto (point))
		(pt1 (re-search-backward (concat hyperlatex-meta-< "TD")))
		(pt2 (progn (goto-char (1- pt1)) (re-search-backward (concat hyperlatex-meta-< "TD"))))
		(pt3 (re-search-backward (concat hyperlatex-meta-< "/TD" hyperlatex-meta->))))
	    (goto-char pto)
	    (delete-region pt1 pt2))))))
)

(if (fboundp 'hyperlatex-format-tabular-mro)
  ()
  (fset 'hyperlatex-format-tabular-mro (symbol-function 'hyperlatex-format-tabular))
  (defun hyperlatex-format-tabular ()
	(hyperlatex-format-tabular-mro)
	(setq hyperlatex-tabular-nrows-count '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)))
)

(if (fboundp 'hyperlatex-format-tab-\\-mro)
  ()
  (fset 'hyperlatex-format-tab-\\-mro (symbol-function 'hyperlatex-format-tab-\\))
  (defun hyperlatex-format-tab-\\ ()
	(hyperlatex-format-tab-\\-mro)
	(setq hyperlatex-tabular-nrows-count
	  (mapcar
		'(lambda (x) (if (> x 1) (1- x) 1))
		hyperlatex-tabular-nrows-count)))
)
}