From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/48332 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: How to use my own BibTeX style (bst)? Date: Fri, 13 Mar 2009 18:30:24 +0100 Message-ID: <49BA9830.2030208@elvenkind.com> References: <436358128.01995@zju.edu.cn> <436429714.24327@zju.edu.cn> <49B2ACE1.5010800@gmail.com> <6faad9f00903090800v44877263te205e056cb28d282@mail.gmail.com> <49B5363D.4060700@elvenkind.com> <49B93AA0.1010200@gmail.com> <49B95496.3060407@elvenkind.com> <49B9B3BF.5070804@gmail.com> <49BA14BA.1000609@elvenkind.com> <49BA34FB.1030202@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050000090002020803040602" X-Trace: ger.gmane.org 1236965505 4355 80.91.229.12 (13 Mar 2009 17:31:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Mar 2009 17:31:45 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Mar 13 18:33:00 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 1LiBFR-0006lP-Mh for gctc-ntg-context-518@m.gmane.org; Fri, 13 Mar 2009 18:32:41 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D83F31FB98; Fri, 13 Mar 2009 18:31:17 +0100 (CET) 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 22188-04; Fri, 13 Mar 2009 18:30:48 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1D5AC1FB49; Fri, 13 Mar 2009 18:30:48 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 3EF831FB49 for ; Fri, 13 Mar 2009 18:30:47 +0100 (CET) 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 30448-02 for ; Fri, 13 Mar 2009 18:30:39 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by ronja.ntg.nl (Postfix) with ESMTP id 0B90B1FB39 for ; Fri, 13 Mar 2009 18:30:39 +0100 (CET) Original-Received: from smtp-vbr4.xs4all.nl (smtp-vbr4.xs4all.nl [194.109.24.24]) by filter2-ams.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n2DHUPbI024625 for ; Fri, 13 Mar 2009 18:30:32 +0100 Original-Received: from [192.168.178.26] (boo.demon.nl [82.161.175.147]) (authenticated bits=0) by smtp-vbr4.xs4all.nl (8.13.8/8.13.8) with ESMTP id n2DHUOOm002718 for ; Fri, 13 Mar 2009 18:30:25 +0100 (CET) (envelope-from taco@elvenkind.com) User-Agent: Thunderbird 2.0.0.19 (X11/20090114) In-Reply-To: <49BA34FB.1030202@gmail.com> X-Virus-Scanned: by XS4ALL Virus Scanner X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=194.109.24.24; country=NL; region=07; city=Amsterdam; latitude=52.3500; longitude=4.9167; http://maps.google.com/maps?q=52.3500,4.9167&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 193315842 - 827f63426f21 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 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:48332 Archived-At: This is a multi-part message in MIME format. --------------050000090002020803040602 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Wei-Wei Guo wrote: > Compare those two results: >=20 > - Chinese citation uses '=E7=AD=89' instead of 'et al'. > - Chinese bibliography uses '=E5=92=8C' instead of 'and'. >=20 > Of course, the comparison is not complete. >=20 > My question: Since I can write 'bibl-my-en.tex' for English entries and > 'bibl-my-zh.tex' for Chinese entries, can I use both of them when I hav= e=20 > both English and Chinese citations in one paper? If not, could you give= some=20 > advises about how to implement it? The short answer is no. The long answer: although you cannot make it depend on the language of the citation, you can make it change depending on an explicit language switch. This takes a bit of work, but it is better than nothing, I guess. Here is how: * first, edit the bibl-my file so that it contains calls to \labeltext{} instead of literal tests, for example: \setupcite [authoryears] [andtext=3D{ \labeltext{and} }, otherstext=3D{ \labeltext{etal}}, .... % many more are needed, of course you can invent wnatever you like in the argument of \labeltext, because you will define them in the next step. * second, define all the label texts you used in the previous step for the all languages you need. Short example: \setuplabeltext[en][etal=3D{et al.}, and=3D{and}] \setuplabeltext[cn][etal=3D{=E7=AD=89},and=3D{=E5=92=8C}] * third, you now need to do a \mainlanguage switch before every \cite that does not use the main language of your paper. So assuming your paper is uses \mainlanguage[cn], then you need to create a definition like this for the english citations: \def\encite[#1]{{\mainlanguage[en]\cite[#1]}} and you have to use \encite[article=3Dfull] in your paper. that takes care of the citations in the running text of your paper. For the publication list: * first, you have to redefine one of the t-bib macros. The new definition of \lang (to be put in your setup) should become \unprotect \def\lang#1% {\def\biblanguage{#1}% \ifcsname \??pb @lang@#1\endcsname \expanded{\mainlanguage[\getvalue{\??pb @lang@#1}]}% \expanded{\language[\getvalue{\??pb @lang@#1}]}% \fi \ignorespaces} \protect * two, you have to a language field to each bibtex data item. * three, you need a \setbiblanguage command for every language name that appears in your bib file. This will connect \lang arguments to context language keys. For example: \setbiblanguage{chinese}{cn} \setbiblanguage{english}{en} you may need a few of those, depending on how consistent your bibtex data is. After all of that, it will probably work, in most cases. Incidentally, one of the reasons why the bib modules doesn't do this is because all of that mucking about with \mainlanguage not very nice. Another is that a simple string replacement is usually not sufficient to have proper localization. A third reason is that many publishers want to have citation data in the language of the paper, regardless of the language of the cited publications. For completeness' I have attached my example again, with all these points applied. Best wishes, Taco --------------050000090002020803040602 Content-Type: application/x-tex; name="runme.tex" Content-Disposition: inline; filename="runme.tex" Content-Transfer-Encoding: quoted-printable \usemodule[bib] % data \startpublication[k=3Darticle-full,t=3Darticle, a=3D{{Aamport},{}},y=3D1986, n=3D1,s=3DAAAA86] \lang{english} % needed! \artauthor[]{Leslie~A.}[L.~A.]{}{Aamport} \artauthor[]{Leslie~A.}[L.~A.]{}{Aamport} \artauthor[]{Leslie~A.}[L.~A.]{}{Aamport} \artauthor[]{Leslie~A.}[L.~A.]{}{Aamport} \pubyear{1986} \arttitle{The gnats and gnus document preparation system} \journal{\mbox{G-Animal's} Journal} \volume{41} \issue{7} \pages{73--83} \month{7} \note{This is a full ARTICLE entry} \stoppublication \startpublication[k=3Dc-article-full,t=3Darticle, a=3D{{=E5=A7=93=E5=90=8D=E4=B8=80},{}},y=3D1986, n=3D2,s=3DXXXX86] \lang{chinese} \artauthor[]{}[]{}{=E5=A7=93=E5=90=8D=E4=B8=80} \artauthor[]{}[]{}{=E5=A7=93=E5=90=8D=E4=BA=8C} \artauthor[]{}[]{}{=E5=A7=93=E5=90=8D=E4=B8=89} \artauthor[]{}[]{}{=E5=A7=93=E5=90=8D=E5=9B=9B} \pubyear{1986} \arttitle{=E4=B8=80=E7=AF=87=E6=96=87=E7=AB=A0=E7=9A=84=E5=90=8D=E5=AD=97= } \journal{=E4=B8=80=E6=9C=AC=E6=9D=82=E5=BF=97=E7=9A=84=E5=90=8D=E5=AD=97= } \volume{41} \issue{7} \pages{73--82} \month{7} \note{This is a full ARTICLE entry} \stoppublication % example bibl changes \setupcite [authoryears] [andtext=3D{\labeltext{and}}, otherstext=3D{\labeltext{etal}}] \setuppublicationlist [lastnamesep=3D{\labeltext{and}}, finalnamesep=3D{\labeltext{and}}] % example labeltext definitions \setuplabeltext[en][etal=3D{ et al.},and=3D{ and }] \setuplabeltext[cn][etal=3D{=E7=AD=89},and=3D{=E5=92=8C}] % new \encite command \def\encite[#1]{{\mainlanguage[en]\cite[#1]}} % link 'chinese' to 'cn' and 'english' to 'en' \setbiblanguage{chinese}{cn} \setbiblanguage{english}{en} % redefine \lang \unprotect \def\lang#1% {\def\biblanguage{#1}% \ifcsname \??pb @lang@#1\endcsname \expanded{\mainlanguage[\getvalue{\??pb @lang@#1}]}% \expanded{\language[\getvalue{\??pb @lang@#1}]}% \fi \ignorespaces} \protect % typescript stuff follows \definefontfeature [chinese-traditional-hw] [mode=3Dnode,script=3Dhang,lang=3Dzht,hwid=3Dyes] \definefontsynonym [ChineseSampleHW] [adobemingstd-light*chinese-traditional-hw] \starttypescript [serif] [adobeming] [name] \usetypescript[fallback:serif] \definefontsynonym [Serif] [ChineseSampleHW] \definefontsynonym [SerifBold] [ChineseSampleHW] \definefontsynonym [SerifItalic] [ChineseSampleHW] \definefontsynonym [SerifBoldItalic] [ChineseSampleHW] \stoptypescript \starttypescript [adobeming] \definetypeface [adobeming] [rm] [serif] [adobeming] [default] \definetypeface [adobeming] [tt] [mono] [modern] [default] \definetypeface [adobeming] [ss] [sans] [modern] [default] \definetypeface [adobeming] [mm] [math] [lmvirtual] [default] \stoptypescript \usetypescript[adobeming] \setupbodyfont[adobeming] \mainlanguage[cn] \starttext English Bibliography \encite[article-full]. =E4=B8=AD=E6=96=87=E6=96=87=E7=8C=AE \cite[c-article-full]=E3=80=82 \completepublications[criterium=3Dall] \stoptext --------------050000090002020803040602 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 ___________________________________________________________________________________ --------------050000090002020803040602--