From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/77801 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Draft version of document Date: Tue, 07 Aug 2012 16:41:41 +0200 Message-ID: <50212925.3050900@wxs.nl> References: <501D04F7.7060407@mun.ca> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1344350531 23598 80.91.229.3 (7 Aug 2012 14:42:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Aug 2012 14:42:11 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Aug 07 16:42:11 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sykz5-0000R7-87 for gctc-ntg-context-518@m.gmane.org; Tue, 07 Aug 2012 16:42:11 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3A55910253; Tue, 7 Aug 2012 16:42:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RJuHDWNYQGYf; Tue, 7 Aug 2012 16:42:08 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 30C1310202; Tue, 7 Aug 2012 16:42:08 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2DB4E10202 for ; Tue, 7 Aug 2012 16:42:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ij3Yle0QknyB for ; Tue, 7 Aug 2012 16:42:05 +0200 (CEST) Original-Received: from filter1-utr.mf.surf.net (filter1-utr.mf.surf.net [195.169.124.152]) by balder.ntg.nl (Postfix) with ESMTP id D27AD101F8 for ; Tue, 7 Aug 2012 16:42:05 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter1-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q77Eg4PH031546 for ; Tue, 7 Aug 2012 16:42:05 +0200 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by pragma-net.nl (SurgeMail 6.1c) with ESMTP (TLS) id 1893-1713362 for multiple; Tue, 07 Aug 2012 16:42:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=03; city=Hattem; latitude=52.4724; longitude=6.0696; http://maps.google.com/maps?q=52.4724,6.0696&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 07HHOG4KX - a1e9238d33d6 - 20120807 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:77801 Archived-At: On 7-8-2012 14:51, Sietse Brouwer wrote: > Hi Robert, > Debugged and all, here you go. > Cheers, > Sietse > > \useexternalfigure[img:fig:cow][cow.pdf] > \useexternalfigure[img:fig:mill][mill.png] > > \starttext Actually, this is something that should be doable with user data weren't it that for floats that's not yet available. So I've added it to the core (will be in next upload) ... % macros=mkvi \unprotect % let's pick up two arguments \unexpanded\def\strc_floats_start_place#tag% {\flushnotes \page_otr_command_flush_side_floats % here ! \strc_floats_begin_group \strc_floats_set_current_tag{#tag}% \dodoubleempty\strc_floats_start_place_indeed} % and store the user data for a while \def\strc_floats_start_place_indeed[#settings][#userdata]% {\strc_floats_reset_variables \edef\savedfloatlocation{\floatcaptionparameter\c!location}% \setupcurrentfloatcaption[\c!location=,\c!reference=,\c!title=,\c!marking=,\c!list=,\c!bookmark=,#settings]% \def\savedfloatuserdata{#2}% \edef\floatlocation{\floatcaptionparameter\c!location}% \setupcurrentfloatcaption[\c!location=\savedfloatlocation]% \ifx\floatlocation\empty \edef\floatlocation{\floatparameter\c!default}% \fi \doifinsetelse\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal \bgroup \ignorespaces} % here we need to expand it one level (else detokenize will spoil it) \def\strc_floats_place_packaged_boxes {\expandafter\strc_floats_place_packaged_boxes_indeed\expandafter{\savedfloatuserdata}} \def\strc_floats_place_packaged_boxes_indeed#userdata% {\bgroup \ifconditional\usesamefloatnumber \globallet\currentfloatnumber \previousfloatnumber \globallet\currentfloatattribute \empty \globallet\currentfloatsynchronize\relax \else \ifnofloatnumber \else \ifnofloatcaption \else \strc_counters_increment{\strc_counters_the\currentfloat}% \fi \fi \strc_counters_register_component {float}% \setupcurrentfloatcaption \floatcaptionparameter \detokenizedfloatcaptionparameter \relax \relax \relax [\c!name=\currentfloat,% \s!counter=\strc_counters_the\currentfloat,% \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,% \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,% \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi]% [#userdata]% \globallet\previousfloatnumber \m_strc_counters_last_registered_index \globallet\currentfloatnumber \m_strc_counters_last_registered_index \globallet\currentfloatattribute \m_strc_counters_last_registered_attribute \globallet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize \fi % \global\setfalse\usesamefloatnumber % one shot % check float box \strc_floats_set_natural_dimensions\nextbox \global\setbox\floatbox\vbox{\floatparameter\c!command{\box\nextbox}}% \strc_floats_set_natural_dimensions\floatbox \ifdim\htdp\floatbox=\zeropoint \showmessage\m!floatblocks{11}\empty \global\setbox\floatbox\vbox {\dostarttagged\t!floatcontent\empty \strc_floats_place_empty_box \dostoptagged}% \fi % deal with lack of caption \global\setbox\floatbox\vbox \floatcaptionattribute {\doifelsemainfloatbody\currentfloatsynchronize\donothing \unvbox\floatbox \ifnofloatcaption \vss \fi}% gets rid of the depth (unless tabulate) \egroup % place the float \strc_floats_set_box \strc_floats_get_box \global\insidefloatfalse} % we need a raw untagged and expandable fetch: \def\rawstructurelistuservariable#name% {\ctxcommand{listuserdata("\currentlist",\currentlistindex,"#name")}} \protect % so, after some 5 lines patching we can do: \starttext \startplacefigure[reference=fig:mill,title={A Mill}][resource=mill] \externalfigure[mill] \stopplacefigure \startplacefigure[reference=fig:cow,title={A Cow}][resource=cow] \externalfigure[cow] \stopplacefigure \page \unexpanded\def\FigureListEntry#1#2#3% {\dontleavehmode \tbox{\hbox to 2cm{\externalfigure[\rawstructurelistuservariable{resource}][height=1cm]\hss}}% \hbox to 2em{#1\hss}% #2\hfill \hbox to 2em{\hss#3}% \blank} \setuplist[figure][alternative=command,command=\FigureListEntry] \placelist[figure] \stoptext Of course, the 'command' is not that nice looking but that's for others to improve. (In a similar fashion one can associate a resource or whatever to a section head and use it in a toc.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________