From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/40124 Path: news.gmane.org!not-for-mail From: Rory Molinari Newsgroups: gmane.comp.tex.context Subject: Adding custom key/value pairs Date: Sat, 12 Apr 2008 12:44:16 -0700 Message-ID: <2c62660f97846a8a50e04eab167dde42@quokka70.fastmail.fm> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1208029549 23102 80.91.229.12 (12 Apr 2008 19:45:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Apr 2008 19:45:49 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sat Apr 12 21:46:23 2008 connect(): Connection refused Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Jklg6-0003Fm-2d for gctc-ntg-context-518@m.gmane.org; Sat, 12 Apr 2008 21:46:22 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5FBAD1FBBD; Sat, 12 Apr 2008 21:45:42 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04288-01-9; Sat, 12 Apr 2008 21:44:57 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E65B61FB4E; Sat, 12 Apr 2008 21:44:56 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 380371FB33 for ; Sat, 12 Apr 2008 21:44:56 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02812-04-8 for ; Sat, 12 Apr 2008 21:44:19 +0200 (CEST) Original-Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by ronja.ntg.nl (Postfix) with ESMTP id 5BA2E1FB49 for ; Sat, 12 Apr 2008 21:44:19 +0200 (CEST) Original-Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 642C6ED69F for ; Sat, 12 Apr 2008 15:44:18 -0400 (EDT) Original-Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Sat, 12 Apr 2008 15:44:18 -0400 X-Sasl-enc: GXN7pjJdK+hhR6RfwKev2Gw6F3ochWK+LIH+91IrAyO9 1208029458 Original-Received: from [76.191.216.139] (76-191-216-139.dsl.dynamic.sonic.net [76.191.216.139]) by mail.messagingengine.com (Postfix) with ESMTPSA id E37DE1840A for ; Sat, 12 Apr 2008 15:44:17 -0400 (EDT) X-Mailer: Apple Mail (2.624) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:40124 Archived-At: Hi, I'm new to ConTeXt and decided to teach myself a bit by resetting my old thesis (originally done, many years ago, in LaTeX). As the purpose is to teach myself ConTeXt rather than just have an electronic version of the thesis I decided to try to do things the "right" way. So, in setting the title page I followed the pattern shown on Contextgarden here: http://wiki.contextgarden.net/Document_Titles. That page shows how to define a nice \placetitle command with an associated \setuptitle which allows us to define values for title, subject, and date. However, I want also to be able to define values for degree, subject, and committee (to follow the school-standard LaTeX style file I had from all those years ago). I can't work out how to do this. Simply using a variable like \c!degree (to match the \c!title I found in the example) doesn't work, as ConTeXt doesn't know about such a control sequence. I was quite puzzled for a while but then it dawned on me that the example I found on contextgarden works because the keys it uses (for key/value pairs) are ones that are already defined in the ConTeXt system: title, subject, date. My attempt fails because the system doesn't know about degree, subject, and committee. I tried defining a new variable with startvariables, but that didn't appear to help. So, my question: what do I need to do to define a new key that can be used in a key/value pair? Here's an example of what I tried: \startvariables all degree: degree \stopvariables \definesystemvariable{tp} % title page \def\setuptitlepage{\dodoubleempty\dosetuptitlepage} \def\dosetuptitlepage[#1][#2]% {\ifsecondargument \dodosetuptitlepage[#1][#2]% \else \dodosetuptitlepage[\v!content][#1]% \fi} \def\dodosetuptitlepage[#1][#2]% {\def\dododosetuptitlepage##1% {\getparameters[\??tp##1][#2]}% \processcommalist[#1]\dododosetuptitlepage} \def\placetitlepage {\startalignment[\v!middle] \doattributes{\??tp\c!degree}\c!style\c!color\@@tpcontentdegree \stopalignment} \setuptitlepage [\c!degree] [\c!style=\tfa,\c!color=] \startfrontmatter \placetitlepage \stopfrontmatter \starttext \stoptext Cheers, Rory ___________________________________________________________________________________ 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 ___________________________________________________________________________________