Here are some macros that I use; I was wondering if the new bib module has a 
better way to implement the following, since this sort of thing is used quite 
frequently in the author-date system that t-bib defaults to. See the examples 
in the following file (three depend on \cite[year] which has a problem--see 
previous mail).

I would really appreciate suggestions for improving this-)

Best
Idris

==========test-bib-macros.tex==========
% output=pdf interface=en

\setupwhitespace[big]

\usemodule[bib]

\setuppublications[alternative=apa]
\setuppublications[autohang=yes]
\setuppublications[numbering=no]
\setuppublications[criterium=cite]
\setuppublications[sorttype=bbl]

\setuppublicationlist[totalnumber={},samplesize=,author={\invertedauthor}]

\setupcite[authoryears][left={(},inbetween={ }, right={)}]

\def\citeauthoryear[#1]{%
  {\setupcite[authoryears][right={)},inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citeyear[#1]{%
  {\cite[year][#1]%
  }%
}

\def\citeauthoryearpage[#1][#2]{%
  {\setupcite[authoryears][right={, #2)},inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citeyearpage[#1][#2]{%
  {\setupcite[year][right={, #2)},inbetween={ }]%
   \cite[year][#1]%
  }%
}

\def\citeauthorout[#1]{%
  {\setupcite[authoryears][left={}, right={)},inbetween={ (}]%
   \cite[authoryears][#1]%
  }%
}

\def\citeauthoroutpage[#1][#2]{%
  {\setupcite[authoryears][left={}, right={, #2)},inbetween={ (}]%
   \cite[authoryears][#1]%
  }%
}

\def\citeleft[#1]{%
  {\setupcite[authoryears][left={(}, right={, },inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citeleftpage[#1][#2]{%
  {\setupcite[authoryears][left={(}, right={, #2; },inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citemiddle[#1]{%
  {\setupcite[authoryears][left={}, right={, },inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citeright[#1]{%
  {\setupcite[authoryears][left={}, right={)},inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citemiddlepage[#1][#2]{%
  {\setupcite[authoryears][left={}, right={, #2; },inbetween={ }]%
   \cite[authoryears][#1]%
  }%
}

\def\citerightpage[#1][#2]{%
  {\setupcite[authoryears][left={}, right={, #2)},inbetween={ }]%
  \cite[authoryears][#1]%
  }%
}

\input test-bib.bbl

\starttext

% examples

\dots as someone else pointed out \cite[afghani60].

\dots as someone else pointed out\citeauthoryear[afghani60].

%\dots as Afghani points out \cite[year][afghani60]. % crashes

%\dots as Afghani points out \citeyear[afghani60]. % crashes

%\citeyearpage[afghani60][p.~20]. % crashes

\dots as someone else pointed out\citeauthoryearpage[afghani60][p.~20].

See \citeauthorout[afghani60].

See \citeauthoroutpage[afghani60][p.~20].

\dots as others have pointed
out\citeleft[afghani60]%
\citemiddle[afghani60]%
\citeright[afghani60].

\dots as others have pointed
out\citeleftpage[afghani60][p.~20]%
\citemiddlepage[afghani60][p.~20]%
\citerightpage[afghani60][p.~20].

% \citeypage[afghani60][p.~20]    %(1956, p. 20)

\section{References}{\tfx\setupinterlinespace
{\placepublications}}

\stoptext
=========================================

==============test-bib.bbl===============
\startpublication[k=afghani60,
                  t=book,
                  a=Afgh\=an\=i,
                  y=1960,
                  s=]
\author[]{Sa\high{c}\=id}[]{}{Al-Afgh\=an\=i}
\title{Asw\=aqu \~al-\high{c}Arab f\=i
    \~al-J\=ahiliyya\~h wa \~al-Isl\=am}
\pubname{D\=aru \~al-Fikr}
\city{Damascus}
\pubyear{1960}
\stoppublication
=========================================

============================
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to