From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/51547 Path: news.gmane.org!not-for-mail From: Andreas Schneider Newsgroups: gmane.comp.tex.context Subject: Re: Conditional commands Date: Tue, 30 Jun 2009 18:14:28 +0200 Message-ID: <20090630181428.206747f7@netmaster> References: <20090629214149.2a3c2739@netmaster> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1687818639==" X-Trace: ger.gmane.org 1246378518 9450 80.91.229.12 (30 Jun 2009 16:15:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Jun 2009 16:15:18 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Jun 30 18:15:11 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1MLfzD-0003bW-6S for gctc-ntg-context-518@m.gmane.org; Tue, 30 Jun 2009 18:15:11 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D594F1FB82; Tue, 30 Jun 2009 18:15:06 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 28214-06-2; Tue, 30 Jun 2009 18:14:34 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8E48A1FB5A; Tue, 30 Jun 2009 18:14:34 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AA30E1FB39 for ; Tue, 30 Jun 2009 18:14:32 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 28214-06 for ; Tue, 30 Jun 2009 18:14:22 +0200 (CEST) Original-Received: from filter2-nij.mf.surf.net (filter2-nij.mf.surf.net [195.169.124.153]) by ronja.ntg.nl (Postfix) with ESMTP id 9114C1FB5A for ; Tue, 30 Jun 2009 18:14:22 +0200 (CEST) Original-Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by filter2-nij.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n5UGELWt026670 for ; Tue, 30 Jun 2009 18:14:21 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MLfyN-0003WN-Qd for ntg-context@ntg.nl; Tue, 30 Jun 2009 16:14:19 +0000 Original-Received: from p54b4cb57.dip.t-dialin.net ([84.180.203.87]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Jun 2009 16:14:19 +0000 Original-Received: from aksdb by p54b4cb57.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Jun 2009 16:14:19 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 162 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p54b4cb57.dip.t-dialin.net X-Newsreader: Claws Mail 3.7.1 (GTK+ 2.16.2; i686-pc-linux-gnu) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=80.91.229.2; country=NO; region=12; city=Oslo; latitude=59.9167; longitude=10.7500; http://maps.google.com/maps?q=59.9167,10.7500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 253026672 - 2efcbcbcc3cd - 20090630 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.153 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:51547 Archived-At: --===============1687818639== Content-Type: multipart/signed; micalg=SHA1; boundary="Sig_/=WHKn_g0Tw/UpUvvzjgdiAg"; protocol="application/pkcs7-signature" --Sig_/=WHKn_g0Tw/UpUvvzjgdiAg Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello again, after fiddling around some more, I stumbled across \getvalue which seems to solve my problems - for whatever reason ... I guess it does some preprocessing. I now got my bibliography enhancements (I needed so far) running. If someone else needs it, here it is: \def\mycite{\dodoubleempty\domycite} \def\defaultciterepeat{Ebenda} \def\defaultciteprefix{Vgl. } \def\defaultcitepage{S. } \def\defaultcitechapter{Kap. } \def\domycite[#1][#2]{% \ifsecondargument \getparameters[MCP][prefix=3D\defaultciteprefix,page=3D,chapter=3D,suff= ix=3D,#1] \doinsertmycite[#2]{\MCPprefix}{% \expandoneargafter\doifnotempty{\MCPpage}{\ \defaultcitepage\MCPpage.}% \expandoneargafter\doifnotempty{\MCPchapter}{\ \defaultcitechapter\MCPchapter.}% \expandoneargafter\doifnotempty{\MCPsuffix}{\ \MCPsuffix}% } \else \doinsertmycite[#1]{\defaultciteprefix}{} \fi } \def\doinsertmycite[#1]#2#3{% \footnote{% #2%prefix \doifelse{\getvalue{mycitelast}}{#1}% {\defaultciterepeat\doifempty{#3}{.}}% {\doifelse{\getvalue{mycitepast #1}}{used}% {\bgroup% \getcitedata[arttitle][#1] to \bibtitle \cite[alternative=3Dauthoryear][#1]. \bibtitle.% \egroup}% {\cite[alternative=3Ddata][#1]}}% #3%suffix } \setvalue{mycitelast}{#1} \setvalue{mycitepast #1}{used} } Essentially all it does is: wrap \mycite around \cite to process the output depending on the circumstances: * if the citation is the first of this bib-entry, it is places completely into the footnote (alternative=3Ddata) * if the citation was used before, in the document, it is only referenced rather short (author, year, title) * if the citation was used _directly_ before, it is not repeated but only referenced with the word "Ebenda" (meaning more or less "see above") It is also able to prepend text (like "Vgl. " [=3D"Compare"]) and append text (like page or chapter number, or a custom string). Examples: \mycite[some_bib_entry] \mycite[prefix=3D{Vgl. }, page=3D123, chapter=3D{Introduction}, suffix=3D{some more text.}][some_bib_entry] The only thing it doesn't handle (yet) is, if a citation was directly used before on a previous page. Then mycitelast should be reset so that at least the short citation is used. But I wasn't able to find a safe way to do this. I fiddled around with \insertpagebreakhandler for a while, but apart from not yielding any result, I don't believe, that it is intended for stuff like this. So if someone knows a way to handle that last case (page break) too, I would be glad to hear about it. Regards, Andreas. On Mon, 29 Jun 2009 21:41:49 +0200 Andreas Schneider wrote: > Hi, >=20 > I'm currently trying to make a command that outputs different text > depending on the situation it has been called, but I'm absolutely > stuck there (I'm not very familiar with TeX, so it's probably obvious > to most of you :-/). It currently looks like this: >=20 > \doassign[mycite][last=3D] > \def\mycite[#1]{% > \footnote{% > \doifelse{\mycitelast}{#1}{Ebenda}{\cite[alternative=3Ddata][#1]}% > } > \doassign[mycite][last=3D#1] > } >=20 > The idea is as follow: if I cite the same citation two or more times > in a row (e.g. Some text\mycite[chan_genetic_2005] ... more > text\mycite[chan_genetic_2005]) it should only output the whole > quotation the first time, and "Ebenda" all the other times. But as it > seems, the \doifelse always evaluates to false and therefore outputs > the whole citation every time. >=20 > Does someone see what I might be doing wrong? Or is there even a > better way to do this? >=20 > Thanks, > Andreas. >=20 --Sig_/=WHKn_g0Tw/UpUvvzjgdiAg Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAA oIIFLDCCBSgwggMQoAMCAQICAwaZczANBgkqhkiG9w0BAQUFADB5MRAwDgYDVQQK EwdSb290IENBMR4wHAYDVQQLExVodHRwOi8vd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u0F5g/cbMgppUso ih+e5U2X2phg6v3ttLZuvzeKkIn4BS8CSuPQwsrR+O02ob1ov5EgV2c05L5CJ8eQ LhXFVbASXvZ93pHQkXyvqSI3z1WHNsfU11hxI7bSX6YNuYuM8L6K8UlCUZaJnXhu UOxoyaI0H7ku4cyFg6pSB7rT1qdxPe74uMUWpYIt+0X0LQ1Ss6G8628qxqwOOmsU Ct/0okPehX/lo9WZXw/5xrh+pUXZkBHVXMm9TP3mW4fITUCuHSpSAK8IJFipk+/M RA6q6ho7a+v/JqXsOVgGH/DhPPjH8AAAAAAAAA== --Sig_/=WHKn_g0Tw/UpUvvzjgdiAg-- --===============1687818639== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1687818639==--