From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Orgtbl-mode questions Date: Mon, 3 Nov 2008 12:16:56 +0100 Message-ID: References: <20081102161350.GA554@Edwards.local> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KwxQe-0000kb-NY for emacs-orgmode@gnu.org; Mon, 03 Nov 2008 06:17:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KwxQb-0000ga-9j for emacs-orgmode@gnu.org; Mon, 03 Nov 2008 06:17:04 -0500 Received: from [199.232.76.173] (port=42115 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KwxQa-0000gG-VS for emacs-orgmode@gnu.org; Mon, 03 Nov 2008 06:17:01 -0500 Received: from ey-out-1920.google.com ([74.125.78.146]:34475) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KwxQa-0007Nc-Ch for emacs-orgmode@gnu.org; Mon, 03 Nov 2008 06:17:00 -0500 Received: by ey-out-1920.google.com with SMTP id 4so849737eyg.24 for ; Mon, 03 Nov 2008 03:16:59 -0800 (PST) In-Reply-To: <20081102161350.GA554@Edwards.local> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicholas S-A Cc: emacs-orgmode@gnu.org Hi Nicholas, On Nov 2, 2008, at 5:13 PM, Nicholas S-A wrote: > Hi all, > I have some questions pertaining to orgtbl-mode. I am really > excited > about using it to compose all my LaTeX tables, and in fact learned > Emacs > and Org specifically for this purpose (well, I also learned them for > all > the other awesome features of Org-mode. > First of all, I was wondering how I could add vertical bars to a > table (so instead of \begin{tabular}{rrr}, something like > \begin{tabular}{r|rr} is generated when C-c C-c is executed in an > orgtbl-mode remote table). Is this possible? Yes. The way to do this is that you write the header of the table yourself, outside of the receive area, and then you then use the :splice option in the "ORGTBL: SEND" line. There is even an example in the manual: http://orgmode.org/manual/A-LaTeX-example.html#A-LaTeX-example > > Second, I have had some problems with calculations. I have the > following format for my table: > > % BEGIN RECEIVE ORGTBL test > % END RECEIVE ORGTBL test > \begin{comment} > #+ORGTBL: SEND test orgtbl-to-latex :splice nil :skip 0 > | Name | Age | Height | > |-------+-----+--------| > | Bob | 34 | 2 | > | James | 23 | 1.8 | > | Fred | 64 | 1.2 | > |-------+-----+--------| > | TOTAL | | | > \end{comment} > > With as the location of point. I want to sum the ages and put > them > in that cell, then sum the height and put them in the adjacent cell. > When I enter the formula :=vsum(@-II+1$2..-I-1$2) into the current > cell > and then tab to the next cell and enter :=vsum(@-II+1$3..-I-1$3), it > works great. However, this is very tedious when many columns are used! > Is there a way to enter many formulae in a row and have the column > automatically updated? There is no way to define row formulas. However, since you are summing in the column, all $-row references are optional, i.e. you can write the formula as :=vsum(@-II+1..-I-1) or even as :=vsum(@-II..-I) Since this is the same expression for all columns, you can copy it into the kill ring and then move with C-y TAB C-y TAB ..... pretty quickly through the row where you want the formulas. HTH - Carsten