From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: How to get sum from remote table + how to put in bold? Date: Mon, 7 Dec 2015 18:39:45 +0000 Message-ID: <871tayxfv2.fsf@ucl.ac.uk> References: <86si3fvf14.fsf@example.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a60hW-0004cd-Pa for emacs-orgmode@gnu.org; Mon, 07 Dec 2015 13:39:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a60hT-0008Vk-7e for emacs-orgmode@gnu.org; Mon, 07 Dec 2015 13:39:54 -0500 Received: from mail-db3on0132.outbound.protection.outlook.com ([157.55.234.132]:46142 helo=emea01-db3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a60hS-0008Ve-SL for emacs-orgmode@gnu.org; Mon, 07 Dec 2015 13:39:51 -0500 In-Reply-To: <86si3fvf14.fsf@example.com> (Fabrice Niessen's message of "Sun, 6 Dec 2015 15:16:07 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Fabrice Niessen Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain On Sunday, 6 Dec 2015 at 15:16, Fabrice Niessen wrote: > Hello, > > I'm trying to build a template for invoices written in Org... exporting > to PDF (and HTML). Will be officially public as soon as it's DONE. > > Though, I have 2 problems currently: > > - I'd like to sum up, in table `total', the sub-total column of table > `items'. But the `remote' call does not seem to accept the `vsum' > expression. Is this a foreseen limitation? Is there a workaround to this? > > - I'd like to get the computed amount (last line of `total' table) in bold (and, > if possible, even in a bigger font). How is that doable? I've fixed your ECM: 1. moved attr_latex and other latex stuff to before the names of the tables and 2. inverted the order of vsum and remote so that you do a vsum over what the remote function returns. Seems to work. See attached. -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.2-379-g38fd09 --=-=-= Content-Type: text/x-org Content-Disposition: attachment; filename="t.org" #+TITLE: Invoice #001 #+OPTIONS: H:2 num:nil toc:nil #+LaTeX_CLASS: article #+LaTeX_CLASS_OPTIONS: [a4paper,table] #+LaTeX_HEADER: \usepackage{tabu} #+LaTeX_HEADER: \taburulecolor{gray} * Items #+ATTR_LaTeX: :environment tabu :align lXlrlrrl #+name: items | | <35> | | | | | | | | Title of job | Description | Type | Rate | | Quantity | Sub-total | | |--------------+-------------------------------------+-------+------+--------+----------+-----------+------| | Consultancy | Quote template | Timed | 400 | \EUR/d | 6.5 | 2600.00 | \EUR | |--------------+-------------------------------------+-------+------+--------+----------+-----------+------| | Research | Billing invoice template | Timed | 400 | \EUR/d | 10.0 | 4000.00 | \EUR | #+TBLFM: $7=$6*400;%.2f * Amount Due #+latex: \hfill\colorbox{yellow}{\begin{minipage}{7.5cm} #+ATTR_LaTeX: :environment tabu :align Xrl #+name: total | /Sub-total/ | 6600.00 | \EUR | |------------+---------+------| | /Tax @ 21%/ | 1386.00 | \EUR | |------------+---------+------| | *Amount Due* | 7986.00 | *\EUR* | #+TBLFM: @1$2=vsum(remote(items,@3$7..@4$7));%.2f::@2$2=@1*0.21;%.2f::@3$2=vsum(@1..@-1);%.2f #+latex: \end{minipage}} --=-=-=--