[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/latex-table-wizard ff8c832ad0 53/70: Version 1.1.0
From: |
ELPA Syncer |
Subject: |
[elpa] externals/latex-table-wizard ff8c832ad0 53/70: Version 1.1.0 |
Date: |
Sat, 13 May 2023 08:59:14 -0400 (EDT) |
branch: externals/latex-table-wizard
commit ff8c832ad0ab9b12d5113f1b6eb5d636d9e34f6c
Author: Enrico Flor <nericoflor@gmail.com>
Commit: Enrico Flor <nericoflor@gmail.com>
Version 1.1.0
- Four new commands added
- Got rid of most of the regexp based subroutines and use more of the
AucTeX functions
---
.elpaignore | 4 +-
NEWS | 14 +
latex-table-wizard.el | 347 ++++++++++----------
latex-table-wizard.info | 611 +++++++++++++++++++++++++++++++++++
readme.org => latex-table-wizard.org | 11 +-
latex-table-wizard.texi | 15 +
readme.org | 487 +---------------------------
7 files changed, 819 insertions(+), 670 deletions(-)
diff --git a/.elpaignore b/.elpaignore
index 32bbaaa999..c231e26512 100644
--- a/.elpaignore
+++ b/.elpaignore
@@ -1,2 +1,4 @@
readme.org
-COPYING
\ No newline at end of file
+COPYING
+latex-table-wizard.info
+latex-table-wizard.org
\ No newline at end of file
diff --git a/NEWS b/NEWS
index e69de29bb2..becde41d8d 100644
--- a/NEWS
+++ b/NEWS
@@ -0,0 +1,14 @@
+-*- mode: org -*-
+
+* 1.1.0 <2022-12-18 Sun>
+
+** Four interactive commands added
+
++ latex-table-wizard-align-left
++ latex-table-wizard-align-right
++ latex-table-wizard-center
++ latex-table-wizard-compress
+
+Each of these commands performs one of the transformations that
+latex-table-wizard-align cycles through. Unlike this command, these
+new ones are not exposed through the transient interface.
diff --git a/latex-table-wizard.el b/latex-table-wizard.el
index 6771206bd3..efa7268191 100644
--- a/latex-table-wizard.el
+++ b/latex-table-wizard.el
@@ -105,31 +105,6 @@
;;; Regular expressions and configuration options
-;; this rx expression matches what can separate different arguments of
-;; a (La)TeX macro: whitespace and comments
-(rx-define latex-table-wizard--blank-rx
- (seq (* space) (? (seq "%" (* not-newline))) "\n"
- (* (seq (* space) "%" (* not-newline) "\n"))
- (* space)))
-
-(defconst latex-table-wizard--macro-args-re
- (rx (seq (? latex-table-wizard--blank-rx)
- (* (seq "{" (*? anything) "}"
- latex-table-wizard--blank-rx))
- (* (seq "[" (*? anything) "]"
- latex-table-wizard--blank-rx))
- (* (seq "{" (*? anything) "}"
- latex-table-wizard--blank-rx))))
- "Regexp matching argument part of LaTeX macros.")
-
-(defconst latex-table-wizard--macro-re
- (concat "\\\\"
- (rx (group-n 1 (one-or-more alnum)))
- latex-table-wizard--macro-args-re)
- "Regexp matching unescaped LaTeX macros.
-
-Capture group 1 matches the name of the macro.")
-
(defcustom latex-table-wizard-column-delimiters '("&")
"List of strings that are column delimiters if unescaped."
:type '(repeat string))
@@ -223,36 +198,50 @@ If the current environment is one that is mapped to
something in
;; plists. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; this rx expression matches what can separate different arguments of
+;; a (La)TeX macro: whitespace and comments
+(rx-define latex-table-wizard--blank-rx
+ (seq (* space)
+ (? (seq "%" (* not-newline)))
+ (? "\n")
+ (* (seq (* space) "%" (* not-newline) "\n"))
+ (* space)))
+
;; The reason we cannot use TeX-find-macro-end is that, among other
;; things, that command is not comment sensitive: it will incorrectly
;; mark the end of a macro in the midle of a comment
-(defun latex-table-wizard--end-of-macro (&optional name)
+(defun latex-table-wizard--goto-end-of-macro (&optional name)
"If looking at unescaped macro named NAME, go to its end.
If NAME is nil, skip any LaTeX macro that point is looking at."
- (save-excursion
- (let* ((n (concat "\\(?1:" (or name (rx (one-or-more alnum))) "\\)"))
- (macro-re (concat "\\\\" n latex-table-wizard--macro-args-re)))
- ;; this trouble is to deal with problematic arguments to the
- ;; environment being macro like:
- ;; \begin{tabular}{@{} llllllll}
- (when (and (not (TeX-escaped-p))
- (looking-at macro-re))
- (goto-char (match-end 1)) ; goto end of name
- ;; now this is tricky: different arguments can be separated by
- ;; whitespace and one line break. We have to take this into
- ;; account but also not be fooled by comments! Actually
- ;; forward-sexp is smart enough already to skip comments, but
- ;; it skips too much: even two line breaks and of course it
- ;; skips stuff that is not a LaTeX argument group.
- (while (looking-at-p "{\\|\\[")
- (forward-sexp)
- (TeX-comment-forward 1)
- (skip-syntax-forward " "))
- ;; now we have moved too far ahead looking for arguments,
- ;; let's jump back all the whitespace
- (skip-syntax-backward " ")
- (point)))))
+ (let* ((n (concat "\\(?1:" (or name (rx (+ (not (any blank "\n")))))
+ "\\)"))
+ (macro-re (concat "\\\\" n
+ (rx (seq latex-table-wizard--blank-rx
+ (group-n 2 (? (or (literal "{")
+ (literal "[")))))))))
+ ;; (match-end 1) will the end of the name of the macro,
+ ;; (match-beginning 2) the opening brace of bracket of the first
+ ;; argument (if there is one).
+
+ ;; this trouble is to deal with problematic arguments to the
+ ;; environment being macro like: \begin{tabular}{@{} llllllll}
+ (when (and (not (TeX-escaped-p))
+ (looking-at macro-re))
+ (goto-char (match-beginning 2))
+ ;; now if indeed there is no "{" or "[" it means that there
+ ;; are no arguments and we are done, so we should just go back
+ ;; to the end of the name (we might be already there but maybe not!)
+ (if (not (looking-at-p "{\\|\\["))
+ (goto-char (match-end 1))
+ (let ((arg-end))
+ (while (looking-at-p "{\\|\\[")
+ (forward-sexp)
+ (setq arg-end (point))
+ (when (looking-at (rx latex-table-wizard--blank-rx))
+ (goto-char (match-end 0))))
+ ;; let's go back in case we skipped whitespace
+ (goto-char arg-end))))))
(defun latex-table-wizard--skip-stuff (limit)
"Skip comments, blank space and hline macros.
@@ -277,9 +266,8 @@ Stop the skipping at LIMIT (a buffer position or a marker)."
"\\|")))
(throw 'stop nil)))
(ignore-errors
- (goto-char (latex-table-wizard--end-of-macro
- (regexp-opt
- latex-table-wizard--current-hline-macros))))
+ (latex-table-wizard--goto-end-of-macro
+ (regexp-opt latex-table-wizard--current-hline-macros)))
(when (looking-at "\n\\|%")
(forward-line)
(setq new-start-of-line (point)))
@@ -313,24 +301,17 @@ argument."
(end)
(end-of-row))
(while (and (< (point) lim) (not end))
- (TeX-comment-forward 1)
- (cond ((looking-at-p "[[:space:]]+")
- (skip-syntax-forward " "))
- ((and (not (TeX-escaped-p))
- (looking-at-p "\\\\begin\\({\\|\\[\\)"))
- (forward-char 1)
- (LaTeX-find-matching-end))
- ((and (not (TeX-escaped-p))
- (looking-at latex-table-wizard--macro-re))
- (goto-char (latex-table-wizard--end-of-macro
- (match-string-no-properties 1))))
- ((and (looking-at col-re)
- (not (TeX-escaped-p)))
+ (cond ((looking-at-p "[[:space:]]+%?")
+ (TeX-comment-forward 1))
+ ((TeX-escaped-p)
+ ;; whatever we are looking at is escaped so we just go
+ ;; one step forward
+ (forward-char 1))
+ ((looking-at col-re)
;; a column delimiter: bingo
(setq end (point-marker))
(goto-char (match-end 0)))
- ((and (looking-at row-re)
- (not (TeX-escaped-p)))
+ ((looking-at row-re)
;; a row delimiter: bingo
(let ((after-del (save-excursion
(goto-char (match-end 0))
@@ -342,8 +323,20 @@ argument."
(setq end end-of-previous-cell
end-of-row t)
(latex-table-wizard--skip-stuff lim)))
+ ((looking-at-p (rx (seq "\\begin"
+ latex-table-wizard--blank-rx
+ (or (literal "{") (literal "[")))))
+ (forward-char 1)
+ (LaTeX-find-matching-end))
+ ((looking-at (rx (seq (literal "\\")
+ (group-n 1 (+ (not (any blank
+ "\n"))))
+ latex-table-wizard--blank-rx
+ (or (literal "{") (literal "[")))))
+ (latex-table-wizard--goto-end-of-macro
+ (match-string-no-properties 1)))
(t
- ;; nothing special, just go one step forward
+ ;; the above should have
(forward-char 1))))
`(,beg ,end ,end-of-row)))
@@ -378,59 +371,69 @@ form
(:column C :row R :start S :end E).
-Each value is an integer, S and E are markers."
- (latex-table-wizard--set-current-values)
+Each value is an integer, S and E are markers.
+
+If point is inside the table but between two cells, relocate it
+to the one that precedes point."
(let* ((cells-list '())
(col 0)
(row 0)
- (env-name (LaTeX-current-environment))
(env-beg (save-excursion
(LaTeX-find-matching-begin)
- (goto-char (latex-table-wizard--end-of-macro))
+ (latex-table-wizard--goto-end-of-macro)
(point-marker)))
(env-end (save-excursion
(LaTeX-find-matching-end)
- (re-search-backward (concat "\\\\end{" env-name) nil t)
+ (TeX-search-unescaped
+ (rx (seq "\\end"
+ latex-table-wizard--blank-rx
+ (literal "{")))
+ 'backward t env-beg t)
(forward-char -1)
(point-marker)))
(hash (secure-hash 'sha256
- (buffer-substring-no-properties env-beg env-end)))
- (col-re (string-join latex-table-wizard--current-col-delims "\\|"))
- (row-re (string-join latex-table-wizard--current-row-delims "\\|")))
- (if (and (equal `(,env-beg . ,env-end) (nth 0 latex-table-wizard--parse))
- (equal hash (nth 1 latex-table-wizard--parse)))
- (nth 2 latex-table-wizard--parse)
- (save-excursion
- (goto-char env-beg)
- ;; we need to make some space between the end of of the \begin
- ;; macro and the start of the (0,0) cell
- (if (looking-at-p "[[:space:]]")
- (forward-char 1)
- (insert " "))
- (while (< (point) env-end)
+ (buffer-substring-no-properties env-beg env-end))))
+ (save-excursion (goto-char env-beg)
+ (latex-table-wizard--set-current-values))
+ (let ((col-re (string-join latex-table-wizard--current-col-delims "\\|"))
+ (row-re (string-join latex-table-wizard--current-row-delims "\\|")))
+ (if (and (equal `(,env-beg . ,env-end) (nth 0 latex-table-wizard--parse))
+ (equal hash (nth 1 latex-table-wizard--parse)))
+ (nth 2 latex-table-wizard--parse)
+ (save-excursion
+ (goto-char env-beg)
+ ;; we need to make some space between the end of of the \begin
+ ;; macro and the start of the (0,0) cell
+ (if (looking-at-p "[[:space:]]")
+ (forward-char 1)
+ (insert " "))
(TeX-comment-forward 1)
- (let ((data (latex-table-wizard--get-cell-boundaries
- col-re row-re env-end)))
- (push `( :column ,col
- :row ,row
- :start ,(nth 0 data)
- :end ,(if (nth 1 data) (nth 1 data) env-end))
- cells-list)
- (if (nth 2 data) ; this was the last cell in the row
- (setq row (1+ row)
- col 0)
- (setq col (1+ col)))
- ;; if we just hit the end of a row and the next thing coming
- ;; is another row delimiter, skip that one (because you are
- ;; not in a cell)
- (while (and (nth 2 data)
- (save-excursion
- (skip-syntax-forward " ")
- (looking-at-p row-re)))
- (re-search-forward row-re nil t)))))
- (setq latex-table-wizard--parse
- `((,env-beg . ,env-end) ,hash ,cells-list))
- cells-list)))
+ (while (looking-at-p "[[:space:]]*%")
+ (TeX-comment-forward 1))
+ (skip-syntax-backward " ")
+ (while (< (point) env-end)
+ (let ((data (latex-table-wizard--get-cell-boundaries
+ col-re row-re env-end)))
+ (push `( :column ,col
+ :row ,row
+ :start ,(nth 0 data)
+ :end ,(if (nth 1 data) (nth 1 data) env-end))
+ cells-list)
+ (if (nth 2 data) ; this was the last cell in the row
+ (setq row (1+ row)
+ col 0)
+ (setq col (1+ col)))
+ ;; if we just hit the end of a row and the next thing coming
+ ;; is another row delimiter, skip that one (because you are
+ ;; not in a cell)
+ (while (and (nth 2 data)
+ (save-excursion
+ (skip-syntax-forward " ")
+ (looking-at-p row-re)))
+ (re-search-forward row-re nil t)))))
+ (setq latex-table-wizard--parse
+ `((,env-beg . ,env-end) ,hash ,cells-list))
+ cells-list))))
(defun latex-table-wizard--get-cell-pos (table prop-val1
&optional prop-val2)
@@ -495,39 +498,6 @@ F, C precedes D and so on; and if DIR is either
\\='next\\=' or
(sort thing (lambda (x y) (< (plist-get x prop)
(plist-get y prop)))))))
-(defun latex-table-wizard--point-on-regexp-p (regexp
- &optional capture-group
- search-beginning-pos)
- "Return non-nil if point is on a substring matched by REGEXP.
-
-If CAPTURE-GROUP is non-nil, limit the condition to the substring
-matched by the corresponding capture group. If CAPTURE-GROUP is
-nil, it defaults to 0.
-
-What is returned is a list of the form
-
- (S B E)
-
-where S is the substring matched, and B and E are the buffer
-position corresponding to the beginning and the end of such
-substring.
-
-Start the search from SEARCH-BEGINNING-POS (a buffer position or
-marker): if this argument is nil, start the search from the
-beginning of the available portion of the buffer."
- (let ((position (point))
- (group (or capture-group 0))
- (search-b (or search-beginning-pos (point-min))))
- (save-match-data
- (save-excursion
- (goto-char search-b)
- (catch 'found
- (while (re-search-forward regexp nil t)
- (when (<= (match-beginning group) position (match-end group))
- (throw 'found (list (match-string-no-properties group)
- (match-beginning group)
- (match-end group))))))))))
-
;;; Moving around
@@ -622,7 +592,8 @@ The overlay has a non-nil value for the name property
POS is a buffer position or a marker.
If POS is not in a cell in TABLE, it means it's between two
-cells: return the closest one."
+cells: return the closest one after having moved point to its
+beginning.."
(let ((candidate (car (seq-filter
(lambda (x) (<= (plist-get x :start)
pos
@@ -632,16 +603,24 @@ cells: return the closest one."
(cond (candidate
candidate)
((< pos (car ends))
- (latex-table-wizard--get-cell-pos table '(:column . 0) '(:row . 0)))
+ (latex-table-wizard--get-cell-pos table
+ '(:column . 0) '(:row . 0)))
((> pos (cdr ends))
(car (seq-filter
(lambda (x) (= (plist-get x :end) (cdr ends)))
table)))
- (t (goto-char (apply #'max
- (mapcar (lambda (x) (plist-get x :start))
- (seq-filter
- (lambda (x) (< (plist-get x :end) pos))
- table))))))))
+ (t
+ (let* ((end-pos
+ (thread-last
+ table
+ (seq-filter (lambda (x) (< (plist-get x :end) pos)))
+ (mapcar (lambda (x) (plist-get x :end)))
+ (apply #'max)))
+ (final (seq-find (lambda (x) (= end-pos
+ (plist-get x :end)))
+ table)))
+ (goto-char (plist-get final :start))
+ final)))))
(defun latex-table-wizard--get-thing (thing &optional table)
"Return THING point is in.
@@ -683,14 +662,6 @@ direction DIR to take.
If SAME-LINE is non-nil, never leave current column or row."
(unless (ignore-errors (save-excursion (LaTeX-find-matching-begin)))
(user-error "Not in a LaTeX environment"))
- (when-let ((macro-at-point
- (latex-table-wizard--point-on-regexp-p
- latex-table-wizard--macro-re
- 0 (line-beginning-position))))
- (cond ((string-prefix-p "\\begin" (nth 0 macro-at-point))
- (goto-char (nth 1 macro-at-point)))
- ((string-prefix-p "\\end" (nth 0 macro-at-point))
- (goto-char (nth 2 macro-at-point)))))
(let* ((message-log-max 0)
(cells (latex-table-wizard--parse-table))
(curr (latex-table-wizard--get-thing 'cell cells))
@@ -763,17 +734,19 @@ TYPE is either \\='column\\=' or \\='row\\='."
line2 `(,prop . ,(plist-get x prop)))))
(latex-table-wizard--swap-cells x other))))))
-(defun latex-table-wizard--swap-adjacent-line (dir &optional type)
+(defun latex-table-wizard--swap-adjacent-line (dir type)
"Swap current thing of type TYPE with the one in direction DIR.
DIR is either \\='forward\\=', \\='backward\\=', \\='next\\=' or
\\='previous\\='.
TYPE is either \\='cell\\=', \\='column\\=' or \\='row\\='."
(latex-table-wizard--remove-overlays)
- (cond ((eq type 'cell) (latex-table-wizard-select-deselect-cell t))
+ (cond ((eq type 'cell) (latex-table-wizard-select-deselect-cell t t))
((memq dir '(forward backward))
(latex-table-wizard-select-column t))
((memq dir '(previous next))
(latex-table-wizard-select-row t)))
+ (setq latex-table-wizard--selection
+ (seq-uniq latex-table-wizard--selection))
(latex-table-wizard--jump dir nil 1 t)
(latex-table-wizard-swap)
(let ((new-table (latex-table-wizard--parse-table)))
@@ -1148,14 +1121,16 @@ If NO-MESSAGE is non-nil, do not print anything in the
echo area."
(setq latex-table-wizard--selection
(remove curr-cell latex-table-wizard--selection))))
-(defun latex-table-wizard-select-deselect-cell (&optional no-message)
+(defun latex-table-wizard-select-deselect-cell (&optional no-message select)
"Add or remove cell at point to selection for swapping.
-If NO-MESSAGE is non-nil, do not print anything in the echo area."
+If NO-MESSAGE is non-nil, do not print anything in the echo area.
+
+If SELECT is non-nil, add the cell."
(interactive)
(let* ((table (latex-table-wizard--parse-table))
(curr (latex-table-wizard--get-thing 'cell table)))
- (if (member curr latex-table-wizard--selection)
+ (if (and (member curr latex-table-wizard--selection) (not select))
(latex-table-wizard--deselect-cell)
(latex-table-wizard--select-thing 'cell no-message)))
(latex-table-wizard--echo-selection))
@@ -1286,7 +1261,8 @@ how the data stored in this variable and in
of the transient prefix)."
:type '(alist :key-type
(symbol :tag "Command:"
- :options ,(mapcar #'car
latex-table-wizard-default-keys))
+ :options ,(mapcar #'car
+ latex-table-wizard-default-keys))
:value-type string)
:group 'latex-table-wizard)
@@ -1416,20 +1392,18 @@ Only remove them in current buffer."
(remove-overlays (point-min) (point-max) 'tabl-outside-ol t)))
(defun latex-table-wizard--get-out ()
- "If point is on column or row delimiter, move to its beginning."
+ "If point is on an environment delimiting macro, move out.
+
+If it is on an \\='end\\=' macro, move to its end, otherwise to
+its beginning."
(latex-table-wizard--set-current-values)
- (when-let ((macro (latex-table-wizard--point-on-regexp-p
- (string-join
- `(,(regexp-opt
- (append latex-table-wizard--current-row-delims
- latex-table-wizard--current-col-delims))
- ,latex-table-wizard--macro-re)
- "\\|")
- 0 (line-beginning-position))))
- (thread-last macro
- (nth 1)
- (1-)
- (goto-char))))
+ (when-let ((name (TeX-current-macro)))
+ (when (or (string-equal name "begin")
+ (string-equal name "end"))
+ (let ((boundaries (TeX-find-macro-boundaries)))
+ (if (string-equal name "end")
+ (goto-char (cdr boundaries))
+ (goto-char (car boundaries)))))))
(define-minor-mode latex-table-wizard-mode
"Minor mode for editing LaTeX table-like environments."
@@ -1452,12 +1426,21 @@ Only remove them in current buffer."
"Edit table-like environment with a transient interface."
(interactive)
(when (region-active-p) (deactivate-mark))
- (if latex-table-wizard-mode
- (latex-table-wizard--make-prefix)
- (latex-table-wizard-mode 1))
- (latex-table-wizard--get-out)
- (latex-table-wizard--hide-rest)
- (call-interactively #'latex-table-wizard-prefix))
+ (let ((orig-point (point)))
+ (if latex-table-wizard-mode
+ (latex-table-wizard--make-prefix)
+ (latex-table-wizard-mode 1))
+ (latex-table-wizard--get-out)
+ (latex-table-wizard--hide-rest)
+ (let ((cell (latex-table-wizard--locate-point
+ orig-point
+ (latex-table-wizard--parse-table))))
+ (unless (<= (plist-get cell :start)
+ orig-point
+ (plist-get cell :end))
+ (goto-char (plist-get cell :start)))
+ (latex-table-wizard--hl-cells (list cell)))
+ (call-interactively #'latex-table-wizard-prefix)))
;;;###autoload
(defun latex-table-wizard-customize ()
diff --git a/latex-table-wizard.info b/latex-table-wizard.info
new file mode 100644
index 0000000000..8b1ddfb60a
--- /dev/null
+++ b/latex-table-wizard.info
@@ -0,0 +1,611 @@
+This is latex-table-wizard.info, produced by makeinfo version 6.8 from
+latex-table-wizard.texi.
+
+INFO-DIR-SECTION Emacs misc features
+START-INFO-DIR-ENTRY
+* LaTeX-table-wizard: (latex-table-wizard). Magic editing of LaTeX tables.
+END-INFO-DIR-ENTRY
+
+
+File: latex-table-wizard.info, Node: Top, Next: Introduction, Up: (dir)
+
+LaTeX table wizard - Magic editing of LaTeX tables
+**************************************************
+
+ Copyright (C) 2022 Enrico Flor.
+
+ Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and
+with the Back-Cover Texts as in (a) below. A copy of the license is
+included in the section entitled “GNU Free Documentation License.”
+
+ (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and
+modify this GNU manual.”
+
+* Menu:
+
+* Introduction::
+* Available commands::
+* Known issues::
+* Customization::
+
+— The Detailed Node Listing —
+
+Available commands
+
+* Start editing::
+* Relative motion commands::
+* Absolute motion commands::
+* Mark, kill and insert commands: Mark kill and insert commands.
+* Swap adjacent fields::
+* Swap arbitrary fields::
+* Format the table::
+* Extra commands in the transient prefix::
+
+Known issues
+
+* Empty cells in single-column tables::
+
+Customization
+
+* Customize transient prefix::
+* Define rules for new environments::
+* Customizing faces::
+
+
+
+File: latex-table-wizard.info, Node: Introduction, Next: Available commands,
Prev: Top, Up: Top
+
+1 Introduction
+**************
+
+One of org-mode’s magic features is its table editing capabilities. The
+goal of this package is to replicate that magic for LaTeX table(-like)
+environments.
+
+ The way this is done is through a series of interactive commands that
+are exposed as *transient suffixes* through the transient interface
+invoked by the command ‘latex-table-wizard’. What this means is that by
+calling ‘latex-table-wizard’ when point is in a table-like environment,
+you will be presented with a choice of keys that are bound to all the
+commands provided by this package.
+
+ All these commands can of course be called through
+‘execute-extended-command’, and you can bind any key you want to them.
+See *note Customize transient prefix:: for how to change the default
+bindings offered by the transient prefix.
+
+ An important feature of LaTeX-table-wizard is that it *tries to be
+smart*: for instance, it should not be fooled if the current table-like
+environments contains *embedded tables* (that is, other tabular
+environments inside of its cells). The table is parsed so that these
+big cells are treated like any other cell.
+
+ For example, if you call ‘latex-table-wizard’ when point is outside
+of the embedded ‘tabular’ environment, LaTeX-table-wizard will behave as
+if it was in any other 3x3 table, and the embedded table will be treated
+just as any other cell content.
+
+ \begin{tabular}{lll}
+ \begin{tabular}{ll}
+ a & b \\
+ c & d
+ \end{tabular}
+ & █B2 & C2 \\\hline
+ A1 & B1 & C1 \\
+ A0 & B0 \makecell{longer & nested cell} & C0
+ \end{tabular}
+
+ Of course you can call ‘latex-table-wizard’ with point inside of the
+embedded table, in which case any command you use will operate only on
+the embedded table.
+
+ For most of this document we will assume the table-like environment
+has the standard LaTeX2e syntax, but you can define your own types of
+table-like environments (more on this *note below: Define rules for new
+environments.).
+
+
+File: latex-table-wizard.info, Node: Available commands, Next: Known issues,
Prev: Introduction, Up: Top
+
+2 Available commands
+********************
+
+For now, we will assume a standard LaTeX syntax for tabular
+environments, where ‘&’ delimits columns and ‘\\’ rows (see *note below:
+Define rules for new environments. for info as to how to specify
+additional environments).
+
+ Whenever we say “current” we mean “at point”.
+
+* Menu:
+
+* Start editing::
+* Relative motion commands::
+* Absolute motion commands::
+* Mark, kill and insert commands: Mark kill and insert commands.
+* Swap adjacent fields::
+* Swap arbitrary fields::
+* Format the table::
+* Extra commands in the transient prefix::
+
+
+File: latex-table-wizard.info, Node: Start editing, Next: Relative motion
commands, Up: Available commands
+
+2.1 Start editing
+=================
+
+Just call ‘latex-table-wizard’ when point is inside of table-like
+environment.
+
+ This commands actually activates the non-global minor mode
+‘latex-table-wizard-mode’. If you intend to use this package’s commands
+without the transient interface brought up by ‘latex-table-wizard’,
+activate this minor mode to have the interactive functions loaded.
+
+
+File: latex-table-wizard.info, Node: Relative motion commands, Next:
Absolute motion commands, Prev: Start editing, Up: Available commands
+
+2.2 Relative motion commands
+============================
+
+These commands move point N cells to the right, left, down, and up. N
+is passed as a prefix argument, and if it’s not passed, it defaults to
+1.
+
+Command Default key
+-------------------------------------------
+‘latex-table-wizard-right’ ‘f’
+‘latex-table-wizard-left’ ‘b’
+‘latex-table-wizard-down’ ‘n’
+‘latex-table-wizard-up’ ‘p’
+
+ With just one of these you can get anywhere you want in the table:
+
+ \begin{tabular}{lll}
+ A0 & B0 & C0 \\\hline
+ A1 & B1 & C1 \\
+ A2 & B2 & C2
+ \end{tabular}
+
+ This is because these commands try to Do What You Mean if there is no
+suitable cell to move to:
+
+ • Point on ‘C0’, ‘latex-table-wizard-right’ ⇒ point on ‘A1’
+ • Point on ‘A0’, ‘latex-table-wizard-left’ ⇒ point on ‘C2’
+ • Point on ‘C2’, ‘latex-table-wizard-down’ ⇒ point on ‘A0’
+ • Point on ‘B0’, ‘latex-table-wizard-up’ ⇒ point on ‘A2’
+
+ and so on.
+
+ These four commands accept a positive integer passed as a prefix
+argument that determines how many steps (i.e. how many cells) the
+movement will consist of. By default, you can pass this argument from
+the transient interface of ‘latex-table-wizard’ with the key ‘u’ (bound
+to ‘universal-argument’).
+
+
+File: latex-table-wizard.info, Node: Absolute motion commands, Next: Mark
kill and insert commands, Prev: Relative motion commands, Up: Available
commands
+
+2.3 Absolute motion commands
+============================
+
+Command Default key Move to...
+---------------------------------------------------------------------------------------
+‘latex-table-wizard-beginning-of-cell’ ‘a’ end of current cell
+‘latex-table-wizard-end-of-cell’ ‘e’ beginning of current
cell
+‘latex-table-wizard-beginning-of-row’ ‘B’ leftmost cell in
current row
+‘latex-table-wizard-end-of-row’ ‘F’ rightmost cell in
current row
+‘latex-table-wizard-bottom’ ‘N’ bottom cell in current
column
+‘latex-table-wizard-top’ ‘P’ top cell in current
column
+
+
+File: latex-table-wizard.info, Node: Mark kill and insert commands, Next:
Swap adjacent fields, Prev: Absolute motion commands, Up: Available commands
+
+2.4 Mark, kill and insert commands
+==================================
+
+Command Default key
+------------------------------------------------------------------------------------------------
+‘latex-table-wizard-mark-cell’ ‘m c’ mark current cell
+‘latex-table-wizard-insert-column’ ‘i c’ insert empty column to the
right
+‘latex-table-wizard-insert-row’ ‘i r’ insert row below
+‘latex-table-wizard-kill-column’ ‘k c’ add content of current
column to kill ring
+‘latex-table-wizard-kill-row’ ‘k r’ add content of current row
to kill ring
+‘exchange-point-and-mark’ ‘x’
+
+
+File: latex-table-wizard.info, Node: Swap adjacent fields, Next: Swap
arbitrary fields, Prev: Mark kill and insert commands, Up: Available commands
+
+2.5 Swap adjacent fields
+========================
+
+Command Default key Swap current...
+------------------------------------------------------------------------------------------
+‘latex-table-wizard-swap-cell-right’ ‘C-f’ cell with the one to
the right
+‘latex-table-wizard-swap-cell-left’ ‘C-b’ cell with the one to
the left
+‘latex-table-wizard-swap-cell-down’ ‘C-n’ cell with the one below
+‘latex-table-wizard-swap-cell-up’ ‘C-p’ cell with the one above
+‘latex-table-wizard-swap-column-right’ ‘M-f’ column with the one to
the right
+‘latex-table-wizard-swap-column-left’ ‘M-b’ column with the one to
the left
+‘latex-table-wizard-swap-row-down’ ‘M-n’ row with the one below
+‘latex-table-wizard-swap-row-up’ ‘M-p’ row with the one above
+
+ For these commands, think of the cells and columns as circular: if
+there is no item in the direction given, the target is the one on the
+opposite end of the current cell. So for example:
+
+ \begin{tabular}{lll}
+ A0 & B0 & C0 \\\hline
+ A1 & B1 & C1 \\
+ A2 & B2 & C2
+ \end{tabular}
+
+ This is because these commands try to Do What You Mean if there is no
+suitable cell to move to:
+
+ Point on ‘C0’, ‘latex-table-wizard-swap-cell-right’ ⇒
+ \begin{tabular}{lll}
+ C0 & B0 & A0 \\\hline
+ A1 & B1 & C1 \\
+ A2 & B2 & C2
+ \end{tabular}
+
+ Point on ‘B0’, ‘latex-table-wizard-swap-row-up’ ⇒
+ \begin{tabular}{lll}
+ A2 & B2 & C2 \\\hline
+ A1 & B1 & C1 \\
+ A0 & B0 & C0
+ \end{tabular}
+
+ Point on ‘A1’, ‘latex-table-wizard-swap-column-right’ ⇒
+ \begin{tabular}{lll}
+ B0 & A0 & C0 \\\hline
+ B1 & A1 & C1 \\
+ B2 & A2 & C2
+ \end{tabular}
+
+
+File: latex-table-wizard.info, Node: Swap arbitrary fields, Next: Format the
table, Prev: Swap adjacent fields, Up: Available commands
+
+2.6 Swap arbitrary fields
+=========================
+
+To swap arbitrary fields one must first *select* something and then move
+point somewhere else and perform the swap. Importantly, *selecting does
+not mean marking*: the mark is not even moved when selecting (however,
+by default the selected cell will receive the same kind of highlighting
+the loaded theme defines for the active region, but this is a purely
+graphical equivalence). “Selecting”, for the purposes of
+LaTeX-table-wizard only means storing a cell, a line or a row to be
+swapped with another.
+
+ The simplest case is one in which the current cell, column or row are
+selected:
+
+Command Default key Select current...
+---------------------------------------------------------------------------------
+‘latex-table-wizard-select-deselect-cell’ ‘SPC’ select/deselect cell
+‘latex-table-wizard-select-column’ ‘c’ select column
+‘latex-table-wizard-select-row’ ‘r’ deselect row
+‘latex-table-wizard-deselect-all’ ‘d’ deselect all
+
+ The first command, ‘latex-table-wizard-select-deselect-cell’ toggles
+the status of the current cell as being selected or not.
+
+ Once things are selected, you move point somewhere else in the table
+(with the above mentioned motion commands), and then:
+
+‘latex-table-wizard-swap’ ‘s’ swap selection and current thing
+
+ What is swapped depends on what is selected: if the selection was
+only a cell, then that cell and the current one are swapped. If it was
+(a potentially discontinuous segment of) a column or a row, then that
+selection is swapped with the current column or row or the corresponding
+portion thereof. If you selected multiple cell that are not part of the
+same column or row, the swap won’t happen (LaTeX-table-wizard doesn’t
+know what you want it to do in that case).
+
+
+File: latex-table-wizard.info, Node: Format the table, Next: Extra commands
in the transient prefix, Prev: Swap arbitrary fields, Up: Available commands
+
+2.7 Format the table
+====================
+
+The only command to format the table is ‘latex-table-wizard-align’. The
+behavior of this command is cyclic, in the sense that calling it
+repeatedly causes the table to cycle through four types of formatting:
+left aligned, centered, right aligned and compressed. The latter state
+is actually not one of alignment (that is, the column separators are not
+vertically aligned): it just means that all the extra space at the
+beginning and end of each cell is collapsed into one.
+
+Command Default key
+-------------------------------------------
+‘latex-table-wizard-align’ ‘TAB’
+
+ The following five tables illustrate the effect of calling
+‘latex-table-wizard-align’ repeatedly.
+
+ This is the original cell:
+
+ \begin{tabular}{lll}
+ A2 longer cell & B2 & C2 \\\hline
+ A1 & B1 & C1 \\ A0 & B0 \makecell{longer & nested cell} & C0
+ \end{tabular}
+
+ left aligned:
+
+ \begin{tabular}{lll}
+ A2 longer cell & B2 & C2 \\\hline
+ A1 & B1 & C1 \\
+ A0 & B0 \makecell{longer & nested cell} & C0
+ \end{tabular}
+
+ centered:
+
+ \begin{tabular}{lll}
+ A2 longer cell & B2 & C2 \\\hline
+ A1 & B1 & C1 \\
+ A0 & B0 \makecell{longer & nested cell} & C0
+ \end{tabular}
+
+ right aligned:
+
+ \begin{tabular}{lll}
+ A2 longer cell & B2 & C2 \\\hline
+ A1 & B1 & C1 \\
+ A0 & B0 \makecell{longer & nested cell} & C0
+ \end{tabular}
+
+ compressed:
+
+ \begin{tabular}{lll}
+ A2 longer cell & B2 & C2 \\\hline
+ A1 & B1 & C1 \\
+ A0 & B0 \makecell{longer & nested cell} & C0
+ \end{tabular}
+
+ As you can see, ‘latex-table-wizard-align’ also forces every row of
+the table to start on its own line.
+
+ As always, this alignment command tries to be smart and not be fooled
+by column or row delimiters embedded in a cell.
+
+ Beside ‘latex-table-wizard-align’ with its cycling behavior, four
+commands are defined (but not exposed by the transient interface), each
+of which just performs one of these transformations. These are:
+
+ • ‘latex-table-wizard-align-left’
+ • ‘latex-table-wizard-align-right’
+ • ‘latex-table-wizard-center’
+ • ‘latex-table-wizard-compress’
+
+
+File: latex-table-wizard.info, Node: Extra commands in the transient prefix,
Prev: Format the table, Up: Available commands
+
+2.8 Extra commands in the transient prefix
+==========================================
+
+The transient interfaces invoked by ‘latex-table-wizard’ also exposes
+some other commands that are not defined by this package but are useful
+for its usage. These are:
+
+Command Default key
+------------------------------------------
+‘toggle-truncate-lines’ ‘t’
+‘undo’ ‘/’
+‘exchange-point-and-mark’ ‘x’
+‘universal-argument’ ‘u’
+‘transient-quit-one’ ‘RET’
+
+
+File: latex-table-wizard.info, Node: Known issues, Next: Customization,
Prev: Available commands, Up: Top
+
+3 Known issues
+**************
+
+* Menu:
+
+* Empty cells in single-column tables::
+
+
+File: latex-table-wizard.info, Node: Empty cells in single-column tables,
Up: Known issues
+
+3.1 Empty cells in single-column tables
+=======================================
+
+This package handles empty cells (that is, cells without any text in
+them except perhaps comments) well. The only exception is in tables
+with a single column. The problem is that a buffer substring like ‘\\
+\\’ is not parsed as a cell. This is normally not a problem, but if the
+table has only one column then that substring could be meant to be an
+empty or blank cell.
+
+ A way to avoid this problem may be defining a LaTeX macro that does
+nothing, and use it in the cell you intend to be empty so that the
+parser sees some text.
+
+ So instead of ‘\\ \\’ we will have ‘\\ \blk{} \\’.
+
+
+File: latex-table-wizard.info, Node: Customization, Prev: Known issues, Up:
Top
+
+4 Customization
+***************
+
+To quickly access all customizations pertinent to LaTeX-table-wizard
+through the Customize interface, call ‘latex-table-wizard-customize’.
+
+* Menu:
+
+* Customize transient prefix::
+* Define rules for new environments::
+* Customizing faces::
+
+
+File: latex-table-wizard.info, Node: Customize transient prefix, Next:
Define rules for new environments, Up: Customization
+
+4.1 Customize transient prefix
+==============================
+
+To change the default key bindings, you need to provide change the value
+of the alist ‘latex-table-wizard-transient-keys’. The easiest and most
+convenient way to do it is through ‘latex-table-wizard-customize’.
+
+ Each cons cell in this alist maps a command to a key description
+string (the kind of strings that the macro ‘kbd’ takes as arguments).
+
+ For example, these three cons cells are members of the default value
+of ‘latex-table-wizard-transient-keys’:
+
+ (undo . "//")
+ (latex-table-wizard-swap-cell-right . "C-f")
+ (latex-table-wizard-insert-row . "i r")
+
+
+File: latex-table-wizard.info, Node: Define rules for new environments,
Next: Customizing faces, Prev: Customize transient prefix, Up: Customization
+
+4.2 Define rules for new environments
+=====================================
+
+Remember the default values used for parsing table environments:
+
+ (defcustom latex-table-wizard-column-delimiters '("&")
+ "List of strings that are column delimiters if unescaped."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+ (defcustom latex-table-wizard-row-delimiters '("\\\\\\\\")
+ "List of strings that are row delimiters if unescaped."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+ (defcustom latex-table-wizard-hline-macros '("cline"
+ "vline"
+ "midrule"
+ "hline"
+ "toprule"
+ "bottomrule")
+ "Name of macros that draw horizontal lines.
+
+ Each member of this list is a string that would be between the
+ \"\\\" and the arguments."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+ LaTeX-table-wizard will always presume the table you want operate on
+has a syntax specified like this. But suppose you use different
+environments with non-standard syntax: suppose you define a table-like
+environment of your choice, let’s call it ‘mytable’, that uses ‘!ROW’
+and ‘!COL’ instead of ‘&’ and ‘\\’ as delimiters, and a macro
+‘\horizontal’ for horizontal lines. When you are in a ‘mytable’
+environments, you want LaTeX-table-wizard to adapt to this new syntax.
+
+ All you need to do add an appropriate cons cell to the
+‘latex-table-wizard-new-environments-alist’ association list, mapping
+the name of the environment, as a string, to a property list specifying
+the values. Here is this variable’s ‘defcustom’ expression:
+
+ (defcustom latex-table-wizard-new-environments-alist nil
+ "Alist mapping environment names to property lists.
+
+ The environment name is a string, for example \"foo\" for an
+ environment like
+
+ \\begin{foo}
+ ...
+ \\end{foo}
+
+ The cdr of each mapping is a property list with three keys:
+
+ :col
+ :row
+ :lines
+
+ The values for :col and :row are two lists of strings.
+
+ The value for :lines is a list of strings just like is the case
+ for `latex-table-wizard-hline-macros', each of which is the name
+ of a macro that inserts some horizontal line. For a macro
+ \"\\foo{}\", use string \"foo\"."
+ :type '(alist :key-type (string :tag "Name of the environment:")
+ :value-type (plist :key-type symbol
+ :options (:col :row :lines)
+ :value-type (repeat string)))
+
+ :group 'latex-table-wizard)
+
+ You can add the new syntax for the ‘mytable’ environment through the
+Customize interface, which will present you with the correct values to
+set, or you can just add a cons cell of your writing to the alist:
+
+ (add-to-list 'latex-table-wizard-new-environments-alist
+ '("mytable" . (:col ("!COL") :row ("!ROW") :lines
("horizontal"))))
+
+ Each of the values in the plist is a list of strings: this way you
+can define environments that can use more than one type of column
+separator. Importantly, the strings in the ‘:lines’ list are *names of
+LaTeX* macros, which means that they should not start with the backslash
+and you should not add any argument to them. In the example above a
+buffer substring like ‘\horizontal{1}’ will be interpreted as a hline
+macro if in a ‘mytable’ environment.
+
+
+File: latex-table-wizard.info, Node: Customizing faces, Prev: Define rules
for new environments, Up: Customization
+
+4.3 Customizing faces
+=====================
+
+Calling ‘latex-table-wizard’ by default causes the portions of the
+buffer before and after the table at point to be “grayed out”, so that
+you can clearly focus on the table. If you don’t want this to happen,
+set the value of the variable ‘latex-table-wizard-no-focus’ to ‘t’.
+
+ If instead you want effect to be different than the default (which is
+applying a foreground of color ‘gray40’), change the value of the face
+‘latex-table-wizard-background’.
+
+ By default, when you move around the table and select objects from it
+the relevant portions of the table are highlighted. If you don’t want
+this to happen, set the value of the variable
+‘latex-table-wizard-no-highlight’ to ‘t’.
+
+ If instead you want the highlighting to be done differently than the
+default (which is applying a background of the same color as the loaded
+theme defines for the active region), change the value of the face
+‘latex-table-wizard-highlight’.
+
+ The easiest and most convenient way to set these variables,
+especially the two faces, is through the Customize interface, which you
+can access quickly by calling ‘latex-table-wizard-customize’.
+
+
+
+Tag Table:
+Node: Top97
+Node: Introduction1510
+Node: Available commands3651
+Node: Start editing4363
+Node: Relative motion commands4878
+Node: Absolute motion commands6414
+Node: Mark kill and insert commands7330
+Node: Swap adjacent fields8201
+Node: Swap arbitrary fields10257
+Node: Format the table12343
+Node: Extra commands in the transient prefix15033
+Node: Known issues15710
+Node: Empty cells in single-column tables15904
+Node: Customization16684
+Node: Customize transient prefix17048
+Node: Define rules for new environments17837
+Node: Customizing faces21689
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
diff --git a/readme.org b/latex-table-wizard.org
similarity index 98%
copy from readme.org
copy to latex-table-wizard.org
index 848f39714f..0c0c2ac8b7 100644
--- a/readme.org
+++ b/latex-table-wizard.org
@@ -5,7 +5,7 @@
#+OPTIONS: ':t toc:t author:t email:t
#+MACRO: version 1.0.0
-#+MACRO: updated last updated 14 December 2022
+#+MACRO: updated last updated 18 December 2022
[[https://melpa.org/#/latex-table-wizard][file:https://melpa.org/packages/latex-table-wizard-badge.svg]]
@@ -308,6 +308,15 @@ table to start on its own line.
As always, this alignment command tries to be smart and not be fooled
by column or row delimiters embedded in a cell.
+Beside ~latex-table-wizard-align~ with its cycling behavior, four
+commands are defined (but not exposed by the transient interface),
+each of which just performs one of these transformations. These are:
+
++ ~latex-table-wizard-align-left~
++ ~latex-table-wizard-align-right~
++ ~latex-table-wizard-center~
++ ~latex-table-wizard-compress~
+
** Extra commands in the transient prefix
The transient interfaces invoked by ~latex-table-wizard~ also exposes
some other commands that are not defined by this package but are
diff --git a/latex-table-wizard.texi b/latex-table-wizard.texi
index ebeafbf2c4..2adf512d77 100644
--- a/latex-table-wizard.texi
+++ b/latex-table-wizard.texi
@@ -460,6 +460,21 @@ table to start on its own line.
As always, this alignment command tries to be smart and not be fooled
by column or row delimiters embedded in a cell.
+Beside @code{latex-table-wizard-align} with its cycling behavior, four
+commands are defined (but not exposed by the transient interface),
+each of which just performs one of these transformations. These are:
+
+@itemize
+@item
+@code{latex-table-wizard-align-left}
+@item
+@code{latex-table-wizard-align-right}
+@item
+@code{latex-table-wizard-center}
+@item
+@code{latex-table-wizard-compress}
+@end itemize
+
@node Extra commands in the transient prefix
@section Extra commands in the transient prefix
diff --git a/readme.org b/readme.org
deleted file mode 100644
index 848f39714f..0000000000
--- a/readme.org
+++ /dev/null
@@ -1,486 +0,0 @@
-#+TITLE: LaTeX table wizard - Magic editing of LaTeX tables
-#+SUBTITLE: for version {{{version}}}
-#+AUTHOR: Enrico Flor
-#+EMAIL: enrico@eflor.net
-
-#+OPTIONS: ':t toc:t author:t email:t
-#+MACRO: version 1.0.0
-#+MACRO: updated last updated 14 December 2022
-
-
[[https://melpa.org/#/latex-table-wizard][file:https://melpa.org/packages/latex-table-wizard-badge.svg]]
-
-Copyright (C) 2022 Enrico Flor.
-
- Permission is granted to copy, distribute and/or modify this
- document under the terms of the GNU Free Documentation License,
- Version 1.3 or any later version published by the Free Software
- Foundation; with no Invariant Sections, with the Front-Cover Texts
- being “A GNU Manual,” and with the Back-Cover Texts as in (a)
- below. A copy of the license is included in the section entitled
- “GNU Free Documentation License.”
-
- (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and
- modify this GNU manual.”
-* Introduction
-
-One of org-mode's magic features is its table editing capabilities.
-The goal of this package is to replicate that magic for LaTeX
-table(-like) environments.
-
-The way this is done is through a series of interactive commands that
-are exposed as *transient suffixes* through the transient interface
-invoked by the command ~latex-table-wizard~. What this means is that
-by calling ~latex-table-wizard~ when point is in a table-like
-environment, you will be presented with a choice of keys that are
-bound to all the commands provided by this package.
-
-All these commands can of course be called through
-~execute-extended-command~, and you can bind any key you want to them.
-See [[#custom-transient-prefix]] for how to change the default bindings
-offered by the transient prefix.
-
-An important feature of LaTeX-table-wizard is that it *tries to be
-smart*: for instance, it should not be fooled if the current
-table-like environments contains *embedded tables* (that is, other
-tabular environments inside of its cells). The table is parsed so
-that these big cells are treated like any other cell.
-
-For example, if you call ~latex-table-wizard~ when point is outside of
-the embedded ~tabular~ environment, LaTeX-table-wizard will behave as if
-it was in any other 3x3 table, and the embedded table will be treated
-just as any other cell content.
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- \begin{tabular}{ll}
- a & b \\
- c & d
- \end{tabular}
- & █B2 & C2 \\\hline
- A1 & B1 & C1 \\
- A0 & B0 \makecell{longer & nested cell} & C0
-\end{tabular}
-#+end_src
-
-Of course you can call ~latex-table-wizard~ with point inside of the
-embedded table, in which case any command you use will operate only on
-the embedded table.
-
-For most of this document we will assume the table-like environment
-has the standard LaTeX2e syntax, but you can define your own types of
-table-like environments (more on this [[#user-defined-envs][below]]).
-
-* Available commands
-For now, we will assume a standard LaTeX syntax for tabular
-environments, where ~&~ delimits columns and ~\\~ rows (see
[[#user-defined-envs][below]] for
-info as to how to specify additional environments).
-
-Whenever we say "current" we mean "at point".
-
-** Start editing
-Just call ~latex-table-wizard~ when point is inside of table-like
-environment.
-
-This commands actually activates the non-global minor mode
-~latex-table-wizard-mode~. If you intend to use this package's commands
-without the transient interface brought up by ~latex-table-wizard~,
-activate this minor mode to have the interactive functions loaded.
-** Relative motion commands
-
-These commands move point N cells to the right, left, down, and up. N
-is passed as a prefix argument, and if it's not passed, it defaults
-to 1.
-
-| Command | Default key |
-|----------------------------+-------------|
-| ~latex-table-wizard-right~ | ~f~ |
-| ~latex-table-wizard-left~ | ~b~ |
-| ~latex-table-wizard-down~ | ~n~ |
-| ~latex-table-wizard-up~ | ~p~ |
-
-With just one of these you can get anywhere you want in the table:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A0 & B0 & C0 \\\hline
- A1 & B1 & C1 \\
- A2 & B2 & C2
-\end{tabular}
-#+end_src
-
-This is because these commands try to Do What You Mean if there is no
-suitable cell to move to:
-
-+ Point on ~C0~, ~latex-table-wizard-right~ ⇒ point on ~A1~
-+ Point on ~A0~, ~latex-table-wizard-left~ ⇒ point on ~C2~
-+ Point on ~C2~, ~latex-table-wizard-down~ ⇒ point on ~A0~
-+ Point on ~B0~, ~latex-table-wizard-up~ ⇒ point on ~A2~
-
-and so on.
-
-These four commands accept a positive integer passed as a prefix
-argument that determines how many steps (i.e. how many cells) the
-movement will consist of. By default, you can pass this argument
-from the transient interface of ~latex-table-wizard~ with the key ~u~
-(bound to ~universal-argument~).
-** Absolute motion commands
-
-| Command | Default key | Move to...
|
-|--------------------------------------+-------------+-------------------------------|
-| ~latex-table-wizard-beginning-of-cell~ | ~a~ | end of current cell
|
-| ~latex-table-wizard-end-of-cell~ | ~e~ | beginning of
current cell |
-| ~latex-table-wizard-beginning-of-row~ | ~B~ | leftmost cell in
current row |
-| ~latex-table-wizard-end-of-row~ | ~F~ | rightmost cell in
current row |
-| ~latex-table-wizard-bottom~ | ~N~ | bottom cell in
current column |
-| ~latex-table-wizard-top~ | ~P~ | top cell in current
column |
-** Mark, kill and insert commands
-| Command | Default key |
|
-|----------------------------------+-------------+--------------------------------------------|
-| ~latex-table-wizard-mark-cell~ | ~m c~ | mark current cell
|
-| ~latex-table-wizard-insert-column~ | ~i c~ | insert empty column to
the right |
-| ~latex-table-wizard-insert-row~ | ~i r~ | insert row below
|
-| ~latex-table-wizard-kill-column~ | ~k c~ | add content of current
column to kill ring |
-| ~latex-table-wizard-kill-row~ | ~k r~ | add content of current
row to kill ring |
-| ~exchange-point-and-mark~ | ~x~ |
|
-** Swap adjacent fields
-
-| Command | Default key | Swap current...
|
-|--------------------------------------+-------------+----------------------------------|
-| ~latex-table-wizard-swap-cell-right~ | ~C-f~ | cell with the one
to the right |
-| ~latex-table-wizard-swap-cell-left~ | ~C-b~ | cell with the one
to the left |
-| ~latex-table-wizard-swap-cell-down~ | ~C-n~ | cell with the one
below |
-| ~latex-table-wizard-swap-cell-up~ | ~C-p~ | cell with the one
above |
-| ~latex-table-wizard-swap-column-right~ | ~M-f~ | column with the one
to the right |
-| ~latex-table-wizard-swap-column-left~ | ~M-b~ | column with the one
to the left |
-| ~latex-table-wizard-swap-row-down~ | ~M-n~ | row with the one
below |
-| ~latex-table-wizard-swap-row-up~ | ~M-p~ | row with the one
above |
-
-For these commands, think of the cells and columns as circular: if
-there is no item in the direction given, the target is the one on the
-opposite end of the current cell. So for example:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A0 & B0 & C0 \\\hline
- A1 & B1 & C1 \\
- A2 & B2 & C2
-\end{tabular}
-#+end_src
-
-This is because these commands try to Do What You Mean if there is no
-suitable cell to move to:
-
-Point on ~C0~, ~latex-table-wizard-swap-cell-right~
- ⇒
-#+begin_src LaTeX
-\begin{tabular}{lll}
- C0 & B0 & A0 \\\hline
- A1 & B1 & C1 \\
- A2 & B2 & C2
-\end{tabular}
-#+end_src
-
-Point on ~B0~, ~latex-table-wizard-swap-row-up~
- ⇒
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A2 & B2 & C2 \\\hline
- A1 & B1 & C1 \\
- A0 & B0 & C0
-\end{tabular}
-#+end_src
-
-Point on ~A1~, ~latex-table-wizard-swap-column-right~
- ⇒
-#+begin_src LaTeX
-\begin{tabular}{lll}
- B0 & A0 & C0 \\\hline
- B1 & A1 & C1 \\
- B2 & A2 & C2
-\end{tabular}
-#+end_src
-
-** Swap arbitrary fields
-To swap arbitrary fields one must first *select* something and then move
-point somewhere else and perform the swap. Importantly, *selecting
-does not mean marking*: the mark is not even moved when selecting
-(however, by default the selected cell will receive the same kind of
-highlighting the loaded theme defines for the active region, but this
-is a purely graphical equivalence). "Selecting", for the purposes of
-LaTeX-table-wizard only means storing a cell, a line or a row to be
-swapped with another.
-
-The simplest case is one in which the current cell, column or row are
-selected:
-
-| Command | Default key | Select current...
|
-|-----------------------------------------+-------------+----------------------|
-| ~latex-table-wizard-select-deselect-cell~ | ~SPC~ | select/deselect
cell |
-| ~latex-table-wizard-select-column~ | ~c~ | select column
|
-| ~latex-table-wizard-select-row~ | ~r~ | deselect row
|
-| ~latex-table-wizard-deselect-all~ | ~d~ | deselect all
|
-
-The first command, ~latex-table-wizard-select-deselect-cell~ toggles the
-status of the current cell as being selected or not.
-
-Once things are selected, you move point somewhere else in the table
-(with the above mentioned motion commands), and then:
-
-| ~latex-table-wizard-swap~ | ~s~ | swap selection and current thing |
-
-What is swapped depends on what is selected: if the selection was only
-a cell, then that cell and the current one are swapped. If it was (a
-potentially discontinuous segment of) a column or a row, then that
-selection is swapped with the current column or row or the
-corresponding portion thereof. If you selected multiple cell that are
-not part of the same column or row, the swap won't happen
-(LaTeX-table-wizard doesn't know what you want it to do in that case).
-
-** Format the table
-
-The only command to format the table is ~latex-table-wizard-align~. The
-behavior of this command is cyclic, in the sense that calling it
-repeatedly causes the table to cycle through four types of formatting:
-left aligned, centered, right aligned and compressed. The latter
-state is actually not one of alignment (that is, the column separators
-are not vertically aligned): it just means that all the extra space at
-the beginning and end of each cell is collapsed into one.
-
-| Command | Default key |
-|-------------------------------------+-------------|
-| ~latex-table-wizard-align~ | ~TAB~ |
-
-The following five tables illustrate the effect of calling
-~latex-table-wizard-align~ repeatedly.
-
-This is the original cell:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A2 longer cell & B2 & C2 \\\hline
- A1 & B1 & C1 \\ A0 & B0 \makecell{longer & nested cell} & C0
-\end{tabular}
-#+end_src
-
-left aligned:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A2 longer cell & B2 & C2 \\\hline
- A1 & B1 & C1 \\
- A0 & B0 \makecell{longer & nested cell} & C0
-\end{tabular}
-#+end_src
-
-centered:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A2 longer cell & B2 & C2 \\\hline
- A1 & B1 & C1 \\
- A0 & B0 \makecell{longer & nested cell} & C0
-\end{tabular}
-#+end_src
-
-right aligned:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A2 longer cell & B2 & C2 \\\hline
- A1 & B1 & C1 \\
- A0 & B0 \makecell{longer & nested cell} & C0
-\end{tabular}
-#+end_src
-
-compressed:
-
-#+begin_src LaTeX
-\begin{tabular}{lll}
- A2 longer cell & B2 & C2 \\\hline
- A1 & B1 & C1 \\
- A0 & B0 \makecell{longer & nested cell} & C0
-\end{tabular}
-#+end_src
-
-As you can see, ~latex-table-wizard-align~ also forces every row of the
-table to start on its own line.
-
-As always, this alignment command tries to be smart and not be fooled
-by column or row delimiters embedded in a cell.
-
-** Extra commands in the transient prefix
-The transient interfaces invoked by ~latex-table-wizard~ also exposes
-some other commands that are not defined by this package but are
-useful for its usage. These are:
-
-| Command | Default key |
-|-------------------------+-------------|
-| ~toggle-truncate-lines~ | ~t~ |
-| ~undo~ | ~/~ |
-| ~exchange-point-and-mark~ | ~x~ |
-| ~universal-argument~ | ~u~ |
-| ~transient-quit-one~ | ~RET~ |
-
-
-* Known issues
-
-** Empty cells in single-column tables
-This package handles empty cells (that is, cells without any text in
-them except perhaps comments) well. The only exception is in tables
-with a single column. The problem is that a buffer substring like
-~\\ \\~ is not parsed as a cell. This is normally not a problem, but if
-the table has only one column then that substring could be meant to be
-an empty or blank cell.
-
-A way to avoid this problem may be defining a LaTeX macro that does
-nothing, and use it in the cell you intend to be empty so that the
-parser sees some text.
-
-#+begin_src latex
-\newcommand{\blk}{}
-#+end_src
-
-So instead of ~\\ \\~ we will have ~\\ \blk{} \\~.
-* Customization
-
-To quickly access all customizations pertinent to LaTeX-table-wizard
-through the Customize interface, call ~latex-table-wizard-customize~.
-
-** Customize transient prefix
-:PROPERTIES:
-:CUSTOM_ID: custom-transient-prefix
-:END:
-To change the default key bindings, you need to provide change the
-value of the alist ~latex-table-wizard-transient-keys~. The easiest and
-most convenient way to do it is through ~latex-table-wizard-customize~.
-
-Each cons cell in this alist maps a command to a key description
-string (the kind of strings that the macro ~kbd~ takes as arguments).
-
-For example, these three cons cells are members of the default value of
-~latex-table-wizard-transient-keys~:
-
-#+begin_src emacs-lisp
-(undo . "//")
-(latex-table-wizard-swap-cell-right . "C-f")
-(latex-table-wizard-insert-row . "i r")
-#+end_src
-
-** Define rules for new environments
-:PROPERTIES:
-:CUSTOM_ID: user-defined-envs
-:END:
-Remember the default values used for parsing table environments:
-
-#+begin_src emacs-lisp
-(defcustom latex-table-wizard-column-delimiters '("&")
- "List of strings that are column delimiters if unescaped."
- :type '(repeat string)
- :group 'latex-table-wizard)
-
-(defcustom latex-table-wizard-row-delimiters '("\\\\\\\\")
- "List of strings that are row delimiters if unescaped."
- :type '(repeat string)
- :group 'latex-table-wizard)
-
-(defcustom latex-table-wizard-hline-macros '("cline"
- "vline"
- "midrule"
- "hline"
- "toprule"
- "bottomrule")
- "Name of macros that draw horizontal lines.
-
-Each member of this list is a string that would be between the
-\"\\\" and the arguments."
- :type '(repeat string)
- :group 'latex-table-wizard)
-#+end_src
-
- LaTeX-table-wizard will always presume the table you want operate on
- has a syntax specified like this. But suppose you use different
- environments with non-standard syntax: suppose you define a
- table-like environment of your choice, let's call it ~mytable~, that
- uses ~!ROW~ and ~!COL~ instead of ~&~ and ~\\~ as delimiters, and a macro
- ~\horizontal~ for horizontal lines. When you are in a ~mytable~
- environments, you want LaTeX-table-wizard to adapt to this new
- syntax.
-
- All you need to do add an appropriate cons cell to the
- ~latex-table-wizard-new-environments-alist~ association list, mapping
- the name of the environment, as a string, to a property list
- specifying the values. Here is this variable's ~defcustom~ expression:
-
- #+begin_src emacs-lisp
-(defcustom latex-table-wizard-new-environments-alist nil
- "Alist mapping environment names to property lists.
-
-The environment name is a string, for example \"foo\" for an
-environment like
-
- \\begin{foo}
- ...
- \\end{foo}
-
-The cdr of each mapping is a property list with three keys:
-
- :col
- :row
- :lines
-
-The values for :col and :row are two lists of strings.
-
-The value for :lines is a list of strings just like is the case
-for `latex-table-wizard-hline-macros', each of which is the name
-of a macro that inserts some horizontal line. For a macro
-\"\\foo{}\", use string \"foo\"."
- :type '(alist :key-type (string :tag "Name of the environment:")
- :value-type (plist :key-type symbol
- :options (:col :row :lines)
- :value-type (repeat string)))
-
- :group 'latex-table-wizard)
- #+end_src
-
-You can add the new syntax for the ~mytable~ environment through the
-Customize interface, which will present you with the correct values to
-set, or you can just add a cons cell of your writing to the alist:
-
- #+begin_src emacs-lisp
-(add-to-list 'latex-table-wizard-new-environments-alist
- '("mytable" . (:col ("!COL") :row ("!ROW") :lines
("horizontal"))))
- #+end_src
-
-Each of the values in the plist is a list of strings: this way you can
-define environments that can use more than one type of column
-separator. Importantly, the strings in the ~:lines~ list are *names of
-LaTeX* macros, which means that they should not start with the
-backslash and you should not add any argument to them. In the example
-above a buffer substring like =\horizontal{1}= will be interpreted as a
-hline macro if in a ~mytable~ environment.
-
-** Customizing faces
-
- Calling ~latex-table-wizard~ by default causes the portions of the
- buffer before and after the table at point to be "grayed out", so
- that you can clearly focus on the table. If you don't want this to
- happen, set the value of the variable ~latex-table-wizard-no-focus~ to
- ~t~.
-
- If instead you want effect to be different than the default (which is
- applying a foreground of color ~gray40~), change the value of the face
- ~latex-table-wizard-background~.
-
- By default, when you move around the table and select objects from it
- the relevant portions of the table are highlighted. If you don't
- want this to happen, set the value of the variable
- ~latex-table-wizard-no-highlight~ to ~t~.
-
- If instead you want the highlighting to be done differently than the
- default (which is applying a background of the same color as the
- loaded theme defines for the active region), change the value of the
- face ~latex-table-wizard-highlight~.
-
- The easiest and most convenient way to set these variables,
- especially the two faces, is through the Customize interface, which
- you can access quickly by calling ~latex-table-wizard-customize~.
diff --git a/readme.org b/readme.org
new file mode 120000
index 0000000000..e6a4399a8c
--- /dev/null
+++ b/readme.org
@@ -0,0 +1 @@
+latex-table-wizard.org
\ No newline at end of file
- [elpa] externals/latex-table-wizard acdd4d8b56 23/70: New interactive function that calls transient prefix, (continued)
- [elpa] externals/latex-table-wizard acdd4d8b56 23/70: New interactive function that calls transient prefix, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard da4a2e3540 24/70: Made into a minor mode, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f9fb0ae878 28/70: Cleanup and some bug fixed, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 9ce3165694 32/70: Add center and right alignment, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard e3553c7759 34/70: Add feedback about cell jumps, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 13359e40f6 44/70: rename readme, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f290f87949 45/70: add empty changelog file, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 3bafcbefeb 49/70: Update commentary section, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 36e68b0fd8 48/70: Add .elpaignore, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 85af90dac4 52/70: Use TeX-comment-forward, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard ff8c832ad0 53/70: Version 1.1.0,
ELPA Syncer <=
- [elpa] externals/latex-table-wizard 71b7b2c252 55/70: Update copyright year and fix bug, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 2544236eb3 57/70: New commands to kill row and column content, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 1f4effedfa 59/70: NOCYCLE argument added to movement commands, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard d5494445cf 62/70: Fix latex-table-wizard--comment-thing for multiline cells, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard c496237fa1 64/70: Minor bug fix in latex-table-wizard-right, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 04b3d59de7 65/70: Four new commands added to edit cell content, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard e61e1c1f0f 69/70: Fix parsing when whole table is inside certain macros, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 9d779a2d9b 42/70: Correct conditional in mode startup, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f2f2efeed4 50/70: New alignment commands and bug fixes, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard c315f144a6 47/70: Add short description file, ELPA Syncer, 2023/05/13