From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jay Belanger Newsgroups: gmane.emacs.help Subject: Re: Calc embedded assignment without producing output Date: Sun, 03 Apr 2011 22:47:53 -0500 Message-ID: <87pqp2ekye.fsf@gmail.com> References: Reply-To: jay.p.belanger@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1301892108 9226 80.91.229.12 (4 Apr 2011 04:41:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Apr 2011 04:41:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 04 06:41:44 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6bbk-0005sa-0J for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Apr 2011 06:41:44 +0200 Original-Received: from localhost ([127.0.0.1]:40365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6bbj-00058b-Cl for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Apr 2011 00:41:43 -0400 Original-Path: usenet.stanford.edu!newsfeed.berkeley.edu!ucberkeley!feed.news.qwest.net!mpls-nntp-03.inet.qwest.net!news.more.net!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:xRFsk1JNQTqMvRKYQ8qMzxGoJGE= Original-Lines: 89 Original-NNTP-Posting-Host: 150.243.162.59 Original-X-Trace: news.more.net 1301888874 150.243.162.59 (Sun, 03 Apr 2011 22:47:54 CDT) Original-NNTP-Posting-Date: Sun, 03 Apr 2011 22:47:54 CDT Original-Xref: usenet.stanford.edu gnu.emacs.help:186482 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80599 Archived-At: > Here's an example. I'd like to be able to use calc in the following manner: > > \documentclass{article} > \begin{document} > %%% f := 10 %%% > > The first value is > $ > %%% f * 15 => %%% > 150 > $ > > The second value is > $ > %%% f * 13 => %%% > 130 > $ > \end{document} > > So, I'd like assignment f:=10 to be invisible in the document, but > calc always inserts "f \gets 10" after evaluating it. Calc could be adjusted to keep the ":=", although I don't suppose that it matters whether there is "f:=10" or "f \gets 10" in the comment. > Also, I'd like the evaluation of f*13 to only insert "150", and not > "\evalto f * 15 \to 150". > > Is there a way to get this kind of behavior from calc? Do you mean put the result on a separate line, but keep the formula inside a comment? Having something like that in Calc would probably be a good idea. For the time being, perhaps the following kludge would work. Keep the assignments and evaluation in comments, as above, but put them in dollar signs (to make them easier to activate): **** %%% $f := 10$ %%% The first value is $ %%% $f * 15 =>$ %%% $ **** When the => formulas get updated, the result will still be in comments, like **** %%% $f \gets 10$ %%% The first value is $ %%% $\evalto f 15 \to 150$ %%% $ **** Every once in a while run the function (defun update-assignments () (interactive) (save-excursion (goto-char (point-min)) (while (re-search-forward "^%+ *\\$.*\\\\to *\\(.*\\)\\$" nil t) (forward-line 1) (kill-line 1) (insert (match-string 1) "\n")))) which will put the result of the => formulas on the following lines. (Notice that the following line gets killed each time the above function is run, so don't start off with something you want kept there.) **** %%% $f \gets 10$ %%% The first value is $ %%% $\evalto f 15 \to 150$ %%% 150 $ **** This isn't quite what you asked for, but perhaps it will do for the time being. Jay