ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Idris Samawi Hamid <ishamid@lamar.colostate.edu>
Subject: bib module: author-date macros
Date: Sun, 2 Oct 2005 17:43:50 -0600	[thread overview]
Message-ID: <4341E107@webmail.colostate.edu> (raw)

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

             reply	other threads:[~2005-10-02 23:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-02 23:43 Idris Samawi Hamid [this message]
2005-10-07 14:41 ` Taco Hoekwater
2005-10-08 22:58   ` Vowels with accent (teTeX - Linux) Jilani Khaldi
     [not found]     ` <6faad9f00510090243n69cef293x@mail.gmail.com>
     [not found]       ` <4348FB6E.60103@virgilio.it>
     [not found]         ` <4349021F.5070604@virgilio.it>
2005-10-09 11:43           ` Jilani Khaldi
2005-10-09 12:42             ` VnPenguin
     [not found]               ` <43491894.7070901@virgilio.it>
2005-10-09 13:22                 ` VnPenguin
2005-10-09 15:26             ` Re[2]: " Giuseppe Bilotta
2005-10-09 17:13               ` Jilani Khaldi

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=4341E107@webmail.colostate.edu \
    --to=ishamid@lamar.colostate.edu \
    --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).