Re: [AUCTeX] Some hints for editing tables

2015-11-16 Thread Mosè Giordano
Hi Joost,

2015-11-16 23:21 GMT+01:00 Joost Kremers :
>>
>> Op 15 nov. 2015 om 18:55 heeft Mosè Giordano  het volgende 
>> geschreven:
>>
>> Dear all,
>>
>> as you all know, editing tables in LaTeX can be quite tedious.
>> Luckily in AUCTeX we got a couple of nice features, auto insertion of
>> the appropriate &s and a good indentation function in tabular-like
>> environments, but there is still much room for improvements.[1]
> [...]
>
>> Note
>> [1]  Suggestions welcome.
>
> Well, IMHO this is one area where Emacs shines, but you need a bit more than 
> just AUCTeX. Using orgmode and preview-latex, there is a solution that is 
> better than anything I've ever seen. This is what I do:
>
> - include in the preamble of my documents the following snippet:
>
> ```
> \usepackage{comment}
> \specialcomment{orgtbl}{}{}
> \excludecomment{orgtbl}
> ```
>
> - customise `orgtbl-radio-table-templates`, so that the LaTeX table is inside 
> an orgtbl environment.
>
> - customise `LaTeX-comment-env-list` and `LaTeX-verbatim-environments` to 
> include `orgtbl`.
>
> - customise `TeX-fold-env-list` to fold the orgtbl environment to "[orgtbl]". 
> (Actually, there's no need to set up a special comment environment. I do it 
> so I can easily distinguish between folded comments and folded org tables.)
>
> - activate `orgtbl-mode` in my LaTeX buffer.
>
> - issue the command `M-x orgtbl-insert-radio-table` where I want my table to 
> be. This inserts an org-mode table template inside an orgtbl environment, 
> plus a receiving location for the LaTeX table right above it.
>
> - edit my table with the full orgmode table editor right inside my LaTeX 
> buffer.
>
> - press C-c C-c when I'm done with the table. This converts the table to 
> LaTeX format and puts the result in the LaTeX buffer at the specified 
> location.
>
> - press C-c C-o C-b to fold the orgtbl environment.
>
> - move the cursor to the LaTeX table and press C-c C-p C-p to preview the 
> table.
>
> The results? This:
>
>
>
>
> allows me to edit the table comfortably (moving from cell to cell with TAB, 
> automatic realignment of columns, quick insertion/deletion of rows and 
> columns with C-M-, etc.) and eventually turns into this:
>
>
>
>
> (Yes, in case you noticed, I do indeed use a proportional font in my LaTeX 
> buffers.)
>
> I think that calls for a big Woohoo! and a big Hail Ye! to all the Emacs 
> priests who help make this possible (which IMO includes the AUCTeX team). Oh, 
> and stop staring at the people quietly slipping out the back door. They're 
> just vi users sneeking to their computers to see whether evil-mode works with 
> AUCTeX.
>
> Ok, I'm going a bit overboard there, but I really think the whole thing is 
> truly amazing and it deserves a mention in a thread entitled "Some hints for 
> editing tables". Even if it's not entirely what you were after when you said 
> suggestions were welcome...

Thank you!  Indeed I was discussing features entirely AUCTeX-related
(being this the AUCTeX mailing list ;-), but your experience with
other Emacs tools that can be used for LaTeX documents is relevant.

I like org, and I used it in the past (nowadays much less), and its
table features are really impressive.  In particular I love the
possibility to turn Emacs into a full fledged spreadsheet combining
org and calc.  Nevertheless, I don't like very much the final LaTeX
output of org tables (I don't know if it changed lately, but looking
to your screenshot it doesn't seem to be so), for example the vertical
bars are questionable, but of course in Emacs you can customize every
detail and the content of of the table is more important of its aspect
that can be easily adjusted.

I must admit that when I was thinking to possible improvements to
management of tables inside AUCTeX I was really thinking about org:
moving across cells with TAB and inserting and deleting columns with a
single key binding are really handy features!  But I'm not sure it's
worth having those features in AUCTeX, it could be a useless
duplication of efforts if many users take advantage of org anyway.

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Some hints for editing tables

2015-11-16 Thread Joost Kremers
> 
> Op 15 nov. 2015 om 18:55 heeft Mosè Giordano  het volgende 
> geschreven:
> 
> Dear all,
> 
> as you all know, editing tables in LaTeX can be quite tedious.
> Luckily in AUCTeX we got a couple of nice features, auto insertion of
> the appropriate &s and a good indentation function in tabular-like
> environments, but there is still much room for improvements.[1]
[...]

> Note
> [1]  Suggestions welcome.

Well, IMHO this is one area where Emacs shines, but you need a bit more than 
just AUCTeX. Using orgmode and preview-latex, there is a solution that is 
better than anything I've ever seen. This is what I do:

- include in the preamble of my documents the following snippet:

```
\usepackage{comment}
\specialcomment{orgtbl}{}{}
\excludecomment{orgtbl}
```

- customise `orgtbl-radio-table-templates`, so that the LaTeX table is inside 
an orgtbl environment.

- customise `LaTeX-comment-env-list` and `LaTeX-verbatim-environments` to 
include `orgtbl`.

- customise `TeX-fold-env-list` to fold the orgtbl environment to "[orgtbl]". 
(Actually, there's no need to set up a special comment environment. I do it so 
I can easily distinguish between folded comments and folded org tables.)

- activate `orgtbl-mode` in my LaTeX buffer.

- issue the command `M-x orgtbl-insert-radio-table` where I want my table to 
be. This inserts an org-mode table template inside an orgtbl environment, plus 
a receiving location for the LaTeX table right above it.

- edit my table with the full orgmode table editor right inside my LaTeX buffer.

- press C-c C-c when I'm done with the table. This converts the table to LaTeX 
format and puts the result in the LaTeX buffer at the specified location.

- press C-c C-o C-b to fold the orgtbl environment.

- move the cursor to the LaTeX table and press C-c C-p C-p to preview the table.

The results? This:



allows me to edit the table comfortably (moving from cell to cell with TAB, 
automatic realignment of columns, quick insertion/deletion of rows and columns 
with C-M-, etc.) and eventually turns into this:



(Yes, in case you noticed, I do indeed use a proportional font in my LaTeX 
buffers.)

I think that calls for a big Woohoo! and a big Hail Ye! to all the Emacs 
priests who help make this possible (which IMO includes the AUCTeX team). Oh, 
and stop staring at the people quietly slipping out the back door. They're just 
vi users sneeking to their computers to see whether evil-mode works with AUCTeX.

Ok, I'm going a bit overboard there, but I really think the whole thing is 
truly amazing and it deserves a mention in a thread entitled "Some hints for 
editing tables". Even if it's not entirely what you were after when you said 
suggestions were welcome...

-- 
Joost Kremers
Life has its moments

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


[AUCTeX] Some hints for editing tables

2015-11-16 Thread Mosè Giordano
Dear all,

as you all know, editing tables in LaTeX can be quite tedious.
Luckily in AUCTeX we got a couple of nice features, auto insertion of
the appropriate &s and a good indentation function in tabular-like
environments, but there is still much room for improvements.[1]

What I often want is to have the table aligned.  Emacs has the great
`align-current' function, by I get tired to manually call it every now
and then, and so I often don't run it all.  In addition, I have
`auto-fill-mode' on, but in order to have the table aligned
auto-filling doesn't really make sense.  So, why don't hack
auto-filling in order to run `align-current'?  Then I came up with
this simple solution:

(defun mg/LaTeX-auto-fill-function ()
  (if (member (LaTeX-current-environment) '("tabular"))
  (align-current)
(do-auto-fill)))

(add-hook 'LaTeX-mode-hook
  (lambda ()
(setq auto-fill-function 'mg/LaTeX-auto-fill-function)))

So, if current environment is tabular, auto-fill-function, triggered
by SPC, RET, and so on, calls `align-current', otherwise the usual
filling function is used (replace `do-auto-fill' wit your favorite
one).

In addition, in order to have tables really visually aligned (useful
for rectangular selection) you should also truncate lines and make
sup/subscript as large as normal characters, unless you already do so.
For this, take a look at

(defun toggle-LaTeX-rectangular-edit-ready-mode ()
  (interactive)
  (if (equal truncate-lines nil)
  (progn
(set-face-attribute
 'font-latex-subscript-face nil
 :height 1.0)
(set-face-attribute
 'font-latex-superscript-face nil
 :height 1.0)
(setq truncate-lines t)
(message "LaTeX-rectangular-edit-ready-mode has been switched on"))
(progn
  (set-face-attribute
   'font-latex-subscript-face nil
   :height 0.8)
  (set-face-attribute
   'font-latex-superscript-face nil
   :height 0.8)
  (setq truncate-lines nil)
  (message "LaTeX-rectangular-edit-ready-mode has been switched off"

Source: http://emacs.stackexchange.com/a/17207/620

I want to make it clear I'm not going to include in AUCTeX any of this
features, they're just some hints for you, but they can be highly
inefficient, so use them at your own risk ;-)

Happy TeXing,
Mosè


Note
[1]  Suggestions welcome.

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] AUCTeX support in lettre

2015-11-16 Thread Roland Winkler
On Sat Nov 14 2015 Vincent Belaïche wrote:
> BBDB is some sort of phone book (well, it means insidious Big-Bother 
> Data Base). My intention is to have functions to read the to-address with
> auto-completion by getting the data from BBDB by means of name or
> organisation.
> 
> It is not that simple because the way you present the address in a
> postal sending may need some formatting dependent on the country,
> so probably a defcustom is needed to make this more open.

In BBDB 3 the formatting of addresses is quite customizable via the
user variable bbdb-address-format-list.

You might know that BBDB also comes with an interface for printing
complete BBDB records via TeX (not LaTeX), see the file bbdb-print.el.
For addresses, this uses bbdb-print-address-format-list, which
defaults to bbdb-address-format-list.  Printing complete BBDB
records is probably not what you want.  However, you might want to
use a scheme similar to what bbdb-print does in order to feed BBDB
addresses into your (La)TeX files.

Roland

PS: The main code in bbdb-print.el is very old.  It's on my to-do
list to update this code to have a better interface with LaTeX.
However, I have not yet found the time to do that.  Yet printing of
addresses will most likely continue to use bbdb-address-format-list.


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex