Re: [NTG-context] How to use my own BibTeX style (bst)?
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
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
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=AAAA86] \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=XXXX86] \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
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
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
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
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 @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
Dear all, I'm reading the source file of t-bib. I find there are lots of '\c!', '\s!', and '\v!'. What do they mean? I searched in wiki, TeXBook, ConTeXt manual, TeX impatient, and mail list. Those commands appear some times, but no explanation. Another question is related the following codes from Taco (thank you, Taco). There are tokens like '\??pb @lang@`. What does it mean? Could you tell me, to get deep understanding, what to read or which part to read in TeXBook or some other manuals. I don't know what to search to find related topics.
\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
Best wishes, Wei-Wei
On Sat, Mar 14, 2009 at 5:32 AM, Wei-Wei Guo
Dear all,
I'm reading the source file of t-bib. I find there are lots of '\c!', '\s!', and '\v!'. What do they mean? I searched in wiki, TeXBook, ConTeXt manual, TeX impatient, and mail list. Those commands appear some times, but no explanation.
http://archive.contextgarden.net/message/20080629.104105.40e28a70.el.html
Another question is related the following codes from Taco (thank you, Taco). There are tokens like '\??pb @lang@`. What does it mean? Could you tell me, to get deep understanding, what to read or which part to read in TeXBook or some other manuals. I don't know what to search to find related topics.
\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
Best wishes, Wei-Wei
Alan Stone wrote:
On Sat, Mar 14, 2009 at 5:32 AM, Wei-Wei Guo
wrote: Dear all,
I'm reading the source file of t-bib. I find there are lots of '\c!', '\s!', and '\v!'. What do they mean? I searched in wiki, TeXBook, ConTeXt manual, TeX impatient, and mail list. Those commands appear some times, but no explanation.
http://archive.contextgarden.net/message/20080629.104105.40e28a70.el.html
Also generally helpful for a low-level understanding of context are these wiki pages: http://wiki.contextgarden.net/System_Macros Best wishes, Taco
Thank you, Taco and Alan. Best wishes, Wei-Wei Taco Hoekwater 写道:
Alan Stone wrote:
On Sat, Mar 14, 2009 at 5:32 AM, Wei-Wei Guo
wrote: Dear all,
I'm reading the source file of t-bib. I find there are lots of '\c!', '\s!', and '\v!'. What do they mean? I searched in wiki, TeXBook, ConTeXt manual, TeX impatient, and mail list. Those commands appear some times, but no explanation.
http://archive.contextgarden.net/message/20080629.104105.40e28a70.el.html
Also generally helpful for a low-level understanding of context are these wiki pages:
Hi Taco, I just finished reading the 'System_Macros'. I still don't get the meaning of '\??pb @lang@' in the following codes: \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} In \lang[zh], for example, '\??pb @lang@' will be expanded to \@@pblangen, will it? Is \??pb a command? Is '\??pb @lang@' a command? Why can there be a whitespace in '\??pb @lang@'? Sorry for some many questions. I'm so confused and don't know what to search in wiki, manuals, etc.. Best wishes, Wei-Wei Taco Hoekwater 写道:
Also generally helpful for a low-level understanding of context are these wiki pages:
Am 15.03.2009 um 16:15 schrieb Wei-Wei Guo:
I just finished reading the 'System_Macros'. I still don't get the meaning of '\??pb @lang@' in the following codes:
\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}
In \lang[zh], for example, '\??pb @lang@' will be expanded to \@@pblangen, will it? Is \??pb a command? Is '\??pb @lang@' a command? Why can there be a whitespace in '\??pb @lang@'?
\lang{zh} forms in the \ifcsname ... \endcsname the command \@@pp@lang@zh and looks if the commands is defined, if this is true the language is switched to chinese.
Sorry for some many questions. I'm so confused and don't know what to search in wiki, manuals, etc..
The \??bp at the begin of the macro is ConTeXt's system to create a namespace. To understand I have to go a little bit away from the above macro and will explain it on ConText's command to create key-val list. With the internal command \getparameters is used to create key-val-lists, this is done with \getparameters[mycommand][width=1cm,height=2cm,align=right] This creates the commands \mycommandwidth with the value 1cm, \mycommandheight with the value 2cm and \mycommandalign with the value right. The text in the first brace is the namespace which is used as prefix for each created command. To optimize this operation and save a little bit of TeX's register we replace 'mycommand' with '\mycommand' which expand itself \mycommand, to make this system more consystem ConTeXt use the convetion to use namespaces with two question marks and two (or more) letter like the above \??bp, you can more of this tricks in a article from Hans [1]. The space after '\??bp' and the \lang macro above is necessary because TeX thinks otherwise '@lang@' is a part of the '\??bp' command and to prevent this Taco puts the space there. As a normal user you don't want to write macros or as beginner in ConTeXT programming you don't have to care about this but it's good to know why are things done in this way to understand system macros. [1] http://www.ntg.nl/maps/22/27.pdf Wolfgang
Wei-Wei Guo wrote:
Hi Taco,
I just finished reading the 'System_Macros'. I still don't get the meaning of '\??pb @lang@' in the following codes:
\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}
In \lang[zh], for example, '\??pb @lang@' will be expanded to \@@pblangen, will it? Is \??pb a command? Is '\??pb @lang@' a command? Why can there be a whitespace in '\??pb @lang@'?
\??pb creates a namespace so you cannot mess with it in your document easily \??pb is just a macro and the ?? makes it kind of private (hidden) there has to be a whitespace otherwise you'd call for \??pb@lang@
Sorry for some many questions. I'm so confused and don't know what to search in wiki, manuals, etc..
this is not stuff most users want to know or see; add a few \expandafter's, \futurelet's and \afterassignments and one wonders in what universe one has ended up Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Alan Stone
-
Hans Hagen
-
Taco Hoekwater
-
Wei-Wei Guo
-
Wolfgang Schuster