Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-13 Thread Taco Hoekwater

Wei-Wei Guo wrote:




Maybe it is better to provide a simple example. For example, I have try.bbl
as following.


In mkiv (and xetex also, I assume), that just works, assuming you have a
working typescript for the combination of scripts. Example attached (the
example uses AdobeMingStd-Light)

I have absolutely no idea how to make this work in pdftex.

Best wishes,
Taco



runme.tex
Description: TeX document
___
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
___


Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-13 Thread Wei-Wei Guo

Taco Hoekwater 写道:


In mkiv (and xetex also, I assume), that just works, assuming you have a
working typescript for the combination of scripts. Example attached (the
example uses AdobeMingStd-Light)



You might misunderstand. I was providing an example to you in my previous email,
not asking you to give me an example file. But it is fine since I can describe
my problem clear based on the PDF file generated from 'runme.tex'.

Here is what I want:

  English Bibliogrphy (Aamport, et al.,1986).
  中文文献(姓名一, 等, 1986)。

  Aamport, L. A., Aamport, L. A., Aamport, L. A. and Aamport, L. A. (1986).
 The gnats and gnus document preparation system. G-Animal's Journal, 41(7),
 73-83. This is a full ARTICLE entry.
  姓名一, 姓名二, 姓名三 和 姓名四(1986).一篇文章的名字.一本杂志的名字, 41(7),
 73-82. This is a full ARTICLE entry.


Here is what 'runme.tex' provides:

  English Bibliogrphy (Aamport, et al.,1986).
  中文文献(姓名一, etal, 1986)。

  Aamport, L. A., Aamport, L. A., Aamport, L. A. and Aamport, L. A. (1986).
 The gnats and gnus document preparation system. G-Animal's Journal, 41(7),
 73-83. This is a full ARTICLE entry.
  姓名一,姓名二,姓名三and姓名四(1986).一篇文章的名字.一本杂志的名字, 41(7),
 73-82. This is a full ARTICLE entry.


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?

Hope I made it clear this time.


Best wishes,
Wei-Wei


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


Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-13 Thread Taco Hoekwater

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 @l...@#1\endcsname
\expanded{\mainlanguage[\getvalue{\??pb @l...@#1}]}%
\expanded{\language[\getvalue{\??pb @l...@#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





runme.tex
Description: TeX document
___
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
___


Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-13 Thread Wei-Wei Guo

Thank you very much!

Best wishes,
Wei-Wei


Taco Hoekwater 写道:

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 @l...@#1\endcsname
\expanded{\mainlanguage[\getvalue{\??pb @l...@#1}]}%
\expanded{\language[\getvalue{\??pb @l...@#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

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


Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-12 Thread Wei-Wei Guo

Thank you, Mojca and Taco. I finally get my t-bib working. Now I can
continue working on my bibl style.

Taco Hoekwater 写道:

I don't know those styles get adapted automatically when language is
changed. Taco should answer (I should take a closer look, but no time
now).


They do not. You have to give a setup command like

  \setuppublications[alternative=my-zh] % for bibl-my-zh.tex


I'm not sure if you can use different style for different books based
on language the book was written in (maybe possible, but tedious, the
style would have to be rewritten completely).


With a suitable \setuppublicationlayout this should be possible:
you can decide based on the value of the current language, which is
set from the bibtex language field automatically. But I have never
actually tried to do this, so I have no example code available for you.



I'm still confused. Is it possible to use different bibl based on the value
of \lang. Or I can only implement it with bunch of \if in *one* bibl file?

Best wishes,
Wei-Wei
___
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
___


Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-12 Thread Taco Hoekwater

Wei-Wei Guo wrote:




I'm still confused. Is it possible to use different bibl based on the value
of \lang. 


I am not sure what \lang is now, but you cannot get a different bibl
file based on the current \language or \mainlanguage in the document.

I was talking about influencing one (or more) of the entries in the
bibliography list based on the language of that actual entry. With
quite some trickery, that could be made to work (but not easy either).

Best wishes,
Taco






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


Re: [NTG-context] How to use my own BibTeX style (bst)?

2009-03-12 Thread Wei-Wei Guo

Taco Hoekwater 写道:

Wei-Wei Guo wrote:




I'm still confused. Is it possible to use different bibl based on the 
value
of \lang. 


I am not sure what \lang is now, but you cannot get a different bibl
file based on the current \language or \mainlanguage in the document.



The \lang that I said is the entry field in \startpublications. It is listed
in the t-bib manual.


I was talking about influencing one (or more) of the entries in the
bibliography list based on the language of that actual entry. With
quite some trickery, that could be made to work (but not easy either).



Maybe it is better to provide a simple example. For example, I have try.bbl
as following.


  \startpublication[k=article-full,t=article,
  a={{Aamport},{}},y=1986,
  n=1,s=86]
  \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=c-article-full,t=article,
  a={{姓名一},{}},y=1986,
  n=2,s=86]
  \lang{chinese}
  \artauthor[]{}[]{}{姓名一}
  \artauthor[]{}[]{}{姓名二}
  \artauthor[]{}[]{}{姓名三}
  \artauthor[]{}[]{}{姓名四}
  \pubyear{1986}
  \arttitle{一篇文章的名字}
  \journal{一本杂志的名字}
  \volume{41}
  \issue{7}
  \pages{73--82}
  \month{7}
  \note{This is a full ARTICLE entry}
  \stoppublication


And I cite those two entries in my main text.


  English Bibliogrphy \cite[article-full].

  中文文献 \cite[c-article-full]。


I want to get


  English Bibliogrphy (Aamport, et al.,1986).
  中文文献(姓名一, 等, 1986)。


Could you give some clues about how to implement it?

Another question: How to get Hoekwater(2009) instead of (Hoekwater, 2009)?
I mean the equal command of \citet in LaTeX.


Best wishes,
Wei-Wei
___
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
___