From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oFGZOGf/kmAFMwEAgWs5BA (envelope-from ) for ; Wed, 05 May 2021 22:26:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EOpdNGf/kmBMNAAA1q6Kng (envelope-from ) for ; Wed, 05 May 2021 20:26:15 +0000 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 2057E10279 for ; Wed, 5 May 2021 22:26:15 +0200 (CEST) Received: from localhost ([::1]:55654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leO61-0004gp-UW for larch@yhetil.org; Wed, 05 May 2021 16:26:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leO4w-0004gF-14 for emacs-orgmode@gnu.org; Wed, 05 May 2021 16:25:06 -0400 Received: from mout.gmx.net ([212.227.17.21]:43223) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leO4t-0001bM-3a for emacs-orgmode@gnu.org; Wed, 05 May 2021 16:25:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620246298; bh=M19jYMRzQmZOete3W7u83geGxMr0kf1F3iek9CZF744=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=XuqTyMS475P2cxZ1C9NAE45gNVwZeWCqMeqoIawtkGfWUa8kj5P0xaHlLecoaxLU9 YX2x034wQHOdzWp7cd40vQoPiH6BBfCMkBH4QNfBmC9HHmOiu9I/CmynJNgT42iegm Wsa2ZR/XLQUAzBwpuFr/iuwtp4m6nWSdZOuBWYe4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs16.server.lan [172.19.170.184]) (via HTTP); Wed, 5 May 2021 22:24:58 +0200 MIME-Version: 1.0 Message-ID: From: pietru@caramail.com To: Eric S Fraga Subject: Re: Multiple calc commands with orgbabel Content-Type: text/plain; charset=UTF-8 Date: Wed, 5 May 2021 22:24:58 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <87eeelrv6s.fsf@ucl.ac.uk> References: <871ral7kq8.fsf@ucl.ac.uk> <87eeelrv6s.fsf@ucl.ac.uk> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:Bsv4drPmhCXbrpzXCYFK+n0HrxA+DvZIE9ai059r9IN2RGuLHnvBUIkN6iIMZsBI6VBKE pdcAZOfLsZuJY9POtGCNSOwufMs7oeq2ePffTATAor+2VKWkqY0F5BMHoa8AG8EEqI8KUkKThveH H1KIdR/WjBiITlGiBwnbBaFdZcQwnRFCfnAuedHhg5rIK2ehZMYG3qdYRH8FciEq76h8Y644t5DT tXiD4JaSoE5ejlyFaAu4VBozsxJEfhaq6xYfUSDgz7JzC2UFfOxunznM8qxWkfJph8d4cyMtKF5B zQ= X-UI-Out-Filterresults: notjunk:1;V03:K0:aLaQDXBezBs=:t5mB1rkBIIQL+EDhXNN6jD Yo43IyeBDGF/12RzYaxlZ8LHyaGopxyRDRA99dK6h0O5nGKKY2ZMhJNo7gA+h5n3tSX0rAYN0 ZmtLX8BL7g2Wt94dMAp/ldZX7fgZsBRzssMrLG9vQ+2JcwukOhEo1jK+A5lNrdewe+Bou387x kdR4lHvfWsZT99F7UlCxe3BHC5q7pBFMN0r3WOcTN0hR3R8zp/FJ0Ian1GW3FVglubTRyVJD3 evGy7DFwfxbXwW/hUnEAGg8QA6J95FW9gmXU5GCzgHbX0tnOaV8CAbhjSvkxe/uvlDMfpoS5e FZdfzCo+JVJKYTNkws53mMeQoaLMqL7jw3fsqdVDZtByMhJ8fbGO/LxN24l5XnGyuAHUEw3vc TAmmYbzAmFxmPSd9kYtSRCi+yzM10bq1pgjZD9DCA9aDCZQohW7T18iGP5bb0Med/vZRlnGsD pbraE4UtMl3HB4Zy23ZIuHsuBHuPp6SPNR8uVcQ4N1cU5XmJpR42TfdKS5KMOndK9m2fZTwLN VoLZ/6Hjx/wj9fruCsVLAqvGbr8oNRy18dV+9YWTpl2g8NTRean1tahAOpxlFBDtKTZ3YQ2uM ZiIOkV5pRcF1x7vW4HJKszG2IC+gZgziDFTUfJkF+pHBzUJxqlZ1chvfbVoTwMQpBewtEPK6c MRDHNUH7vnrfXIYCjKARLPnWkRDPdTOC/naUwWks1PWlONXpOoO2EJjSG3H8GzbbE4umbFp38 XMg2mcW09jCm4BlU+rooTnIGiR285fJu0MJFE1EcB3HIs4QBIDeYN7t9bp3nQamy2/llISyc1 BfQNmsTzFjvIjKQot3AetJ8aTEwRf1dkOMZ+R2iqkDLL176ZN1ymIqdKZLBIhJdNFp2SiELj5 azibrY6JteF26qs4lswYHWwWPIPtu9Ahn38cGry/t6EE6ZuC7TiH4V8nLlS66F Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=212.227.17.21; envelope-from=pietru@caramail.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org Mode List Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620246375; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=nCtGN1Xc3BAywLjrorQZR6VF05iuHTGG4NsiagIWZbs=; b=omY2a98eSFK2z14st5WzpdHsOdlf0m6J2T/0Q2fwpjPbwLJTSR3mNt2a10aN79FyQlX8+x 6EILXF/k7Pg460HFFJVeKVcFZ4dnG/7LjUVaX85rJouMZznFkrfcdsz3yORhlqWzm8EfbM 3fOHQc8xmioHX/jVaCIiL4wLVyFoj0t427aA0VqDX9niIdHMpo16vb4UaOdq+nOvZixLKF NxO2LU68JWD4V2NBBFsjARWOk6yATjBPYXNF9tf1vDLe/wpY2DXTtlpvjr4WcJjQW7gBbq sUlfuFRcbpkJTn9Ceyf455xoEK8Wsmr+ceOgQZZ7bm+VwCgFYJFJN4DGMNLaSg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620246375; a=rsa-sha256; cv=none; b=C0CoOircjXhCqYUJXdQ1xUMpEjkKZErOgklfUx2yw93xu0qlR9jS+/9LHaavI8iNeMhi9z HHFEni0auRYO8Ar5LZK7PJAS7veZoeYglEDtqTLrDFdSCvoEDXOqFcOW596MPtu/8mZcwk PgZYT55uP4Y4rnNNsAlY1D2ZezKjsVtU2gFKp6JLV2z3ZDgCqWYzzHI7Zcp+GsHdyZti1e ORmXYU6glr7G2ePrg9ppgUklMpitrtQKwaroumVLUD0wnAMs7D5a5+IBULtEVTASSYOlTJ s/LuZ/Gq/RXJJ62+12NGycgQG0PBDC030fL+0wt+61cm77OQ0qi+MpIaNwRJTQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=XuqTyMS4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=caramail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.87 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=XuqTyMS4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=caramail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2057E10279 X-Spam-Score: -0.87 X-Migadu-Scanner: scn0.migadu.com X-TUID: f+uIPWcoBTJL > Sent: Thursday, May 06, 2021 at 4:39 AM > From: "Eric S Fraga" > To: "Matt Price" > Cc: pietru@caramail.com, "Org Mode List" > Subject: Re: Multiple calc commands with orgbabel > > On Wednesday, 5 May 2021 at 11:11, Matt Price wrote: > > Can you explain how you get calc embedded mode working in org? I have > > never used it and it sounds interesting, but I don't understand what > > hte delimiters are. > > Sure. Here is a mini-tutorial! :-) I recently gave an interactive talk > on embedded Calc... > > The out-of-the-box settings for Emacs embedded mode are such that any > line surrounded by empty lines (i.e. couple of blank lines before and > after) can be interpreted as an expression to evaluate by Calc using > "C-x * u". You do not need to place these expressions in any src block. > > The detection can be somewhat fragile so extra blank lines are sometimes > necessary for some reason. > > For instance, copy the following few lines to a text buffer and type > "C-x * u" on each line in turn: > > --8<---------------cut here---------------start------------->8--- > > > x :=3D 180 =3D> > > > y :=3D sin(x / 4) =3D> > > > z :=3D 2 y^2 =3D> > > > --8<---------------cut here---------------end--------------->8--- > > The general format for an embedded calc expression is > > var :=3D expression =3D> value > > where only "expression" is required. If you don't have "=3D>", evaluati= ng > the expression will replace the expression with its value. > > If you have lines as above, with assignments and values after the actual > expression, you can then go back to the first line and change the value, > say to 90, type "C-x *u" on that line again and all of them should > update. > > The calculations can involve calculus (derivatives, integration), linear > algebra, and units. Calc is actually an incredibly powerful (and > relatively unknown) computer algebra system hiding within Emacs. Calc is a great piece of work. Has it been long that work was done on it? > The variables that could be customised to have org specific recognition > would be calc-embedded-open-formula and calc-embedded-close-formula. It > might be useful for the community to think about whether org should have > org specific settings for these variables. I actually define settings > for org so that only lines that look like this: > > #+calc: expression > > are interpreted (without requiring empty lines around such lines) > [1]. I then have code for processing these lines on export to LaTeX to > present the equations and results in a more accessible way as I use > embedded calc a lot for teaching (beamer slides). > > Final note: the info manual for embedded Calc mode emphasises editing > the expressions and interacting with Calc while doing so. I find that > method of working rather confusing, tiring, and unproductive (for my use > case) so I write the calc lines using normal editing and only "update" > the expressions to get the results. YMMV, of course. > > Let me know if this helped at all, > eric > > > Footnotes: > [1] it would be nice to have some generic way to hijack C-c C-c on such > lines to do what I want, e.g. calc-embedded-update-formula. > > -- > : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-395-g82fbdd > >