ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: How to use my own BibTeX style (bst)?
Date: Fri, 13 Mar 2009 18:30:24 +0100	[thread overview]
Message-ID: <49BA9830.2030208@elvenkind.com> (raw)
In-Reply-To: <49BA34FB.1030202@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3241 bytes --]

Wei-Wei Guo wrote:
> Compare those two results:
> 
> - Chinese citation uses '等' instead of 'et al'.
> - Chinese bibliography uses '和' instead of 'and'.
> 
> Of course, the comparison is not complete.
> 
> 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 have 
> both English and Chinese citations in one paper? If not, could you give some 
> 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={ \labeltext{and} },
         otherstext={ \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={et al.}, and={and}]
   \setuplabeltext[cn][etal={等},and={和}]

* 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=full] 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




[-- Attachment #2: runme.tex --]
[-- Type: application/x-tex, Size: 2956 bytes --]

[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2009-03-13 17:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 17:22 Wei-Wei Guo
     [not found] ` <436429714.24327@zju.edu.cn>
     [not found]   ` <49B2ACE1.5010800@gmail.com>
     [not found]     ` <6faad9f00903090800v44877263te205e056cb28d282@mail.gmail.com>
     [not found]       ` <49B5363D.4060700@elvenkind.com>
2009-03-12 16:38         ` Wei-Wei Guo
2009-03-12 18:29           ` Taco Hoekwater
2009-03-13  1:15             ` Wei-Wei Guo
2009-03-13  8:09               ` Taco Hoekwater
2009-03-13 10:27                 ` Wei-Wei Guo
2009-03-13 17:30                   ` Taco Hoekwater [this message]
2009-03-14  4:23                     ` Wei-Wei Guo
2009-03-14  4:32                     ` What does "\c!" means? Wei-Wei Guo
2009-03-14  7:22                       ` Alan Stone
2009-03-14  7:25                         ` Taco Hoekwater
2009-03-14 14:44                           ` Wei-Wei Guo
2009-03-15 15:15                           ` Wei-Wei Guo
2009-03-15 15:38                             ` Wolfgang Schuster
2009-03-15 16:01                             ` Hans Hagen
2009-03-16  5:13                               ` Wei-Wei Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49BA9830.2030208@elvenkind.com \
    --to=taco@elvenkind.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).