Re: [AUCTeX] Some hints for editing tables
Le 19/11/2015 20:12, Jorge A. Alfaro-Murillo a écrit : Jean-François writes: the idea isn't to implement in LaTeX what org can do, but to share the same syntax, so that org can do its things, but then on C-cC-c the table is compiled by LaTeX That is exactly what orgtbl-mode does, see: (info "(org) A LaTeX example") It appears I have been injecting lots of entropy into this thread, I think I got confused at some point. Best, Jean-François ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Jean-François writes: the idea isn't to implement in LaTeX what org can do, but to share the same syntax, so that org can do its things, but then on C-cC-c the table is compiled by LaTeX That is exactly what orgtbl-mode does, see: (info "(org) A LaTeX example") Best, -- Jorge. ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Le 19 nov. 2015 à 19:52, jfbu a écrit : > PS: there is a ... oh... I see on > >http://www.ctan.org/author/tellechea > > very bad news. I immediately point out this is a bug or hack on CTAN I am also announced deceased on CTAN at this time -- as one say, these news are greatly exaggerated... sorry about the alarm I contributed to spread... long live anyone Jean-François ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Le 19 nov. 2015 à 19:22, Marcin Borkowski a écrit : > > On 2015-11-19, at 19:02, jfbu wrote: > >> probably the answer is : "yes and no" >> >> no, as it doesn't seem to have implemented in TeX/LaTeX the >> org syntax for tables: if I am not mistaken tapdoc.pdf seems >> to indicate that rows start with \B! and end with \E! >> >> (at least it is what I see from the code samples given) >> >> yes, as it seems to have a syntax of its own which appears >> to be somewhat akin to the org syntax > > Exactly. It's not really Org-tables in LaTeX, treat it rather as > a proof of concept. > > Since Org tables are (syntax-wise) fairly simplistic, in principle it > wouldn't be too difficult to write a (La)TeX package to deal with them > directly. Of course, there are tricky things, like the spreadsheet > (little hope for implementing that), column groups and width/alignment > cookies. Those features would probably need two passes - the first one > would gather the information from the cookies, the second one would > typeset the table. Possible, but probably not worth the effort. Hi Marcin, the idea isn't to implement in LaTeX what org can do, but to share the same syntax, so that org can do its things, but then on C-cC-c the table is compiled by LaTeX PS: there is a ... oh... I see on http://www.ctan.org/author/tellechea very bad news. His package spreadtab does spreadsheet in LaTeX best Jean-François ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
On 2015-11-19, at 19:02, jfbu wrote: > probably the answer is : "yes and no" > > no, as it doesn't seem to have implemented in TeX/LaTeX the > org syntax for tables: if I am not mistaken tapdoc.pdf seems > to indicate that rows start with \B! and end with \E! > > (at least it is what I see from the code samples given) > > yes, as it seems to have a syntax of its own which appears > to be somewhat akin to the org syntax Exactly. It's not really Org-tables in LaTeX, treat it rather as a proof of concept. Since Org tables are (syntax-wise) fairly simplistic, in principle it wouldn't be too difficult to write a (La)TeX package to deal with them directly. Of course, there are tricky things, like the spreadsheet (little hope for implementing that), column groups and width/alignment cookies. Those features would probably need two passes - the first one would gather the information from the cookies, the second one would typeset the table. Possible, but probably not worth the effort. > best > Jean-François Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Le 19/11/2015 16:27, Marcin Borkowski a écrit : > > On 2015-11-19, at 09:36, jfbu wrote: > >> Hi Mosè and Joost, >> >> Le 18 nov. 2015 à 23:52, Mosè Giordano a écrit : >> >>> Hi Joost, >>> >>> 2015-11-17 13:18 GMT+01:00 Joost Kremers : If you do decide to take on the challenge, here's a few things to take into consideration: >>> >>> Well, it was more a dream than a declaration of action, I'm not going >>> to work on that ;-) org has its own simple syntax for tables and it >>> works very well, but editing real LaTeX tables requires much more >>> attention, for example they can be split over lines (I don't think >>> it's the case for org). >> >> I am going off-topic here, but it could be possible to address this >> issue at the TeX level: I mean by this define a LaTeX environment for >> tables which would use org-syntax. Thus you could have the goodies >> you mention on the Emacs editing side, and the LaTeX compilation would >> proceed directly. >> >> For example TeX allows at the inner core any choice of character for >> tabulation in alignments, thus we could use | rather than &. Of course >> higher level structures will perhaps really need a &, but then they >> can be rewritten to work with |. (use of | as tabulation means one >> has to address how to use it as standard character elsewhere) >> >> (for example the table in the screenshot provided by Joost can definitely >> be analyzed at TeX macro level, if the goal is to produce simple centered >> columns; I don't know how org says to use left or right aligned columns) >> >> I mention this as a theoretical possibility ! > > You mean, something like this? > > http://ctan.org/pkg/tap > Hi, thanks I didn't know that (Plain) package. (although I finally found it in TeXLive, the tapdoc.tex documentation file needs to be compiled, and texdoc tap yields many results but seemingly nothing related to tap ... I found it on my local disk only after having downloaded it from CTAN and compiled) probably the answer is : "yes and no" no, as it doesn't seem to have implemented in TeX/LaTeX the org syntax for tables: if I am not mistaken tapdoc.pdf seems to indicate that rows start with \B! and end with \E! (at least it is what I see from the code samples given) yes, as it seems to have a syntax of its own which appears to be somewhat akin to the org syntax best Jean-François ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
On 2015-11-19, at 09:36, jfbu wrote: > Hi Mosè and Joost, > > Le 18 nov. 2015 à 23:52, Mosè Giordano a écrit : > >> Hi Joost, >> >> 2015-11-17 13:18 GMT+01:00 Joost Kremers : >>> If you do decide to take on the challenge, here's a few things to take >>> into consideration: >> >> Well, it was more a dream than a declaration of action, I'm not going >> to work on that ;-) org has its own simple syntax for tables and it >> works very well, but editing real LaTeX tables requires much more >> attention, for example they can be split over lines (I don't think >> it's the case for org). > > I am going off-topic here, but it could be possible to address this > issue at the TeX level: I mean by this define a LaTeX environment for > tables which would use org-syntax. Thus you could have the goodies > you mention on the Emacs editing side, and the LaTeX compilation would > proceed directly. > > For example TeX allows at the inner core any choice of character for > tabulation in alignments, thus we could use | rather than &. Of course > higher level structures will perhaps really need a &, but then they > can be rewritten to work with |. (use of | as tabulation means one > has to address how to use it as standard character elsewhere) > > (for example the table in the screenshot provided by Joost can definitely > be analyzed at TeX macro level, if the goal is to produce simple centered > columns; I don't know how org says to use left or right aligned columns) > > I mention this as a theoretical possibility ! You mean, something like this? http://ctan.org/pkg/tap > (and now I am going to go and check org documentation for > its table syntax and realize I posted too hastily this...) Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Hi Mosè and Joost, Le 18 nov. 2015 à 23:52, Mosè Giordano a écrit : > Hi Joost, > > 2015-11-17 13:18 GMT+01:00 Joost Kremers : >> If you do decide to take on the challenge, here's a few things to take >> into consideration: > > Well, it was more a dream than a declaration of action, I'm not going > to work on that ;-) org has its own simple syntax for tables and it > works very well, but editing real LaTeX tables requires much more > attention, for example they can be split over lines (I don't think > it's the case for org). I am going off-topic here, but it could be possible to address this issue at the TeX level: I mean by this define a LaTeX environment for tables which would use org-syntax. Thus you could have the goodies you mention on the Emacs editing side, and the LaTeX compilation would proceed directly. For example TeX allows at the inner core any choice of character for tabulation in alignments, thus we could use | rather than &. Of course higher level structures will perhaps really need a &, but then they can be rewritten to work with |. (use of | as tabulation means one has to address how to use it as standard character elsewhere) (for example the table in the screenshot provided by Joost can definitely be analyzed at TeX macro level, if the goal is to produce simple centered columns; I don't know how org says to use left or right aligned columns) I mention this as a theoretical possibility ! (and now I am going to go and check org documentation for its table syntax and realize I posted too hastily this...) best, Jean-François ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Hi Joost, 2015-11-17 13:18 GMT+01:00 Joost Kremers : > If you do decide to take on the challenge, here's a few things to take > into consideration: Well, it was more a dream than a declaration of action, I'm not going to work on that ;-) org has its own simple syntax for tables and it works very well, but editing real LaTeX tables requires much more attention, for example they can be split over lines (I don't think it's the case for org). Bye, Mosè ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Mosè Giordano writes: 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. The vertical lines are not default. But yes, everything can be easily configured. For example to use booktabs, you can use something like: #+BEGIN_SRC emacs-lisp (defun orgtbl-to-latex-booktabs (table params) "Convert the Orgtbl mode TABLE to LaTeX using booktabs package." (let* ((alignment (mapconcat (lambda (x) (if x "r" "l")) org-table-last-alignment "")) (params2 (list :tstart (concat "\\begin{tabular}{" alignment "}\n\\toprule") :tend "\\bottomrule\n\\end{tabular}" :lstart "" :lend " " :sep " & " :efmt "%s\\,(%s)" :hline "\\midrule"))) (orgtbl-to-generic table (org-combine-plists params2 params (eval-after-load "org-table" '(progn (setq orgtbl-radio-table-templates (delete-if (lambda (x) (equal (car x) 'latex-mode)) orgtbl-radio-table-templates)) (add-to-list 'orgtbl-radio-table-templates '(latex-mode "% BEGIN RECEIVE ORGTBL %n\n% END RECEIVE ORGTBL %n\n\\begin{comment}\n#+ORGTBL: SEND %n orgtbl-to-latex-booktabs :splice nil :skip 0 :no-escape t\n| | |\n\\end{comment}\n" #+END_SRC Then orgtbl-insert-radio-table, puts something like: % BEGIN RECEIVE ORGTBL the-name-of-the-table % END RECEIVE ORGTBL the-name-of-the-table \begin{comment} #+ORGTBL: SEND the-name-of-the-table orgtbl-to-latex-booktabs :splice nil :skip 0 :no-escape t | | | \end{comment} and a table like: | A | B | |---+---| | a | b | | 1 | 2 | gets translated to: \begin{tabular}{ll} \toprule A & B \\ \midrule a & b \\ 1 & 2 \\ \bottomrule \end{tabular} -- Jorge. ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
Hi Mosè, On Mo, Nov 16 2015, Mosè Giordano wrote: > 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. Oh, by default, orgtbl-mode doesn't put bars in the table. I customised it that way. (Not because I think it looks better, BTW...) > 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. Actually, if that sort of table editing would be possible without using orgtbl-mode, I might be inclined to use it. It would require less customisation and one could edit the table directly rather than using an extra comment block. I don't know if it'd be possbile to tell org's table editing commands to use & as column separators and \\ as end of row indicatiors. If not, it might still be possible to take the relevant code, modify it and include it in AUCTeX. If you do decide to take on the challenge, here's a few things to take into consideration: - I use visual-line-mode in my LaTeX buffers, so anything that works by piggybacking on auto-fill-mode won't work for me. - One clear disadvantage of orgtbl-mode is that its table alignment functions aren't aware of folded LaTeX commands. If you have things like, \emph or \textsc etc. in the table and they're folded, the alignment is messed up. If AUCTeX were to get such table editing functionality, it'd be great if it were folding-aware, in that the alignment takes the actual visible width of the cell contents into account. - The question is then whether you'd want folding and unfolding to realign tables automatically. That seems like a bad idea, because in all other respects, folding does not change the actual content of the buffer, but there might be users who'd prefer it. (Personally, the first thing I do after loading a tex file is to fold the entire buffer, so I wouldn't want this.) Anyway, just a few thoughts. AUCTeX-specific this time. ;-) -- Joost Kremers Life has its moments ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Some hints for editing tables
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
> > 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
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