From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eNEXHNvckGLbdQEAbAwnHQ (envelope-from ) for ; Fri, 27 May 2022 16:14:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CDceG9vckGKmLwEAG6o9tA (envelope-from ) for ; Fri, 27 May 2022 16:14:51 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B2E21159F9 for ; Fri, 27 May 2022 16:14:50 +0200 (CEST) Received: from localhost ([::1]:53680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuajp-0002fO-UF for larch@yhetil.org; Fri, 27 May 2022 10:14:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuaYd-0005lc-KS for emacs-orgmode@gnu.org; Fri, 27 May 2022 10:03:15 -0400 Received: from mail-oa1-x2a.google.com ([2001:4860:4864:20::2a]:45358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nuaYb-00022t-02 for emacs-orgmode@gnu.org; Fri, 27 May 2022 10:03:15 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-e93bbb54f9so5811736fac.12 for ; Fri, 27 May 2022 07:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddoherty.net; s=google; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=iADsZu52FErl4mW7YNElHfnBBuuHO+RQ9XG2g2PTJqQ=; b=J+T6xKvRIAYfLmoupKmH2urzjDmFhLIA8tff11IzFO0zfs5czUQpacGx4JFtTyAWcq GBJkK2fGmCqCn1HcNRKTi1jzUVjDhfCEx63bqKOaeQfkTLVX+NfWCSzc8HuCZXBPglB/ RsnwCqnYx/QDUOpQgYMQxnemQ5PYuAVez+ZmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=iADsZu52FErl4mW7YNElHfnBBuuHO+RQ9XG2g2PTJqQ=; b=nbO9fezTm+WKb+2wtCA4na9ZbP/f92F2snWePL/mEgltY/41zmzdisx/FtSuKb/foR xWHMxjwOC3fHKFLzJYVj/bkNjSdOjAeSgtcMtefqS2mtdjF3liWv0A0vDIJP3l+D6yE8 GdD2Q0USSEjNwFbK39nIGV2OEq1dFB8FK8SFfLr+xcQ9Dq/4O7zX6PAhOqUJdRp/kG57 4kmuwYSUtm/8Ue4NHWF0TKVRWLuaeidnR2LIjExuo3E+PAPlcHDWYc9FNT72gaJ5HWfK oM9H9Sh04Y6S2bLer7QxOyBh0J6jsFeksgG9lFbAXbrKBC/ZCxKkKd5WwS73sNODydzg p00Q== X-Gm-Message-State: AOAM531htcMLJqLwW1+nVa7kHONBkMRIfCl9X+p08+9nTJCK1jy7QZkq C5rf9EefO5te7A6sRD3aV8FXtQzOcbGbYg== X-Google-Smtp-Source: ABdhPJyWlP2zcL3xt4J9VF2dTeTbdI72o5D2UYOVj25hEGebfN2UIpd0DG4USdE/zYi9Q0r2/zYVqA== X-Received: by 2002:a05:6870:a1a0:b0:d9:b198:4cfa with SMTP id a32-20020a056870a1a000b000d9b1984cfamr4174600oaf.159.1653660189612; Fri, 27 May 2022 07:03:09 -0700 (PDT) Received: from saturn.ddoherty.net ([136.33.241.2]) by smtp.gmail.com with ESMTPSA id jf9-20020a0568707b8900b000f2455e26acsm641073oab.48.2022.05.27.07.03.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 May 2022 07:03:08 -0700 (PDT) References: <87pmk0qdfb.fsf@ddoherty.net> <87a6b3gza9.fsf@localhost> User-agent: mu4e 1.6.2; emacs 29.0.50 From: "Daniel E. Doherty" To: emacs-orgmode@gnu.org Subject: Re: Allow Currency Symbols and Grouping Commas in Table Numbers Date: Fri, 27 May 2022 08:49:47 -0500 In-reply-to: <87a6b3gza9.fsf@localhost> X-Keywords: Org-Mode Message-ID: <87y1ynul7o.fsf@ddoherty.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2001:4860:4864:20::2a; envelope-from=ded@ddoherty.net; helo=mail-oa1-x2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653660890; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=iADsZu52FErl4mW7YNElHfnBBuuHO+RQ9XG2g2PTJqQ=; b=Qg5MVYBGo7ROx9tC/sGxINEbfkHrU1bfsxRv8PCs48hg4M9ApnDKDPXUGSp51LGtfXp+0Z /uvin0T0uu3Wl75R8DOijZeocgdjiYmIjSqBblmhOqgU5Srm9Jikg6G36umKmvHh3O9ZHJ 3PqmDfKr9PFTsDuklQX1TkPTtG1VBwFvm1BDNUaytTqy9kyfE41TVZDh0Jyn4w7B3tlY4+ nMn8LQiwNeKfv/A6YmtL5D5KyTb/n+e61LIdD+mg3yYnbFNei4uxQXThCoQxZ3e2mtiJOZ R/Jom1tlyUKW/trTGyTuFBrXIdc5ncniOvosfiDv65sksR4jQlqmZdiK5Lo9tg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653660890; a=rsa-sha256; cv=none; b=pvX2sDRQnPhb7s1VcWFLEiOMsAMav9/97wnIapPrZTdcPBHTrGA9tnhUzQT4BYrxxHrMry poGOUHeD5IUsR+r+UWXoTUsnCWAeIRH6RnGCUqXac9JdGdEhAdeEWE07QuWIjlCshtVIRF qQy6bzOuauBtGS/eqt0jVz54wLd8ZLmqfx9FEwHwjV3adx8nSOXwLsnke3HGbVFXaLbIJp RDrJVLN94cTHqoZfTOEthfYYD6apA9/oL2cbMccoYg5HjTFFLMbTsm9JHeRSqbyPM+jmmS hvE4h3IOzoYq0hwsIZ5bq0oOuAuz7FL2v5bSpEZnLPcRTsWjIxlcIQmRHOiYkQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=ddoherty.net header.s=google header.b=J+T6xKvR; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -8.34 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=ddoherty.net header.s=google header.b=J+T6xKvR; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B2E21159F9 X-Spam-Score: -8.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: KcaDiAFs6qYF On Fri, May 27 2022, Ihor Radchenko wrote: Ihor, thanks for your thoughts, but this does not solve my problem. Here is an sample org table that exemplifies the problem: ================================================== #+begin_SRC emacs-lisp (setq org-calc-default-modes '(calc-internal-prec 12 calc-float-format (float 8) calc-angle-mode deg calc-prefer-frac nil calc-symbolic-mode nil calc-language latex ;; <--- this is new compared to default calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm)) calc-display-working-message t)) #+end_SRC #+RESULTS: | calc-internal-prec | 12 | calc-float-format | (float 8) | calc-angle-mode | deg | calc-prefer-frac | nil | calc-symbolic-mode | nil | calc-language | latex | calc-date-format | (YYYY - MM - DD Www ( hh : mm)) | calc-display-working-message | t | | Description | Amount | |--------------+-----------------| | Mortage | $125,000.26 | | Credit Cards | 6,325.00 | | Auto Loan | 14,853.00 | |--------------+-----------------| | Total | :=vsum(@I..@II) | #+TBLFM: @5$2=vsum(@I..@II) -> Error: Invalid field specifier "$125" | Description | Amount | |--------------+-----------| | Mortage | 125000.26 | | Credit Cards | 6325.00 | | Auto Loan | 14853.00 | |--------------+-----------| | Total | 146178.26 | #+TBLFM: @5$2=vsum(@I..@II) | Description | Amount | |--------------+------------| | Mortage | 125,000.26 | | Credit Cards | 6,325.00 | | Auto Loan | 14,853.00 | |--------------+------------| | Total | 1323.26 | #+TBLFM: @5$2=vsum(@I..@II) Note that the total is wrong. | Description | Amount | |--------------+----------------------------| | Mortage | \dollar 125000.26 | | Credit Cards | 6325.00 | | Auto Loan | 14853.00 | |--------------+----------------------------| | Total | 125000.26 \dollar + 21178. | #+TBLFM: @5$2=vsum(@I..@II) Total is still wrong. ============================================ > > You can, for example, do > > | 1 USD | 2 USD | 4 USD | 7 USD | > > #+tblfm: $4=vsum($1..$3) > > Emacs calc is able to work with arbitrary ascii symbols or even units. > However, calc does not appear work with unicode. If Emacs calc were to > support unicode, it would automatically work in Org. > > Also, you can > > enable latex in calc via > (setq org-calc-default-modes > '(calc-internal-prec 12 > calc-float-format (float 8) > calc-angle-mode deg > calc-prefer-frac nil > calc-symbolic-mode nil > calc-language latex ;; <--- this is new compared to default > calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm)) > calc-display-working-message t)) > But it requires the \dollar on every entry. The convention if financial table is to include the currency symbol only on the first item. > Then, the following will work > > | \dollar1 | \dollar2 | \dollar3 | 6 \dollar | > > #+tblfm: $4=vsum($1..$3) Whatever calc is able to handle, calc is not getting the entries interpreted as numbers, or at least not the numbers that a human would understand. My elisp skills are limited, but it seems that org mode could, as a matter of course, strip commas and currency symbols from the numbers before delivering them to calc, and, if the user wants add back the grouping commas and currency symbol with a format specifier in the result. Also, it would be better if the regular expression for recognizing numbers allowed grouping commas and currency symbols to be included by default so that financial-type numbers get right-aligned by default. > > Best, > Ihor -- ==================================================== Daniel E. Doherty Law Offices of Daniel E. Doherty 7300 W. 110th Street, Suite 930 Overland Park, KS 66210 913.338.7182 (Phone) 913.338.7164 (FAX) ded@ddoherty.net